diff --git a/commits/commits-0000.jsonl.gz b/commits/commits-0000.jsonl.gz new file mode 100644 index 0000000000000000000000000000000000000000..be645322a80394c552be2f0d2e7251bcbec37a55 --- /dev/null +++ b/commits/commits-0000.jsonl.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:96ae1295b0b27434596d85048e47ddc501ad6400e4475c2c9fbb85bf74118512 +size 13406 diff --git a/patches/02/0269edf45b34dc7b9a8ab24596aa1d1ec9f6b475.patch.jsonl.gz b/patches/02/0269edf45b34dc7b9a8ab24596aa1d1ec9f6b475.patch.jsonl.gz new file mode 100644 index 0000000000000000000000000000000000000000..b4f2907cd6b8abb77b723cdebb5d81c3acac76b1 --- /dev/null +++ b/patches/02/0269edf45b34dc7b9a8ab24596aa1d1ec9f6b475.patch.jsonl.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cd2014320128cd288aefccef582375dfc105dceea27989a9907495c546fbb546 +size 958 diff --git a/patches/04/049e6b572d88d141fccf09e12854988daf146e67.patch.jsonl.gz b/patches/04/049e6b572d88d141fccf09e12854988daf146e67.patch.jsonl.gz new file mode 100644 index 0000000000000000000000000000000000000000..504e86afa0ad7b6c0258cf3aae02e3f6fc3ddd37 --- /dev/null +++ b/patches/04/049e6b572d88d141fccf09e12854988daf146e67.patch.jsonl.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3ba35c9a35f9976da6164c81bb02ceb6dc4ca11a3126871b6f158e9cc9d0f0dc +size 9095 diff --git a/patches/08/08166991f814c73b4217800ecdee560626b4986c.patch.jsonl.gz b/patches/08/08166991f814c73b4217800ecdee560626b4986c.patch.jsonl.gz new file mode 100644 index 0000000000000000000000000000000000000000..175721bd083b03c7c854d5f39a944c1c76a05778 --- /dev/null +++ b/patches/08/08166991f814c73b4217800ecdee560626b4986c.patch.jsonl.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ae811023de4c84243a11cc02c2cded5e7c0b1bbacae324a935d65d0c8cf2000c +size 684 diff --git a/patches/0b/0b59b9086cd68eef346413a27d03fa61fb6bb1f7.patch.jsonl.gz b/patches/0b/0b59b9086cd68eef346413a27d03fa61fb6bb1f7.patch.jsonl.gz new file mode 100644 index 0000000000000000000000000000000000000000..23dc3b1146fa9af7e19d23d9c20e19abf8451144 --- /dev/null +++ b/patches/0b/0b59b9086cd68eef346413a27d03fa61fb6bb1f7.patch.jsonl.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8e7cfda12977d8b62b7951b6e4d2afa2965c276ccb42675b97020f01c846c4db +size 15137 diff --git a/patches/0b/0ba5d543496de040f637c5bf8d2529667d25e8a5.patch.jsonl.gz b/patches/0b/0ba5d543496de040f637c5bf8d2529667d25e8a5.patch.jsonl.gz new file mode 100644 index 0000000000000000000000000000000000000000..b58b8dde7d549b3effcd01389823fcc4d3f8ac9b --- /dev/null +++ b/patches/0b/0ba5d543496de040f637c5bf8d2529667d25e8a5.patch.jsonl.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bb66cad6c2910e2d72fb79a90badae7ddef9bcda05059038383dde701b98add7 +size 1896 diff --git a/patches/19/19db2b5cb8eb8abac1a7a6a57a68422c10e2a9b4.patch.jsonl.gz b/patches/19/19db2b5cb8eb8abac1a7a6a57a68422c10e2a9b4.patch.jsonl.gz new file mode 100644 index 0000000000000000000000000000000000000000..856cf104cfb3c590b9cd0216a73d28d41c19771e --- /dev/null +++ b/patches/19/19db2b5cb8eb8abac1a7a6a57a68422c10e2a9b4.patch.jsonl.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:441ec8fbdb591acffe8d63d40560fc5588b0f8281cc8c0ac4c33027e2eed5f83 +size 17025 diff --git a/patches/1f/1ff2ed9477a691b23fd2882e2e53dd20078199d4.patch.jsonl.gz b/patches/1f/1ff2ed9477a691b23fd2882e2e53dd20078199d4.patch.jsonl.gz new file mode 100644 index 0000000000000000000000000000000000000000..f67ac5cd533002cfa9abfb7609c170de6dc8fad7 --- /dev/null +++ b/patches/1f/1ff2ed9477a691b23fd2882e2e53dd20078199d4.patch.jsonl.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c5bd950fc27dadd020aad6d38df5801f26944287dc9fe6a5e640422da155feae +size 638 diff --git a/patches/26/26930a47e905baf647f218328e81529951d4f563.patch.jsonl.gz b/patches/26/26930a47e905baf647f218328e81529951d4f563.patch.jsonl.gz new file mode 100644 index 0000000000000000000000000000000000000000..35724fd1c214462f1823b5e01dff7592493f724e --- /dev/null +++ b/patches/26/26930a47e905baf647f218328e81529951d4f563.patch.jsonl.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4e8af149bc740adc820e4221553b4b31809e339eed6731f80baccfe5cc52e793 +size 1182 diff --git a/patches/2d/2da681a265ef85e90f5282acda3140e78aa847d5.patch.jsonl.gz b/patches/2d/2da681a265ef85e90f5282acda3140e78aa847d5.patch.jsonl.gz new file mode 100644 index 0000000000000000000000000000000000000000..45386af676839aab6a222902f6cfe5e6b37a1d91 --- /dev/null +++ b/patches/2d/2da681a265ef85e90f5282acda3140e78aa847d5.patch.jsonl.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:94d02a5504296888e8fcb7efc120400fedf627a3188667f845e5736fda32544e +size 458 diff --git a/patches/30/30925ca5dd51be93e33ac4492b85c2322263b3fc.patch.jsonl.gz b/patches/30/30925ca5dd51be93e33ac4492b85c2322263b3fc.patch.jsonl.gz new file mode 100644 index 0000000000000000000000000000000000000000..ade7c8bf3d06df909deed1f6625552ed8582cdcd --- /dev/null +++ b/patches/30/30925ca5dd51be93e33ac4492b85c2322263b3fc.patch.jsonl.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ca57a0cccf5ff5012b43ea6a8f9b919a352476edf46f231237a7935502f9bc92 +size 3675 diff --git a/patches/47/47ae9908e1b3adc6d889e13742959e466e878c79.patch.jsonl.gz b/patches/47/47ae9908e1b3adc6d889e13742959e466e878c79.patch.jsonl.gz new file mode 100644 index 0000000000000000000000000000000000000000..03887ea4a3eeeb503fc2e83dce1deb61d689e0f3 --- /dev/null +++ b/patches/47/47ae9908e1b3adc6d889e13742959e466e878c79.patch.jsonl.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5cc9696134d50823836ff47eb330b40d812a6552b5901b152ef71eb5c8f16c7e +size 5193 diff --git a/patches/49/49cd1225abb852bf4c024d39ce777caa98c58892.patch.jsonl.gz b/patches/49/49cd1225abb852bf4c024d39ce777caa98c58892.patch.jsonl.gz new file mode 100644 index 0000000000000000000000000000000000000000..9c63d0f277539dcde55762a45d563111118382f4 --- /dev/null +++ b/patches/49/49cd1225abb852bf4c024d39ce777caa98c58892.patch.jsonl.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:62e6b6d2e8a3482d4e4caa4692994a804b891272e24f5fe82903cdf96768ab9e +size 473 diff --git a/patches/4b/4b7f2093db87be939814c9da0dbaaf2f2975bb84.patch.jsonl.gz b/patches/4b/4b7f2093db87be939814c9da0dbaaf2f2975bb84.patch.jsonl.gz new file mode 100644 index 0000000000000000000000000000000000000000..556f7166b7c3ad83571bf8af6a645b66eee7bed6 --- /dev/null +++ b/patches/4b/4b7f2093db87be939814c9da0dbaaf2f2975bb84.patch.jsonl.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8dde2b94ac0e3dd44598e208dcf3740d4cb520e7f96a7eb15f5a322ed807935e +size 914 diff --git a/patches/58/58ff01bab25b167c5f6d8614b02b10d16154e461.patch.jsonl.gz b/patches/58/58ff01bab25b167c5f6d8614b02b10d16154e461.patch.jsonl.gz new file mode 100644 index 0000000000000000000000000000000000000000..88296c7f2bac0fb981f61a4aedbc65a90ca9fc87 --- /dev/null +++ b/patches/58/58ff01bab25b167c5f6d8614b02b10d16154e461.patch.jsonl.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bea94eca0675d150b6435eadc445356476ae3295316bc68b73951aa0dc06f48d +size 8135 diff --git a/patches/5e/5efe4d9751bd88861bbe3e609bb815983fca9778.patch.jsonl.gz b/patches/5e/5efe4d9751bd88861bbe3e609bb815983fca9778.patch.jsonl.gz new file mode 100644 index 0000000000000000000000000000000000000000..e9fdc3bdaf0ede5ba36e251da0400703d9e3b773 --- /dev/null +++ b/patches/5e/5efe4d9751bd88861bbe3e609bb815983fca9778.patch.jsonl.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:698b43a4e5a9bcf375c5f9d259e0e919c2f629d5429724d5832d60ff6e35f44c +size 11092 diff --git a/patches/60/6016377ad8e424c58bb91af5c145741ba84e059f.patch.jsonl.gz b/patches/60/6016377ad8e424c58bb91af5c145741ba84e059f.patch.jsonl.gz new file mode 100644 index 0000000000000000000000000000000000000000..611f583793c36381cb454fafc7f9571cabef92f6 --- /dev/null +++ b/patches/60/6016377ad8e424c58bb91af5c145741ba84e059f.patch.jsonl.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f525b96c8f4677c3d045c79edf9cdd0c6deccf0c4c96631c23e37f5b6bd64c1e +size 1385 diff --git a/patches/6d/6d984d4859c349da8ab44914ee0ad37c94ef6e0c.patch.jsonl.gz b/patches/6d/6d984d4859c349da8ab44914ee0ad37c94ef6e0c.patch.jsonl.gz new file mode 100644 index 0000000000000000000000000000000000000000..93570130639a12c96e48f05fbd3f50b29aa41631 --- /dev/null +++ b/patches/6d/6d984d4859c349da8ab44914ee0ad37c94ef6e0c.patch.jsonl.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:14c5b5a4302c593de3090467d600af8f1dc3d33d7572c2ed543cdd6d0e0763e9 +size 23607 diff --git a/patches/70/7047c3faa1e71c7ad13592cd41b77be3cdc1a8a2.patch.jsonl.gz b/patches/70/7047c3faa1e71c7ad13592cd41b77be3cdc1a8a2.patch.jsonl.gz new file mode 100644 index 0000000000000000000000000000000000000000..9b295d4923fa93fb1a2a58b4f0c17fa832078fbc --- /dev/null +++ b/patches/70/7047c3faa1e71c7ad13592cd41b77be3cdc1a8a2.patch.jsonl.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:82a3cdd289a1f33ceb5d6657a9c66dd0f74da46c7356f08ad3db383f360c27da +size 5156 diff --git a/patches/70/70b426e3cac2dffee30fe99cdaa7040d74d92312.patch.jsonl.gz b/patches/70/70b426e3cac2dffee30fe99cdaa7040d74d92312.patch.jsonl.gz new file mode 100644 index 0000000000000000000000000000000000000000..cb13652aa477774f932660c3068be8d59ead940f --- /dev/null +++ b/patches/70/70b426e3cac2dffee30fe99cdaa7040d74d92312.patch.jsonl.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:371b4cf66f1f2f41e442967381654cc5a47c470ebf4c1517f7f28ca303e6382b +size 1724 diff --git a/patches/72/72eb25f074b600aa7db6c5ddab640a89f074e725.patch.jsonl.gz b/patches/72/72eb25f074b600aa7db6c5ddab640a89f074e725.patch.jsonl.gz new file mode 100644 index 0000000000000000000000000000000000000000..dc890382449ea02121c60c80b1e0504079be3e9e --- /dev/null +++ b/patches/72/72eb25f074b600aa7db6c5ddab640a89f074e725.patch.jsonl.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bbaff3957e4c9aba32c222a42870b5ef75fcccf8b7aea85c938b5d07d3b99683 +size 2883 diff --git a/patches/73/73dfa5e4fa3da2772648678e5ce0dbee4d1a63b5.patch.jsonl.gz b/patches/73/73dfa5e4fa3da2772648678e5ce0dbee4d1a63b5.patch.jsonl.gz new file mode 100644 index 0000000000000000000000000000000000000000..095c6b7eeef61309c6226d94c466e70b98c6dbc2 --- /dev/null +++ b/patches/73/73dfa5e4fa3da2772648678e5ce0dbee4d1a63b5.patch.jsonl.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dcafd2401e57df848941e99ac3ac629aa70afa3d7d988927833bcb17cdd5f06e +size 10281 diff --git a/patches/84/8446ffbf5992a97d79d129cade997effc60fcd85.patch.jsonl.gz b/patches/84/8446ffbf5992a97d79d129cade997effc60fcd85.patch.jsonl.gz new file mode 100644 index 0000000000000000000000000000000000000000..59c6a9522bc383ac72842b1ca8d6d2b56dd347c7 --- /dev/null +++ b/patches/84/8446ffbf5992a97d79d129cade997effc60fcd85.patch.jsonl.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:32fbff806dec9f5c3a8d53b304a0ede59edd5ca0c0323e090605ac7b17bb9969 +size 1733 diff --git a/patches/84/84a3492550118f4ad2a48beb50e87625605b6a82.patch.jsonl.gz b/patches/84/84a3492550118f4ad2a48beb50e87625605b6a82.patch.jsonl.gz new file mode 100644 index 0000000000000000000000000000000000000000..385e78692366f9682db59270c32da17411d9c1cb --- /dev/null +++ b/patches/84/84a3492550118f4ad2a48beb50e87625605b6a82.patch.jsonl.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5d4e0bf2b59d9820f289a68db58b38c07dee35444c2a1480ef59f2d6514fb5e0 +size 2752 diff --git a/patches/8d/8d398c623d21f667a28224f78f0851394dd57477.patch.jsonl.gz b/patches/8d/8d398c623d21f667a28224f78f0851394dd57477.patch.jsonl.gz new file mode 100644 index 0000000000000000000000000000000000000000..4f987633d58789b320cfa34028dd569683b1e153 --- /dev/null +++ b/patches/8d/8d398c623d21f667a28224f78f0851394dd57477.patch.jsonl.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5bfe4c03757c6db18d2b5246871544b1e3691c242b11f70cde4547ba3bcaa9d7 +size 855 diff --git a/patches/a5/a56d78a46a3ee80cdb2b48f9abfd2cd7b297e328.patch.jsonl.gz b/patches/a5/a56d78a46a3ee80cdb2b48f9abfd2cd7b297e328.patch.jsonl.gz new file mode 100644 index 0000000000000000000000000000000000000000..ca3651c5d1e38357e3c654e09f89c5a5852f5a7e --- /dev/null +++ b/patches/a5/a56d78a46a3ee80cdb2b48f9abfd2cd7b297e328.patch.jsonl.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:16fc9306d625e4c092d19b995a9d15c2dee3ebb93957f26f2561ecb4c854e030 +size 1046 diff --git a/patches/a8/a819b4639b1e4279b117f4693cb0716b08e5e2e9.patch.jsonl.gz b/patches/a8/a819b4639b1e4279b117f4693cb0716b08e5e2e9.patch.jsonl.gz new file mode 100644 index 0000000000000000000000000000000000000000..fa3f649ed98991071eaadf666f6730c659c385b0 --- /dev/null +++ b/patches/a8/a819b4639b1e4279b117f4693cb0716b08e5e2e9.patch.jsonl.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dbdc041c547ef994706be6802d6b592a6a1d6731a2266abd7386a5ffbf829428 +size 742 diff --git a/patches/aa/aaf5ea9886cd11222ee2eced21e098182c0388ac.patch.jsonl.gz b/patches/aa/aaf5ea9886cd11222ee2eced21e098182c0388ac.patch.jsonl.gz new file mode 100644 index 0000000000000000000000000000000000000000..7c0fa3eb7cc4b36da738d6c02d3a557aeac2f8c0 --- /dev/null +++ b/patches/aa/aaf5ea9886cd11222ee2eced21e098182c0388ac.patch.jsonl.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c29810690e1dc4fd91bf35b2902d4e47aa7d5a205151158948b72d8d0b466e02 +size 1273 diff --git a/patches/ad/ad05dc4176114dad3420a78af238d3842160e464.patch.jsonl.gz b/patches/ad/ad05dc4176114dad3420a78af238d3842160e464.patch.jsonl.gz new file mode 100644 index 0000000000000000000000000000000000000000..8be43d6c255cc1420b33b2f7700a495f571fb5e9 --- /dev/null +++ b/patches/ad/ad05dc4176114dad3420a78af238d3842160e464.patch.jsonl.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:75d103ba95b43c8306a0b96a514c79ff05b2b14af86cabed207d6caa3ba96be7 +size 3786 diff --git a/patches/ad/ad247b7663e46e9e53c0c7011f1a3acee1ebe36c.patch.jsonl.gz b/patches/ad/ad247b7663e46e9e53c0c7011f1a3acee1ebe36c.patch.jsonl.gz new file mode 100644 index 0000000000000000000000000000000000000000..20e72aaf4347bb2a8edbce24cd567e1f4f600691 --- /dev/null +++ b/patches/ad/ad247b7663e46e9e53c0c7011f1a3acee1ebe36c.patch.jsonl.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:be4d63b3c324af3c91c7d44d9c6019df4bec3251cc8074bcd78922f9b55b242b +size 14253 diff --git a/patches/b1/b1486f8bd31dbe741ac01f36053bc4a2f3eaaa78.patch.jsonl.gz b/patches/b1/b1486f8bd31dbe741ac01f36053bc4a2f3eaaa78.patch.jsonl.gz new file mode 100644 index 0000000000000000000000000000000000000000..409dca5a38d02bf92e10a878afe71342af2b6733 --- /dev/null +++ b/patches/b1/b1486f8bd31dbe741ac01f36053bc4a2f3eaaa78.patch.jsonl.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:74ade379cc82cc9439a0dc3c08dc066443852c517b7a72796d228d8eb473408f +size 3416 diff --git a/patches/b8/b8c5bf3f6d0809ba318694d69db1e4431b2c4c0b.patch.jsonl.gz b/patches/b8/b8c5bf3f6d0809ba318694d69db1e4431b2c4c0b.patch.jsonl.gz new file mode 100644 index 0000000000000000000000000000000000000000..4c9fb9d46f64a3a30e81404354a9a0ce92b045d1 --- /dev/null +++ b/patches/b8/b8c5bf3f6d0809ba318694d69db1e4431b2c4c0b.patch.jsonl.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d3263b35ed139f7d37441f5ab5f97267b33ba1383262cc5747c01327655d3145 +size 5987 diff --git a/patches/ba/ba15c0f194e2e128a1304e11d45f794cd3b69cbe.patch.jsonl.gz b/patches/ba/ba15c0f194e2e128a1304e11d45f794cd3b69cbe.patch.jsonl.gz new file mode 100644 index 0000000000000000000000000000000000000000..e9dea08b800c681c3c1ffe79dd5a315658c344c6 --- /dev/null +++ b/patches/ba/ba15c0f194e2e128a1304e11d45f794cd3b69cbe.patch.jsonl.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:257149bcc9551deaf86cc1cb75a186295604328a5e80c1c30caa58735def0f11 +size 1765 diff --git a/patches/c0/c09c936643170c595303293601d41c4207e12068.patch.jsonl.gz b/patches/c0/c09c936643170c595303293601d41c4207e12068.patch.jsonl.gz new file mode 100644 index 0000000000000000000000000000000000000000..98a2a1164d1db66c00840cd42bf21fc6b9c94660 --- /dev/null +++ b/patches/c0/c09c936643170c595303293601d41c4207e12068.patch.jsonl.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1a9efc66174a5127bbba2065372dce18f71969a3aeac3974ca76f0f0bbde8a14 +size 33993 diff --git a/patches/c5/c5174fd6ed720340fcffe8715503eb4e5fcfc774.patch.jsonl.gz b/patches/c5/c5174fd6ed720340fcffe8715503eb4e5fcfc774.patch.jsonl.gz new file mode 100644 index 0000000000000000000000000000000000000000..cdf6546ce7d171b4d80a0bf63b288bcbefc6597f --- /dev/null +++ b/patches/c5/c5174fd6ed720340fcffe8715503eb4e5fcfc774.patch.jsonl.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7555a7f29198cef752ba6ca8c16d741ac42d83e19094d8e1f2fe79cbe4705766 +size 1619 diff --git a/patches/c9/c90625a4ea163e03895276a04ec3a23d4117413d.patch.jsonl.gz b/patches/c9/c90625a4ea163e03895276a04ec3a23d4117413d.patch.jsonl.gz new file mode 100644 index 0000000000000000000000000000000000000000..a04f821c7ed94499de1f15230fbc1d177689db7c --- /dev/null +++ b/patches/c9/c90625a4ea163e03895276a04ec3a23d4117413d.patch.jsonl.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ff38862a184044ed7fcc214d6b57287922632e4588352f9929f5000e57719187 +size 1185 diff --git a/patches/cb/cb34ec51e0f2b4ba071602f5fe974429de542b80.patch.jsonl.gz b/patches/cb/cb34ec51e0f2b4ba071602f5fe974429de542b80.patch.jsonl.gz new file mode 100644 index 0000000000000000000000000000000000000000..290b97f5e849cfc59de0d8c3a14ae4bda50fb411 --- /dev/null +++ b/patches/cb/cb34ec51e0f2b4ba071602f5fe974429de542b80.patch.jsonl.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ea04a35022fb6d41bed7560d0503a91c57a2e9e38ccf4d89cfc3024bdf2eaf4c +size 13563 diff --git a/patches/cc/cc44831c51893805d76afc284107597a9dcd9963.patch.jsonl.gz b/patches/cc/cc44831c51893805d76afc284107597a9dcd9963.patch.jsonl.gz new file mode 100644 index 0000000000000000000000000000000000000000..c13f8d4d1a4a1d6645c9d5ec82c2ae765e671ab9 --- /dev/null +++ b/patches/cc/cc44831c51893805d76afc284107597a9dcd9963.patch.jsonl.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:178d73dd0b7ed2167398336f19095b01cda805cce2794a55d677459fc13c6028 +size 1360 diff --git a/patches/cc/ccccdf280fd00a55a8262384a8a8e9b0655cd7d5.patch.jsonl.gz b/patches/cc/ccccdf280fd00a55a8262384a8a8e9b0655cd7d5.patch.jsonl.gz new file mode 100644 index 0000000000000000000000000000000000000000..bc2ae2b2412ba43282cb9f6c013a93f3162c45a1 --- /dev/null +++ b/patches/cc/ccccdf280fd00a55a8262384a8a8e9b0655cd7d5.patch.jsonl.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0ffc081980252b83963929196de98456782375e7ba63858123180e07b25db402 +size 739 diff --git a/patches/ce/ce0159b6d098dba1e00622d18b0f1b29f2151b9f.patch.jsonl.gz b/patches/ce/ce0159b6d098dba1e00622d18b0f1b29f2151b9f.patch.jsonl.gz new file mode 100644 index 0000000000000000000000000000000000000000..3919c633e176e13ba3ab6f56649d47d5093bc18a --- /dev/null +++ b/patches/ce/ce0159b6d098dba1e00622d18b0f1b29f2151b9f.patch.jsonl.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a27828c4add1b2e23c0750e343faae983c218dd5449a1f5ce67ce45bd6b2711e +size 12020 diff --git a/patches/cf/cf64d2a9dcef422e7d080e21a7e8644694337a51.patch.jsonl.gz b/patches/cf/cf64d2a9dcef422e7d080e21a7e8644694337a51.patch.jsonl.gz new file mode 100644 index 0000000000000000000000000000000000000000..d185ebee89acaa2d9d5133005982836b7b4199a2 --- /dev/null +++ b/patches/cf/cf64d2a9dcef422e7d080e21a7e8644694337a51.patch.jsonl.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:92b5434aa8a71f53487ba8edc7f63ad4410ef7a1147bb4b7ebdea5353d93cc48 +size 4361 diff --git a/patches/d1/d122f0157c8ccb3e000b83fb03b7587d87e5e5ea.patch.jsonl.gz b/patches/d1/d122f0157c8ccb3e000b83fb03b7587d87e5e5ea.patch.jsonl.gz new file mode 100644 index 0000000000000000000000000000000000000000..2d4a0f68929dd2a19457cffb6788971fa51e4527 --- /dev/null +++ b/patches/d1/d122f0157c8ccb3e000b83fb03b7587d87e5e5ea.patch.jsonl.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e71b18be31bd68bce49962b10a5eb2dd5d8ced89c9e5513d78e1abf503a6958f +size 512 diff --git a/patches/d1/d18a94188ea93d07c4581888880088a9e676b1fd.patch.jsonl.gz b/patches/d1/d18a94188ea93d07c4581888880088a9e676b1fd.patch.jsonl.gz new file mode 100644 index 0000000000000000000000000000000000000000..107b4b7529ad1890f283c33eab235a24bf9537e0 --- /dev/null +++ b/patches/d1/d18a94188ea93d07c4581888880088a9e676b1fd.patch.jsonl.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e2b327d54c72502373f58eb2d8fe9f025f81c2b26402107d845ba3a88cede85f +size 10666 diff --git a/patches/d8/d8cefa9f4f12fd0cc6fd7847cff8f478303f0f0e.patch.jsonl.gz b/patches/d8/d8cefa9f4f12fd0cc6fd7847cff8f478303f0f0e.patch.jsonl.gz new file mode 100644 index 0000000000000000000000000000000000000000..80f06f152e9e6243fae1ce821883bf18a7f8411c --- /dev/null +++ b/patches/d8/d8cefa9f4f12fd0cc6fd7847cff8f478303f0f0e.patch.jsonl.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:df743c93605c8443b1b32117fff832845cb4dfba9bcd53947b04f0d3fc8ce444 +size 899 diff --git a/patches/dd/ddf1a6a5f36fcc8fd8e6a0497ee7f7ff7a5b98fa.patch.jsonl.gz b/patches/dd/ddf1a6a5f36fcc8fd8e6a0497ee7f7ff7a5b98fa.patch.jsonl.gz new file mode 100644 index 0000000000000000000000000000000000000000..efe4c98b42ea8feaeeeaa9240eeeaeefee6e685a --- /dev/null +++ b/patches/dd/ddf1a6a5f36fcc8fd8e6a0497ee7f7ff7a5b98fa.patch.jsonl.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3a2556f325e88e7c0668893d94b89c0f921b9caa77419b0bc9ac10ba95a69f83 +size 8116 diff --git a/patches/e0/e01db198c7324faeaba0e0d274ba7df7274d6b64.patch.jsonl.gz b/patches/e0/e01db198c7324faeaba0e0d274ba7df7274d6b64.patch.jsonl.gz new file mode 100644 index 0000000000000000000000000000000000000000..d82afbb1c573b4428819890eb86cb14df9379e1f --- /dev/null +++ b/patches/e0/e01db198c7324faeaba0e0d274ba7df7274d6b64.patch.jsonl.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:560f50459b236bd44fc1cec4eafb29b05f68bc8a9b60ce8243fb75e828e1fb41 +size 912 diff --git a/patches/e1/e1fc14135cc3527cfb5afeccd4934bad8386c7b1.patch.jsonl.gz b/patches/e1/e1fc14135cc3527cfb5afeccd4934bad8386c7b1.patch.jsonl.gz new file mode 100644 index 0000000000000000000000000000000000000000..918d76cc7d522d981b82bf2cdf7755052c9b9dda --- /dev/null +++ b/patches/e1/e1fc14135cc3527cfb5afeccd4934bad8386c7b1.patch.jsonl.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:09ac8d418d1d3ef81d9730a4a72f2129b2b30d697b5b270c350f3565b2d0ece7 +size 52140 diff --git a/patches/e3/e3c46b7de71d619b84beb2dba36b6f62a570d45f.patch.jsonl.gz b/patches/e3/e3c46b7de71d619b84beb2dba36b6f62a570d45f.patch.jsonl.gz new file mode 100644 index 0000000000000000000000000000000000000000..19b5ce562a70354b8c5ba96d9c36bbf1a7818bc4 --- /dev/null +++ b/patches/e3/e3c46b7de71d619b84beb2dba36b6f62a570d45f.patch.jsonl.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:80d882e5e4e99a0ea8e64b292226fb878fc90172927a3b311adb0c080e5a320f +size 6116 diff --git a/patches/e9/e9a8187dfdc74a5b555140afd5b7ec05491f06ed.patch.jsonl.gz b/patches/e9/e9a8187dfdc74a5b555140afd5b7ec05491f06ed.patch.jsonl.gz new file mode 100644 index 0000000000000000000000000000000000000000..686433d3eed65d73071ea8eaacbaf17606e45066 --- /dev/null +++ b/patches/e9/e9a8187dfdc74a5b555140afd5b7ec05491f06ed.patch.jsonl.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:61bc7b6909214db3d70968969d1b0e00842002f5bf4d16a1f9987193f69d4f6b +size 1889 diff --git a/patches/eb/ebfaba872ad77bdfc50755ce830a6a8de5a231ce.patch.jsonl.gz b/patches/eb/ebfaba872ad77bdfc50755ce830a6a8de5a231ce.patch.jsonl.gz new file mode 100644 index 0000000000000000000000000000000000000000..aea0df3ed4dbdc4c115cacc5b1d8d89969498d8b --- /dev/null +++ b/patches/eb/ebfaba872ad77bdfc50755ce830a6a8de5a231ce.patch.jsonl.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:67967dff8b19312fc9cf841659a774948079c496461c9b4ec2a017438efec6b1 +size 899 diff --git a/patches/f5/f5db00352b90e99e78b631fa8b9cde5800093a9d.patch.jsonl.gz b/patches/f5/f5db00352b90e99e78b631fa8b9cde5800093a9d.patch.jsonl.gz new file mode 100644 index 0000000000000000000000000000000000000000..fbc63f35f8e3550dbe7cf4d7d975f13096daea3a --- /dev/null +++ b/patches/f5/f5db00352b90e99e78b631fa8b9cde5800093a9d.patch.jsonl.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:af9d9cb16646ef173b2371776ab7f23273ba144f9421f8673a137d716feb911c +size 1336 diff --git a/raw/02/0269edf45b34dc7b9a8ab24596aa1d1ec9f6b475.txt b/raw/02/0269edf45b34dc7b9a8ab24596aa1d1ec9f6b475.txt new file mode 100644 index 0000000000000000000000000000000000000000..0bd8c80425026954f2dcd23b5d69e23090f907a4 --- /dev/null +++ b/raw/02/0269edf45b34dc7b9a8ab24596aa1d1ec9f6b475.txt @@ -0,0 +1,202 @@ +ROUTE: juspay/hyperswitch@0269edf45b34dc7b9a8ab24596aa1d1ec9f6b475 +REPO: https://github.com/juspay/hyperswitch +COMMIT: 0269edf45b34dc7b9a8ab24596aa1d1ec9f6b475 +AUTHOR: Kashif +DATE: 2025-08-21T13:59:55 + +=== ISSUE_AND_PR === +[PR #9002] refactor(connector): [AdyenPlatform] update incoming webhooks for payouts +URL: https://github.com/juspay/hyperswitch/pull/9002 +BODY: +## Type of Change + + +- [ ] Bugfix +- [ ] New feature +- [ ] Enhancement +- [x] Refactoring +- [ ] Dependency updates +- [ ] Documentation +- [ ] CI/CD + +## Description +This PR updates the webhooks for Adyen's BalancePlatform for payouts. + +Main changes - +For status `booked` from Adyen, map it to +`success` for cards +`processing` for banks - reason being status `credited` is received from Adyen for successful credits. + +Check the relevant issue for more details. + +### Additional Changes + +- [ ] This PR modifies the API contract +- [ ] This PR modifies the database schema +- [ ] This PR modifies application configuration/environment variables + + + + +## Motivation and Context +Enhances payout webhooks for Adyen's BalancePlatform. + +## How did you test it? +
+ 1. Create a successful card payout + +cURL + + curl --location --request POST 'http://localhost:8080/payouts/create' \ + --header 'Content-Type: application/json' \ + --header 'api-key: dev_3ItwbKI2nwx45BPimAEaYP7QwnwKuC5a5GsG0aaow5wWefb62tXAcldZUrntn0jd' \ + --data '{"amount":100,"currency":"EUR","profile_id":"pro_S5yvh1TfnZi2Gjv7uSUQ","customer_id":"cus_2bXx7dm7bRTOLOMlBAQi","connector":["adyenplatform"],"description":"Its my first payout request","payout_type":"card","payout_method_data":{"card":{"card_number":"4111111111111111","expiry_month":"03","expiry_year":"2030","card_holder_name":"John Doe"}},"billing":{"address":{"line1":"1467","line2":"Harrison Street","city":"San Fransico","country":"FR","first_name":"John","last_name":"Doe"}},"recurring":true,"metadata":{"ref":"123"},"confirm":true,"auto_fulfill":true}' + +Response + + {"payout_id":"payout_5nv2qm3avmPmQTbvFBZg","merchant_id":"merchant_1755690193","merchant_order_reference_id":null,"amount":100,"currency":"EUR","connector":"adyenplatform","payout_type":"card","payout_method_data":{"card":{"card_issuer":null,"card_network":null,"card_type":null,"card_issuing_country":null,"bank_code":null,"last4":"1111","card_isin":"411111","card_extended_bin":null,"card_exp_month":"03","card_exp_year":"2030","card_holder_name":"John Doe"}},"billing":{"address":{"city":"San Fransico","country":"FR","line1":"1467","line2":"Harrison Street","line3":null,"zip":null,"state":null,"first_name":"John","last_name":"Doe","origin_zip":null},"phone":null,"email":null},"auto_fulfill":true,"customer_id":"cus_2bXx7dm7bRTOLOMlBAQi","customer":{"id":"cus_2bXx7dm7bRTOLOMlBAQi","name":"John Nether","email":null,"phone":"6168205362","phone_country_code":"+1"},"client_secret":"payout_payout_5nv2qm3avmPmQTbvFBZg_secret_j2B52JTji1yRrEOtd6FI","return_url":null,"business_country":null,"business_label":null,"description":"Its my first payout request","entity_type":"Individual","recurring":true,"metadata":{"ref":"123"},"merchant_connector_id":"mca_NsHlFe2GsWvK9CdftrLt","status":"initiated","error_message":null,"error_code":null,"profile_id":"pro_S5yvh1TfnZi2Gjv7uSUQ","created":"2025-08-20T11:49:11.757Z","connector_transaction_id":"38EBIY681J48U2JS","priority":null,"payout_link":null,"email":null,"name":"John Nether","phone":"6168205362","phone_country_code":"+1","unified_code":null,"unified_message":null,"payout_method_id":"pm_ywYBGKd0jKSUhIFyNho9"} + +Wait for incoming webhook + +Check for outgoing webhooks + +Initiated + +Screenshot 2025-08-20 at 5 21 04 PM + +Successful + +Screenshot 2025-08-20 at 5 21 12 PM + +
+ +
+ 2. Create a successful SEPA payout + +cURL + + curl --location --request POST 'http://localhost:8080/payouts/create' \ + --header 'Accept-Language: fr' \ + --header 'Content-Type: application/json' \ + --header 'api-key: dev_3ItwbKI2nwx45BPimAEaYP7QwnwKuC5a5GsG0aaow5wWefb62tXAcldZUrntn0jd' \ + --data '{"amount":1,"currency":"EUR","customer_id":"cus_2bXx7dm7bRTOLOMlBAQi","description":"Its my first payout request","payout_type":"bank","priority":"regular","payout_method_data":{"bank":{"iban":"NL57INGB4654188101"}},"connector":["adyenplatform"],"billing":{"address":{"line1":"Raadhuisplein","line2":"92","city":"Hoogeveen","country":"NL","first_name":"John"}},"entity_type":"Individual","recurring":true,"metadata":{"ref":"123"},"confirm":true,"auto_fulfill":true,"profile_id":"pro_S5yvh1TfnZi2Gjv7uSUQ"}' + +Response + + {"payout_id":"payout_FywtoqrSxKtwDDsbCvGa","merchant_id":"merchant_1755690193","merchant_order_reference_id":null,"amount":1,"currency":"EUR","connector":"adyenplatform","payout_type":"bank","payout_method_data":{"bank":{"iban":"NL57I********88101","bank_name":null,"bank_country_code":null,"bank_city":null,"bic":null}},"billing":{"address":{"city":"Hoogeveen","country":"NL","line1":"Raadhuisplein","line2":"92","line3":null,"zip":null,"state":null,"first_name":"John","last_name":null,"origin_zip":null},"phone":null,"email":null},"auto_fulfill":true,"customer_id":"cus_2bXx7dm7bRTOLOMlBAQi","customer":{"id":"cus_2bXx7dm7bRTOLOMlBAQi","name":"John Nether","email":null,"phone":"6168205362","phone_country_code":"+1"},"client_secret":"payout_payout_FywtoqrSxKtwDDsbCvGa_secret_fC2TqhM2tucPGuzvQcDr","return_url":null,"business_country":null,"business_label":null,"description":"Its my first payout request","entity_type":"Individual","recurring":true,"metadata":{"ref":"123"},"merchant_connector_id":"mca_NsHlFe2GsWvK9CdftrLt","status":"initiated","error_message":null,"error_code":null,"profile_id":"pro_S5yvh1TfnZi2Gjv7uSUQ","created":"2025-08-20T11:51:48.487Z","connector_transaction_id":"38EBH1681J56C4WZ","priority":"regular","payout_link":null,"email":null,"name":"John Nether","phone":"6168205362","phone_country_code":"+1","unified_code":null,"unified_message":null,"payout_method_id":"pm_Vc6t4FK6HmbM2TUXsaBs"} + +Wait for incoming webhook + +Check for outgoing webhooks + +Initiated + +Screenshot 2025-08-20 at 5 22 39 PM + +Successful + +Screenshot 2025-08-20 at 5 22 46 PM + +
+ +## Checklist + + +- [x] I formatted the code `cargo +nightly fmt --all` +- [x] I addressed lints thrown by `cargo clippy` +- [x] I reviewed the submitted code +- [ ] I added unit tests for my changes where possible +COMMENTS: +- semanticdiff-com[bot]: Review changes with  SemanticDiff +
+Changed Files +
+ +| File | Status | +| :--- | :--- | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9002/changes#crates/hyperswitch_connectors/src/connectors/adyenplatform/transformers/payouts.rs)  [crates/hyperswitch\_connectors/src/connectors/adyenplatform/transformers/payouts\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9002/changes#crates/hyperswitch_connectors/src/connectors/adyenplatform/transformers/payouts.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9002/changes#crates/hyperswitch_connectors/src/connectors/adyenplatform/transformers/payouts.rs)  18% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9002/changes#crates/hyperswitch_connectors/src/connectors/adyenplatform.rs)  [crates/hyperswitch\_connectors/src/connectors/adyenplatform\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9002/changes#crates/hyperswitch_connectors/src/connectors/adyenplatform.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9002/changes#crates/hyperswitch_connectors/src/connectors/adyenplatform.rs)  0% smaller | + +
+ +=== COMMIT === +SUBJECT: refactor(connector): [AdyenPlatform] update incoming webhooks for payouts (#9002) +BODY: +Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> + +=== FILES === +Summary: 2 files changed, +22 -3 +- crates/hyperswitch_connectors/src/connectors/adyenplatform.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/adyenplatform/transformers/payouts.rs (+21 -3) + +=== PATCH === +diff --git a/crates/hyperswitch_connectors/src/connectors/adyenplatform.rs b/crates/hyperswitch_connectors/src/connectors/adyenplatform.rs +index 78c8c4c8..2158fece 100644 +--- a/crates/hyperswitch_connectors/src/connectors/adyenplatform.rs ++++ b/crates/hyperswitch_connectors/src/connectors/adyenplatform.rs +@@ -402,6 +402,7 @@ impl IncomingWebhook for Adyenplatform { + webhook_body.webhook_type, + webhook_body.data.status, + webhook_body.data.tracking, ++ webhook_body.data.category.as_ref(), + )) + } + #[cfg(not(feature = "payouts"))] +diff --git a/crates/hyperswitch_connectors/src/connectors/adyenplatform/transformers/payouts.rs b/crates/hyperswitch_connectors/src/connectors/adyenplatform/transformers/payouts.rs +index 6c964aea..b04ca410 100644 +--- a/crates/hyperswitch_connectors/src/connectors/adyenplatform/transformers/payouts.rs ++++ b/crates/hyperswitch_connectors/src/connectors/adyenplatform/transformers/payouts.rs +@@ -513,6 +513,7 @@ pub struct AdyenplatformIncomingWebhookData { + pub status: AdyenplatformWebhookStatus, + pub reference: String, + pub tracking: Option, ++ pub category: Option, + } + + #[derive(Debug, Serialize, Deserialize)] +@@ -551,6 +552,7 @@ pub fn get_adyen_webhook_event( + event_type: AdyenplatformWebhookEventType, + status: AdyenplatformWebhookStatus, + instant_status: Option, ++ category: Option<&AdyenPayoutMethod>, + ) -> webhooks::IncomingWebhookEvent { + match (event_type, status, instant_status) { + (AdyenplatformWebhookEventType::PayoutCreated, _, _) => { +@@ -565,9 +567,25 @@ pub fn get_adyen_webhook_event( + } + } + (AdyenplatformWebhookEventType::PayoutUpdated, status, _) => match status { +- AdyenplatformWebhookStatus::Authorised +- | AdyenplatformWebhookStatus::Booked +- | AdyenplatformWebhookStatus::Received => webhooks::IncomingWebhookEvent::PayoutCreated, ++ AdyenplatformWebhookStatus::Authorised | AdyenplatformWebhookStatus::Received => { ++ webhooks::IncomingWebhookEvent::PayoutCreated ++ } ++ AdyenplatformWebhookStatus::Booked => { ++ match category { ++ Some(AdyenPayoutMethod::Card) => { ++ // For card payouts, "booked" is the final success state ++ webhooks::IncomingWebhookEvent::PayoutSuccess ++ } ++ Some(AdyenPayoutMethod::Bank) => { ++ // For bank payouts, "booked" is intermediate - wait for final confirmation ++ webhooks::IncomingWebhookEvent::PayoutProcessing ++ } ++ None => { ++ // Default to processing if category is unknown ++ webhooks::IncomingWebhookEvent::PayoutProcessing ++ } ++ } ++ } + AdyenplatformWebhookStatus::Pending => webhooks::IncomingWebhookEvent::PayoutProcessing, + AdyenplatformWebhookStatus::Failed => webhooks::IncomingWebhookEvent::PayoutFailure, + AdyenplatformWebhookStatus::Returned => webhooks::IncomingWebhookEvent::PayoutReversed, + +----- END CHUNK ----- \ No newline at end of file diff --git a/raw/04/049e6b572d88d141fccf09e12854988daf146e67.txt b/raw/04/049e6b572d88d141fccf09e12854988daf146e67.txt new file mode 100644 index 0000000000000000000000000000000000000000..11ce9bf71c8ab1b4d48b33d9d0db1c2060225e6f --- /dev/null +++ b/raw/04/049e6b572d88d141fccf09e12854988daf146e67.txt @@ -0,0 +1,2584 @@ +ROUTE: juspay/hyperswitch@049e6b572d88d141fccf09e12854988daf146e67 +REPO: https://github.com/juspay/hyperswitch +COMMIT: 049e6b572d88d141fccf09e12854988daf146e67 +AUTHOR: Nithin N <57832822+Nithin1506200@users.noreply.github.com> +DATE: 2025-08-22T11:45:19 + +=== ISSUE_AND_PR === +[PR #8985] feat(nuvei): Googlepay , applepay and partial authorization integration for nuvei +URL: https://github.com/juspay/hyperswitch/pull/8985 +BODY: +## Type of Change + + +- [x] Bugfix +- [x] New feature +- [ ] Enhancement +- [ ] Refactoring +- [ ] Dependency updates +- [ ] Documentation +- [ ] CI/CD + +## Description + +Add the following features in nuvie +1. Google pay decrypt flow S2S +2. Apple pay decrypt flow S2S +3. Google pay encrypt flow +4. Partial Authorization +5. Send shipping address for nuvei (previously not sent) + +## Test attachment + + + + + +
+ APPLE PAY DECRYPT FLOW + +# Request + +```json +{ + "amount": 1, + "currency": "EUR", + "confirm": true, + // "order_tax_amount": 100, + "setup_future_usage": "off_session", + // "payment_type":"setup_mandate", + "customer_id": "nithxxinn", + "return_url": "https://www.google.com", + "capture_method": "automatic", + "payment_method": "wallet", + "payment_method_type": "apple_pay", + "authentication_type": "no_three_ds", + "description": "hellow world", + "billing": { + "address": { + "zip": "560095", + "country": "US", + "first_name": "Sakil", + "last_name": "Mostak", + "line1": "Fasdf", + "line2": "Fasdf", + "city": "Fasdf" + }, + "email":"nithingowdan77@gmail.com" + }, + "browser_info": { + "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", + "ip_address": "192.168.1.1", + "java_enabled": false, + "java_script_enabled": true, + "language": "en-US", + "color_depth": 24, + "screen_height": 1080, + "screen_width": 1920, + "time_zone": 330, + "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36" + }, + "email": "hello@gmail.com", + "payment_method_data": { + "wallet": { + "apple_pay": { + "payment_data": { + "application_primary_account_number": "4242424242424242", + "application_expiration_month": "09", + "application_expiration_year": "30", + "application_brand":"VISA", + "payment_data": { + "online_payment_cryptogram": "ArSx8**************************", + "eci_indicator": "7" + } + }, + "payment_method": { + "display_name": "Discover 9319", + "network": "VISA", + "type": "debit" + }, + "transaction_identifier": "c635c5b3af900d7bd81fecd7028f1262f9d030754ee65ec7afd988a678194751" + } + } + } +} + +``` + +# Response + +```json +{ + "payment_id": "pay_MgXkheRylOHLMUllc1Mw", + "merchant_id": "merchant_1755589543", + "status": "succeeded", + "amount": 1, + "net_amount": 1, + "shipping_cost": null, + "amount_capturable": 0, + "amount_received": 1, + "connector": "nuvei", + "client_secret": "pay_MgXkheRylOHLMUllc1Mw_secret_swUebKaDNEsP4Qo5BMxe", + "created": "2025-08-19T08:05:14.847Z", + "currency": "EUR", + "customer_id": "nithxxinn", + "customer": { + "id": "nithxxinn", + "name": null, + "email": "hello@gmail.com", + "phone": null, + "phone_country_code": null + }, + "description": "hellow world", + "refunds": null, + "disputes": null, + "mandate_id": null, + "mandate_data": null, + "setup_future_usage": "on_session", + "off_session": null, + "capture_on": null, + "capture_method": "automatic", + "payment_method": "wallet", + "payment_method_data": { + "wallet": { + "apple_pay": { + "last4": "9319", + "card_network": "VISA", + "type": "debit" + } + }, + "billing": null + }, + "payment_token": null, + "shipping": null, + "billing": { + "address": { + "city": "Fasdf", + "country": "US", + "line1": "Fasdf", + "line2": "Fasdf", + "line3": null, + "zip": "560095", + "state": null, + "first_name": "Sakil", + "last_name": "Mostak", + "origin_zip": null + }, + "phone": null, + "email": "nithin*****@gmail.com" + }, + "order_details": null, + "email": "hello@gmail.com", + "name": null, + "phone": null, + "return_url": "https://www.google.com/", + "authentication_type": "no_three_ds", + "statement_descriptor_name": null, + "statement_descriptor_suffix": null, + "next_action": null, + "cancellation_reason": null, + "error_code": null, + "error_message": null, + "unified_code": null, + "unified_message": null, + "payment_experience": null, + "payment_method_type": "apple_pay", + "connector_label": null, + "business_country": null, + "business_label": "default", + "business_sub_label": null, + "allowed_payment_method_types": null, + "ephemeral_key": { + "customer_id": "nithxxinn", + "created_at": 1755590714, + "expires": 1755594314, + "secret": "epk_ad5c941cff3a4404ab38dee084e575d0" + }, + "manual_retry_allowed": false, + "connector_transaction_id": "8110000000012650848", + "frm_message": null, + "metadata": null, + "connector_metadata": null, + "feature_metadata": { + "redirect_response": null, + "search_tags": null, + "apple_pay_recurring_details": null, + "gateway_system": "direct" + }, + "reference_id": "8027431111", + "payment_link": null, + "profile_id": "pro_o6xLMNfkFwAWH1U1zimF", + "surcharge_details": null, + "attempt_count": 1, + "merchant_decision": null, + "merchant_connector_id": "mca_8DFDwR4GryN3qQQOh8bq", + "incremental_authorization_allowed": false, + "authorization_count": null, + "incremental_authorizations": null, + "external_authentication_details": null, + "external_3ds_authentication_attempted": false, + "expires_on": "2025-08-19T08:20:14.847Z", + "fingerprint": null, + "browser_info": { + "language": "en-US", + "time_zone": 330, + "ip_address": "192.168.1.1", + "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36", + "color_depth": 24, + "java_enabled": false, + "screen_width": 1920, + "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", + "screen_height": 1080, + "java_script_enabled": true + }, + "payment_channel": null, + "payment_method_id": null, + "network_transaction_id": null, + "payment_method_status": null, + "updated": "2025-08-19T08:05:17.249Z", + "split_payments": null, + "frm_metadata": null, + "extended_authorization_applied": null, + "capture_before": null, + "merchant_order_reference_id": null, + "order_tax_amount": null, + "connector_mandate_id": null, + "card_discovery": null, + "force_3ds_challenge": false, + "force_3ds_challenge_trigger": false, + "issuer_error_code": null, + "issuer_error_message": null, + "is_iframe_redirection_enabled": null, + "whole_connector_response": null, + "enable_partial_authorization": null +} +``` + +
+ + + +
+ + + Google pay Decrypt + + +## Request + +```json +{ + "amount": 1, + "currency": "EUR", + "confirm": true, + "customer_id": "nithxxinn", + "return_url": "https://www.google.com", + "capture_method": "automatic", + "payment_method": "wallet", + "payment_method_type": "google_pay", + "authentication_type": "no_three_ds", + "description": "hellow world", + "billing": { + "address": { + "zip": "560095", + "country": "UA", + "first_name": "Sakil", + "last_name": "Mostak", + "line1": "Fasdf", + "line2": "Fasdf", + "city": "Fasdf" + }, + "email":"test@gmail.com" + }, + "browser_info": { + "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", + "ip_address": "192.168.1.1", + "java_enabled": false, + "java_script_enabled": true, + "language": "en-US", + "color_depth": 24, + "screen_height": 1080, + "screen_width": 1920, + "time_zone": 330, + "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36" + }, + "email": "hello@gmail.com", + "payment_method_data": { + "wallet": { + "google_pay": { + "type": "CARD", + "tokenization_data": { + "application_primary_account_number": "4761344136141390", + "card_exp_month": "12", + "card_exp_year": "25", + "cryptogram": "ejJR********************U=", + "eci_indicator": "5" + }, + "info": { + "card_details": "Discover 9319", + "card_network": "VISA" + }, + "description": "something" + } + } + } +} +``` +Response + +```json +{ + "payment_id": "pay_0i5TBkizYCY8JIwAPB1H", + "merchant_id": "merchant_1755589543", + "status": "succeeded", + "amount": 1, + "net_amount": 1, + "shipping_cost": null, + "amount_capturable": 0, + "amount_received": 1, + "connector": "nuvei", + "client_secret": "pay_0i5TBkizYCY8JIwAPB1H_secret_7O5zdgMiNJxFdZolSjIJ", + "created": "2025-08-19T08:07:18.648Z", + "currency": "EUR", + "customer_id": "nithxxinn", + "customer": { + "id": "nithxxinn", + "name": null, + "email": "hello@gmail.com", + "phone": null, + "phone_country_code": null + }, + "description": "hellow world", + "refunds": null, + "disputes": null, + "mandate_id": null, + "mandate_data": null, + "setup_future_usage": null, + "off_session": null, + "capture_on": null, + "capture_method": "automatic", + "payment_method": "wallet", + "payment_method_data": { + "wallet": { + "google_pay": { + "last4": "Discover 9319", + "card_network": "VISA", + "type": "CARD" + } + }, + "billing": null + }, + "payment_token": null, + "shipping": null, + "billing": { + "address": { + "city": "Fasdf", + "country": "UA", + "line1": "Fasdf", + "line2": "Fasdf", + "line3": null, + "zip": "560095", + "state": null, + "first_name": "Sakil", + "last_name": "Mostak", + "origin_zip": null + }, + "phone": null, + "email": "test@gmail.com" + }, + "order_details": null, + "email": "hello@gmail.com", + "name": null, + "phone": null, + "return_url": "https://www.google.com/", + "authentication_type": "no_three_ds", + "statement_descriptor_name": null, + "statement_descriptor_suffix": null, + "next_action": null, + "cancellation_reason": null, + "error_code": null, + "error_message": null, + "unified_code": null, + "unified_message": null, + "payment_experience": null, + "payment_method_type": "google_pay", + "connector_label": null, + "business_country": null, + "business_label": "default", + "business_sub_label": null, + "allowed_payment_method_types": null, + "ephemeral_key": { + "customer_id": "nithxxinn", + "created_at": 1755590838, + "expires": 1755594438, + "secret": "epk_8d9994d7f5594c2a8fb10ebf6c3fdc27" + }, + "manual_retry_allowed": false, + "connector_transaction_id": "8110000000012650994", + "frm_message": null, + "metadata": null, + "connector_metadata": null, + "feature_metadata": { + "redirect_response": null, + "search_tags": null, + "apple_pay_recurring_details": null, + "gateway_system": "direct" + }, + "reference_id": "8027476111", + "payment_link": null, + "profile_id": "pro_o6xLMNfkFwAWH1U1zimF", + "surcharge_details": null, + "attempt_count": 1, + "merchant_decision": null, + "merchant_connector_id": "mca_8DFDwR4GryN3qQQOh8bq", + "incremental_authorization_allowed": false, + "authorization_count": null, + "incremental_authorizations": null, + "external_authentication_details": null, + "external_3ds_authentication_attempted": false, + "expires_on": "2025-08-19T08:22:18.648Z", + "fingerprint": null, + "browser_info": { + "language": "en-US", + "time_zone": 330, + "ip_address": "192.168.1.1", + "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36", + "color_depth": 24, + "java_enabled": false, + "screen_width": 1920, + "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", + "screen_height": 1080, + "java_script_enabled": true + }, + "payment_channel": null, + "payment_method_id": null, + "network_transaction_id": null, + "payment_method_status": null, + "updated": "2025-08-19T08:07:21.259Z", + "split_payments": null, + "frm_metadata": null, + "extended_authorization_applied": null, + "capture_before": null, + "merchant_order_reference_id": null, + "order_tax_amount": null, + "connector_mandate_id": null, + "card_discovery": null, + "force_3ds_challenge": false, + "force_3ds_challenge_trigger": false, + "issuer_error_code": null, + "issuer_error_message": null, + "is_iframe_redirection_enabled": null, + "whole_connector_response": null, + "enable_partial_authorization": null +} +``` + +
+ +
+ GOOGLE PAY DIRECT + +```js +const tokenizationSpecification = { + type: "PAYMENT_GATEWAY", + parameters: { + "gateway": "nuveidigital", + "gatewayMerchantId": "googletest" + } +}; +``` +## Request + +```json +{ + "amount": 1, + "currency": "EUR", + "confirm": true, + "customer_id": "nithxxinn", + "return_url": "https://www.google.com", + "capture_method": "automatic", + "payment_method": "wallet", + "payment_method_type": "google_pay", + "authentication_type": "no_three_ds", + "description": "hellow world", + "billing": { + "address": { + "zip": "560095", + "country": "UA", + "first_name": "Sakil", + "last_name": "Mostak", + "line1": "Fasdf", + "line2": "Fasdf", + "city": "Fasdf" + }, + "email":"nithin@test.com" + }, + "browser_info": { + "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", + "ip_address": "192.168.1.1", + "java_enabled": false, + "java_script_enabled": true, + "language": "en-US", + "color_depth": 24, + "screen_height": 1080, + "screen_width": 1920, + "time_zone": 330, + "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36" + }, + "email": "hello@gmail.com", + "payment_method_data": { + "wallet": { + "google_pay": { + "description": "SG Visa Success: Visa •••• 1390", + "info": { + "assuranceDetails": { + "account_verified": true, + "card_holder_authenticated": false + }, + "card_details": "1390", + "card_network": "VISA" + }, + "tokenization_data": { + "token": "{\"signature\":\"MEUCIG7saL2k07Szf8ezokemD5jAJTwpcWwpy+ajTJot7u+nAiEAzvcuwAoj47r8oMh3a6eUKeZB2lFyDLEzZt2R2lpezo0\\u003d\",\"intermediateSigningKey\":{\"signedKey\":\"{\\\"keyValue\\\":\\\"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE9ByUUgcs6d9rtJA3svCKaGZQjfsbMQAAwWZ6YNIpJkg/NR9HAkMT1sdhkKMRxtcFp1k5y01dr/JpEU2Pj3XyYw\\\\u003d\\\\u003d\\\",\\\"keyExpiration\\\":\\\"1756245691797\\\"}\",\"signatures\":[\"MEQCIFAS8NBh7J4rz00iRDjScYizAfRV+pVnCfsmsFgrehMVAiBpxHFUu6wG3UVNhDMmudb6sZeZHXDJonLkkKOWgzN4TA\\u003d\\u003d\"]},\"protocolVersion\":\"ECv2\",\"signedMessage\":\"{\\\"encryptedMessage\\\":\\\"hJxayhOT/y4ekX9Ub14X6nl7Xm0h3b1nu8FKv7WDulloondBA+kk9sYnNomQx+ZPANrGES4CBGbmptqW5gR6TjdvENXbSUrTjzU8k++Klw/AwAJBcID+dL+EgyIvgmqIYesLyKzITkZr9zSxtd0zuB9ewcta8gHgBzlZmJSWmdvanv4xiBQgjriKolnw4IiOXXAzN+X0GGXkPqcQnlLIrUzjn/9oCgwhFDltl1EJjkUH8Ji2Rzx62FUexxY6RHHrkoq3pCoirc+KNRXPu3+gC06iloRTR48gmmayFKH5s3Kyw0j9Oypu7fx/AgSqrFKkFzVUmCV0yLwGQSI2vyVdKOFLgLay8dDbEHKvF5X+ZP7diunVh0QwZUTT7yRmgyQUaZAbQhd+uRHrev6SYXcmWdSu8E+8H6A7jtITaZN2eHI7u9ciW82/AcIx3gPkTocKGyXdYRB07+GaFIqyWwxT+9TwLW49oq7hbj978APK1vy4f8x6v2h1tCj6StH6md7xJpn+U47n8rKmJhQiXqRyzfKFcCekndvs0YpgEVbcoZEKKl0E\\\",\\\"ephemeralPublicKey\\\":\\\"BKvkUFUZmpa0BgifTbr2ZTNBK7D74Fg8RMsk2Txta+Vf+vX1/BZLUaITfjpgJ5Xqt3rz+AmrkFe+XRvT5E4R7nc\\\\u003d\\\",\\\"tag\\\":\\\"cGNVu61W/PvTC89JXVMUcsKaZIOpt92oexc+aztsKqw\\\\u003d\\\"}\"}", + "type": "PAYMENT_GATEWAY" + }, + "type": "CARD" +} + }} +} + +``` + +## response + +```json +{ + "payment_id": "pay_UGldGh1QW8CTJJJ22CMJ", + "merchant_id": "merchant_1755589543", + "status": "succeeded", + "amount": 1, + "net_amount": 1, + "shipping_cost": null, + "amount_capturable": 0, + "amount_received": 1, + "connector": "nuvei", + "client_secret": "pay_UGldGh1QW8CTJJJ22CMJ_secret_nKqyqNJ02RgcaMsBBz51", + "created": "2025-08-19T09:08:25.037Z", + "currency": "EUR", + "customer_id": "nithxxinn", + "customer": { + "id": "nithxxinn", + "name": null, + "email": "hello@gmail.com", + "phone": null, + "phone_country_code": null + }, + "description": "hellow world", + "refunds": null, + "disputes": null, + "mandate_id": null, + "mandate_data": null, + "setup_future_usage": null, + "off_session": null, + "capture_on": null, + "capture_method": "automatic", + "payment_method": "wallet", + "payment_method_data": { + "wallet": { + "google_pay": { + "last4": "1390", + "card_network": "VISA", + "type": "CARD" + } + }, + "billing": null + }, + "payment_token": null, + "shipping": null, + "billing": { + "address": { + "city": "Fasdf", + "country": "UA", + "line1": "Fasdf", + "line2": "Fasdf", + "line3": null, + "zip": "560095", + "state": null, + "first_name": "Sakil", + "last_name": "Mostak", + "origin_zip": null + }, + "phone": null, + "email": "nithin@test.com" + }, + "order_details": null, + "email": "hello@gmail.com", + "name": null, + "phone": null, + "return_url": "https://www.google.com/", + "authentication_type": "no_three_ds", + "statement_descriptor_name": null, + "statement_descriptor_suffix": null, + "next_action": null, + "cancellation_reason": null, + "error_code": null, + "error_message": null, + "unified_code": null, + "unified_message": null, + "payment_experience": null, + "payment_method_type": "google_pay", + "connector_label": null, + "business_country": null, + "business_label": "default", + "business_sub_label": null, + "allowed_payment_method_types": null, + "ephemeral_key": { + "customer_id": "nithxxinn", + "created_at": 1755594505, + "expires": 1755598105, + "secret": "epk_d3dbd5a8b4c04958b6fb4c959cbc67a1" + }, + "manual_retry_allowed": false, + "connector_transaction_id": "8110000000012655452", + "frm_message": null, + "metadata": null, + "connector_metadata": null, + "feature_metadata": { + "redirect_response": null, + "search_tags": null, + "apple_pay_recurring_details": null, + "gateway_system": "direct" + }, + "reference_id": "8029357111", + "payment_link": null, + "profile_id": "pro_o6xLMNfkFwAWH1U1zimF", + "surcharge_details": null, + "attempt_count": 1, + "merchant_decision": null, + "merchant_connector_id": "mca_8DFDwR4GryN3qQQOh8bq", + "incremental_authorization_allowed": false, + "authorization_count": null, + "incremental_authorizations": null, + "external_authentication_details": null, + "external_3ds_authentication_attempted": false, + "expires_on": "2025-08-19T09:23:25.037Z", + "fingerprint": null, + "browser_info": { + "language": "en-US", + "time_zone": 330, + "ip_address": "192.168.1.1", + "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36", + "color_depth": 24, + "java_enabled": false, + "screen_width": 1920, + "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", + "screen_height": 1080, + "java_script_enabled": true + }, + "payment_channel": null, + "payment_method_id": null, + "network_transaction_id": null, + "payment_method_status": null, + "updated": "2025-08-19T09:08:29.510Z", + "split_payments": null, + "frm_metadata": null, + "extended_authorization_applied": null, + "capture_before": null, + "merchant_order_reference_id": null, + "order_tax_amount": null, + "connector_mandate_id": null, + "card_discovery": null, + "force_3ds_challenge": false, + "force_3ds_challenge_trigger": false, + "issuer_error_code": null, + "issuer_error_message": null, + "is_iframe_redirection_enabled": null, + "whole_connector_response": null, + "enable_partial_authorization": null +} + +``` + +
+ + +
+ +Partial auth + +## Request + +```json +{ + "amount": 300, + "currency": "EUR", + "confirm": true, + "customer_id": "nithxxinn", + "return_url": "https://www.google.com", + "capture_method": "automatic", + "enable_partial_authorization":true, + "payment_method": "card", + "payment_method_type": "credit", + "authentication_type": "no_three_ds", + "description": "hellow world", + "billing": { + "address": { + "zip": "560095", + "country": "US", + "first_name": "Sakil", + "last_name": "Mostak", + "line1": "Fasdf", + "line2": "Fasdf", + "city": "Fasdf" + }, + "email":"nithin@gmail.com" + }, + "browser_info": { + "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", + "ip_address": "192.168.1.1", + "java_enabled": false, + "java_script_enabled": true, + "language": "en-US", + "color_depth": 24, + "screen_height": 1080, + "screen_width": 1920, + "time_zone": 330, + "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36" + }, + "email": "hello@gmail.com", + "payment_method_data": { + "card": { + "card_number": "4531739335817394", + "card_exp_month": "01", + "card_exp_year": "2026", + "card_holder_name": "John Smith", + "card_cvc": "100" + } + } +} +``` + + +## Response + +```json +{ + "payment_id": "pay_hieZ9MkK4v1qbqiXKEor", + "merchant_id": "merchant_1755589543", + "status": "partially_captured", + "amount": 300, + "net_amount": 300, + "shipping_cost": null, + "amount_capturable": 300, + "amount_received": 150, + "connector": "nuvei", + "client_secret": "pay_hieZ9MkK4v1qbqiXKEor_secret_KN9DE1LjGlbxEIDGpzFT", + "created": "2025-08-19T09:21:17.091Z", + "currency": "EUR", + "customer_id": "nithxxinn", + "customer": { + "id": "nithxxinn", + "name": null, + "email": "hello@gmail.com", + "phone": null, + "phone_country_code": null + }, + "description": "hellow world", + "refunds": null, + "disputes": null, + "mandate_id": null, + "mandate_data": null, + "setup_future_usage": null, + "off_session": null, + "capture_on": null, + "capture_method": "automatic", + "payment_method": "card", + "payment_method_data": { + "card": { + "last4": "7394", + "card_type": null, + "card_network": null, + "card_issuer": null, + "card_issuing_country": null, + "card_isin": "453173", + "card_extended_bin": null, + "card_exp_month": "01", + "card_exp_year": "2026", + "card_holder_name": "John Smith", + "payment_checks": { + "avs_description": null, + "avs_result_code": "", + "cvv_2_reply_code": "", + "cvv_2_description": null, + "merchant_advice_code": "", + "merchant_advice_code_description": null + }, + "authentication_data": { + "challengePreferenceReason": "12" + } + }, + "billing": null + }, + "payment_token": "token_7PrpuuSVcta1g2qFHYtC", + "shipping": null, + "billing": { + "address": { + "city": "Fasdf", + "country": "US", + "line1": "Fasdf", + "line2": "Fasdf", + "line3": null, + "zip": "560095", + "state": null, + "first_name": "Sakil", + "last_name": "Mostak", + "origin_zip": null + }, + "phone": null, + "email": "nithin@gmail.com" + }, + "order_details": null, + "email": "hello@gmail.com", + "name": null, + "phone": null, + "return_url": "https://www.google.com/", + "authentication_type": "no_three_ds", + "statement_descriptor_name": null, + "statement_descriptor_suffix": null, + "next_action": null, + "cancellation_reason": null, + "error_code": null, + "error_message": null, + "unified_code": null, + "unified_message": null, + "payment_experience": null, + "payment_method_type": "credit", + "connector_label": null, + "business_country": null, + "business_label": "default", + "business_sub_label": null, + "allowed_payment_method_types": null, + "ephemeral_key": { + "customer_id": "nithxxinn", + "created_at": 1755595277, + "expires": 1755598877, + "secret": "epk_8003507abbdb427788e1fa089e75c59c" + }, + "manual_retry_allowed": false, + "connector_transaction_id": "8110000000012656330", + "frm_message": null, + "metadata": null, + "connector_metadata": null, + "feature_metadata": { + "redirect_response": null, + "search_tags": null, + "apple_pay_recurring_details": null, + "gateway_system": "direct" + }, + "reference_id": "8029726111", + "payment_link": null, + "profile_id": "pro_o6xLMNfkFwAWH1U1zimF", + "surcharge_details": null, + "attempt_count": 1, + "merchant_decision": null, + "merchant_connector_id": "mca_8DFDwR4GryN3qQQOh8bq", + "incremental_authorization_allowed": false, + "authorization_count": null, + "incremental_authorizations": null, + "external_authentication_details": null, + "external_3ds_authentication_attempted": false, + "expires_on": "2025-08-19T09:36:17.091Z", + "fingerprint": null, + "browser_info": { + "language": "en-US", + "time_zone": 330, + "ip_address": "192.168.1.1", + "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36", + "color_depth": 24, + "java_enabled": false, + "screen_width": 1920, + "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", + "screen_height": 1080, + "java_script_enabled": true + }, + "payment_channel": null, + "payment_method_id": null, + "network_transaction_id": null, + "payment_method_status": null, + "updated": "2025-08-19T09:21:19.648Z", + "split_payments": null, + "frm_metadata": null, + "extended_authorization_applied": null, + "capture_before": null, + "merchant_order_reference_id": null, + "order_tax_amount": null, + "connector_mandate_id": null, + "card_discovery": "manual", + "force_3ds_challenge": false, + "force_3ds_challenge_trigger": false, + "issuer_error_code": null, + "issuer_error_message": null, + "is_iframe_redirection_enabled": null, + "whole_connector_response": null, + "enable_partial_authorization": true +} +``` + +## partial-auth manual payment response + +```json +{ + "payment_id": "pay_t82V58k4cohYq87gBvGL", + "merchant_id": "merchant_1755675958", + "status": "partially_authorized_and_requires_capture", + "amount": 300, + "net_amount": 300, + "shipping_cost": null, + "amount_capturable": 150, + "amount_received": null, + "connector": "nuvei", + "client_secret": "pay_t82V58k4cohYq87gBvGL_secret_CHN75ZbLuZWVBKYTITqg", + "created": "2025-08-21T08:37:13.180Z", + "currency": "EUR", + "customer_id": "nithxxinn", + "customer": { + "id": "nithxxinn", + "name": null, + "email": "hello@gmail.com", + "phone": null, + "phone_country_code": null + }, + "description": "hellow world", + "refunds": null, + "disputes": null, + "mandate_id": null, + "mandate_data": null, + "setup_future_usage": null, + "off_session": null, + "capture_on": null, + "capture_method": "manual", + "payment_method": "card", + "payment_method_data": { + "card": { + "last4": "7394", + "card_type": null, + "card_network": null, + "card_issuer": null, + "card_issuing_country": null, + "card_isin": "453173", + "card_extended_bin": null, + "card_exp_month": "01", + "card_exp_year": "2026", + "card_holder_name": "John Smith", + "payment_checks": { + "avs_description": null, + "avs_result_code": "", + "cvv_2_reply_code": "", + "cvv_2_description": null, + "merchant_advice_code": "", + "merchant_advice_code_description": null + }, + "authentication_data": { + "challengePreferenceReason": "12" + } + }, + "billing": null + }, + "payment_token": "token_yUVtqVsfxyKqmAM4fl1H", + "shipping": null, + "billing": { + "address": { + "city": "Fasdf", + "country": "US", + "line1": "Fasdf", + "line2": "Fasdf", + "line3": null, + "zip": "560095", + "state": null, + "first_name": "Sakil", + "last_name": "Mostak", + "origin_zip": null + }, + "phone": null, + "email": null + }, + "order_details": null, + "email": "hello@gmail.com", + "name": null, + "phone": null, + "return_url": "https://www.google.com/", + "authentication_type": "no_three_ds", + "statement_descriptor_name": null, + "statement_descriptor_suffix": null, + "next_action": null, + "cancellation_reason": null, + "error_code": null, + "error_message": null, + "unified_code": null, + "unified_message": null, + "payment_experience": null, + "payment_method_type": "credit", + "connector_label": null, + "business_country": null, + "business_label": "default", + "business_sub_label": null, + "allowed_payment_method_types": null, + "ephemeral_key": { + "customer_id": "nithxxinn", + "created_at": 1755765433, + "expires": 1755769033, + "secret": "epk_c7ea65af285e4db69a3bd6fbcb553bf4" + }, + "manual_retry_allowed": false, + "connector_transaction_id": "8110000000012833076", + "frm_message": null, + "metadata": null, + "connector_metadata": null, + "feature_metadata": { + "redirect_response": null, + "search_tags": null, + "apple_pay_recurring_details": null, + "gateway_system": "direct" + }, + "reference_id": "8101170111", + "payment_link": null, + "profile_id": "pro_8OqPL5PekR8mRXU8WZZs", + "surcharge_details": null, + "attempt_count": 1, + "merchant_decision": null, + "merchant_connector_id": "mca_48b4pLXImpTC9wJALk91", + "incremental_authorization_allowed": false, + "authorization_count": null, + "incremental_authorizations": null, + "external_authentication_details": null, + "external_3ds_authentication_attempted": false, + "expires_on": "2025-08-21T08:52:13.180Z", + "fingerprint": null, + "browser_info": { + "language": "en-US", + "time_zone": 330, + "ip_address": "192.168.1.1", + "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36", + "color_depth": 24, + "java_enabled": false, + "screen_width": 1920, + "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", + "screen_height": 1080, + "java_script_enabled": true + }, + "payment_channel": null, + "payment_method_id": null, + "network_transaction_id": null, + "payment_method_status": null, + "updated": "2025-08-21T08:37:15.983Z", + "split_payments": null, + "frm_metadata": null, + "extended_authorization_applied": null, + "capture_before": null, + "merchant_order_reference_id": null, + "order_tax_amount": null, + "connector_mandate_id": null, + "card_discovery": "manual", + "force_3ds_challenge": false, + "force_3ds_challenge_trigger": false, + "issuer_error_code": null, + "issuer_error_message": null, + "is_iframe_redirection_enabled": null, + "whole_connector_response": null, + "enable_partial_authorization": true +} +``` +### capture partial + +```json +{ + "payment_id": "pay_t82V58k4cohYq87gBvGL", + "merchant_id": "merchant_1755675958", + "status": "partially_captured", + "amount": 300, + "net_amount": 300, + "shipping_cost": null, + "amount_capturable": 0, + "amount_received": 150, + "connector": "nuvei", + "client_secret": "pay_t82V58k4cohYq87gBvGL_secret_CHN75ZbLuZWVBKYTITqg", + "created": "2025-08-21T08:37:13.180Z", + "currency": "EUR", + "customer_id": "nithxxinn", + "customer": { + "id": "nithxxinn", + "name": null, + "email": "hello@gmail.com", + "phone": null, + "phone_country_code": null + }, + "description": "hellow world", + "refunds": null, + "disputes": null, + "mandate_id": null, + "mandate_data": null, + "setup_future_usage": null, + "off_session": null, + "capture_on": null, + "capture_method": "manual", + "payment_method": "card", + "payment_method_data": { + "card": { + "last4": "7394", + "card_type": null, + "card_network": null, + "card_issuer": null, + "card_issuing_country": null, + "card_isin": "453173", + "card_extended_bin": null, + "card_exp_month": "01", + "card_exp_year": "2026", + "card_holder_name": "John Smith", + "payment_checks": { + "avs_description": null, + "avs_result_code": "", + "cvv_2_reply_code": "", + "cvv_2_description": null, + "merchant_advice_code": "", + "merchant_advice_code_description": null + }, + "authentication_data": { + "challengePreferenceReason": "12" + } + }, + "billing": null + }, + "payment_token": "token_yUVtqVsfxyKqmAM4fl1H", + "shipping": null, + "billing": { + "address": { + "city": "Fasdf", + "country": "US", + "line1": "Fasdf", + "line2": "Fasdf", + "line3": null, + "zip": "560095", + "state": null, + "first_name": "Sakil", + "last_name": "Mostak", + "origin_zip": null + }, + "phone": null, + "email": null + }, + "order_details": null, + "email": "hello@gmail.com", + "name": null, + "phone": null, + "return_url": "https://www.google.com/", + "authentication_type": "no_three_ds", + "statement_descriptor_name": null, + "statement_descriptor_suffix": null, + "next_action": null, + "cancellation_reason": null, + "error_code": null, + "error_message": null, + "unified_code": null, + "unified_message": null, + "payment_experience": null, + "payment_method_type": "credit", + "connector_label": null, + "business_country": null, + "business_label": "default", + "business_sub_label": null, + "allowed_payment_method_types": null, + "ephemeral_key": null, + "manual_retry_allowed": false, + "connector_transaction_id": "8110000000012833218", + "frm_message": null, + "metadata": null, + "connector_metadata": null, + "feature_metadata": { + "redirect_response": null, + "search_tags": null, + "apple_pay_recurring_details": null, + "gateway_system": "direct" + }, + "reference_id": "8101170111", + "payment_link": null, + "profile_id": "pro_8OqPL5PekR8mRXU8WZZs", + "surcharge_details": null, + "attempt_count": 1, + "merchant_decision": null, + "merchant_connector_id": "mca_48b4pLXImpTC9wJALk91", + "incremental_authorization_allowed": false, + "authorization_count": null, + "incremental_authorizations": null, + "external_authentication_details": null, + "external_3ds_authentication_attempted": false, + "expires_on": "2025-08-21T08:52:13.180Z", + "fingerprint": null, + "browser_info": { + "language": "en-US", + "time_zone": 330, + "ip_address": "192.168.1.1", + "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36", + "color_depth": 24, + "java_enabled": false, + "screen_width": 1920, + "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", + "screen_height": 1080, + "java_script_enabled": true + }, + "payment_channel": null, + "payment_method_id": null, + "network_transaction_id": null, + "payment_method_status": null, + "updated": "2025-08-21T08:37:57.428Z", + "split_payments": null, + "frm_metadata": null, + "extended_authorization_applied": null, + "capture_before": null, + "merchant_order_reference_id": null, + "order_tax_amount": null, + "connector_mandate_id": null, + "card_discovery": "manual", + "force_3ds_challenge": false, + "force_3ds_challenge_trigger": false, + "issuer_error_code": null, + "issuer_error_message": null, + "is_iframe_redirection_enabled": null, + "whole_connector_response": null, + "enable_partial_authorization": true +} +``` + +
+ + + + +### Additional Changes + +- [ ] This PR modifies the API contract +- [ ] This PR modifies the database schema +- [ ] This PR modifies application configuration/environment variables + + + + + + +- [x] I formatted the code `cargo +nightly fmt --all` +- [x] I addressed lints thrown by `cargo clippy` +- [ ] I reviewed the submitted code +- [ ] I added unit tests for my changes where possible +COMMENTS: +- semanticdiff-com[bot]: Review changes with  SemanticDiff +
+Changed Files +
+ +| File | Status | +| :--- | :--- | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8985/changes#crates/router/src/types/api/connector_mapping.rs)  [crates/router/src/types/api/connector\_mapping\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8985/changes#crates/router/src/types/api/connector_mapping.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8985/changes#crates/router/src/types/api/connector_mapping.rs)  72% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8985/changes#crates/router/src/types/api/feature_matrix.rs)  [crates/router/src/types/api/feature\_matrix\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8985/changes#crates/router/src/types/api/feature_matrix.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8985/changes#crates/router/src/types/api/feature_matrix.rs)  72% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8985/changes#crates/router/tests/connectors/nuvei.rs)  [crates/router/tests/connectors/nuvei\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8985/changes#crates/router/tests/connectors/nuvei.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8985/changes#crates/router/tests/connectors/nuvei.rs)  58% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8985/changes#crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/nuvei/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8985/changes#crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8985/changes#crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs)  27% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8985/changes#crates/hyperswitch_connectors/src/connectors/nuvei.rs)  [crates/hyperswitch\_connectors/src/connectors/nuvei\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8985/changes#crates/hyperswitch_connectors/src/connectors/nuvei.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8985/changes#crates/hyperswitch_connectors/src/connectors/nuvei.rs)  26% smaller | + +
+- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/nuvei.rs:1]: Add feature matrix changes +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs:1965]: Re check amount conversion changes for nuvei +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs:514]: Use utils here +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs:551]: Use utils here +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs:797]: Should this be secret? +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs:838]: Throw an error here. +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs:860]: Throw an error here + +=== COMMIT === +SUBJECT: feat(nuvei): Googlepay , applepay and partial authorization integration for nuvei (#8985) +BODY: +Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> + +=== FILES === +Summary: 5 files changed, +558 -190 +- crates/hyperswitch_connectors/src/connectors/nuvei.rs (+14 -4) +- crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs (+537 -183) +- crates/router/src/types/api/connector_mapping.rs (+3 -1) +- crates/router/src/types/api/feature_matrix.rs (+3 -1) +- crates/router/tests/connectors/nuvei.rs (+1 -1) + +=== PATCH === +diff --git a/crates/hyperswitch_connectors/src/connectors/nuvei.rs b/crates/hyperswitch_connectors/src/connectors/nuvei.rs +index 3701a814..79434797 100644 +--- a/crates/hyperswitch_connectors/src/connectors/nuvei.rs ++++ b/crates/hyperswitch_connectors/src/connectors/nuvei.rs +@@ -1,5 +1,5 @@ + pub mod transformers; +-use std::{fmt::Debug, sync::LazyLock}; ++use std::sync::LazyLock; + + use api_models::{payments::PaymentIdType, webhooks::IncomingWebhookEvent}; + use common_enums::{enums, CallConnectorAction, PaymentAction}; +@@ -9,6 +9,7 @@ use common_utils::{ + ext_traits::{ByteSliceExt, BytesExt, ValueExt}, + id_type, + request::{Method, Request, RequestBuilder, RequestContent}, ++ types::{AmountConvertor, StringMajorUnit, StringMajorUnitForConnector}, + }; + use error_stack::ResultExt; + use hyperswitch_domain_models::{ +@@ -57,8 +58,17 @@ use crate::{ + utils::{self, is_mandate_supported, PaymentMethodDataType, RouterData as _}, + }; + +-#[derive(Debug, Clone)] +-pub struct Nuvei; ++#[derive(Clone)] ++pub struct Nuvei { ++ pub amount_convertor: &'static (dyn AmountConvertor + Sync), ++} ++impl Nuvei { ++ pub fn new() -> &'static Self { ++ &Self { ++ amount_convertor: &StringMajorUnitForConnector, ++ } ++ } ++} + + impl ConnectorCommonExt for Nuvei + where +@@ -592,6 +602,7 @@ impl ConnectorIntegration CustomResult { + let connector_req = nuvei::NuveiPaymentsRequest::try_from((req, req.get_session_token()?))?; ++ + Ok(RequestContent::Json(Box::new(connector_req))) + } + +@@ -629,7 +640,6 @@ impl ConnectorIntegration bool { + let str = string.as_str(); + match str { +@@ -78,7 +83,9 @@ trait NuveiAuthorizePreprocessingCommon { + &self, + ) -> Result>; + fn get_capture_method(&self) -> Option; +- fn get_amount_required(&self) -> Result>; ++ fn get_minor_amount_required( ++ &self, ++ ) -> Result>; + fn get_customer_id_required(&self) -> Option; + fn get_email_required(&self) -> Result>; + fn get_currency_required( +@@ -87,9 +94,10 @@ trait NuveiAuthorizePreprocessingCommon { + fn get_payment_method_data_required( + &self, + ) -> Result>; ++ fn get_is_partial_approval(&self) -> Option; + fn get_order_tax_amount( + &self, +- ) -> Result, error_stack::Report>; ++ ) -> Result, error_stack::Report>; + } + + impl NuveiAuthorizePreprocessingCommon for PaymentsAuthorizeData { +@@ -133,8 +141,10 @@ impl NuveiAuthorizePreprocessingCommon for PaymentsAuthorizeData { + self.capture_method + } + +- fn get_amount_required(&self) -> Result> { +- Ok(self.amount) ++ fn get_minor_amount_required( ++ &self, ++ ) -> Result> { ++ Ok(self.minor_amount) + } + + fn get_currency_required( +@@ -149,13 +159,18 @@ impl NuveiAuthorizePreprocessingCommon for PaymentsAuthorizeData { + } + fn get_order_tax_amount( + &self, +- ) -> Result, error_stack::Report> { +- Ok(self.order_tax_amount.map(|tax| tax.get_amount_as_i64())) ++ ) -> Result, error_stack::Report> { ++ Ok(self.order_tax_amount) + } + + fn get_email_required(&self) -> Result> { + self.get_email() + } ++ ++ fn get_is_partial_approval(&self) -> Option { ++ self.enable_partial_authorization ++ .map(PartialApprovalFlag::from) ++ } + } + + impl NuveiAuthorizePreprocessingCommon for PaymentsPreProcessingData { +@@ -199,8 +214,10 @@ impl NuveiAuthorizePreprocessingCommon for PaymentsPreProcessingData { + self.capture_method + } + +- fn get_amount_required(&self) -> Result> { +- self.get_amount() ++ fn get_minor_amount_required( ++ &self, ++ ) -> Result> { ++ self.get_minor_amount() + } + + fn get_currency_required( +@@ -220,9 +237,13 @@ impl NuveiAuthorizePreprocessingCommon for PaymentsPreProcessingData { + } + fn get_order_tax_amount( + &self, +- ) -> Result, error_stack::Report> { ++ ) -> Result, error_stack::Report> { + Ok(None) + } ++ ++ fn get_is_partial_approval(&self) -> Option { ++ None ++ } + } + + #[derive(Debug, Serialize, Default, Deserialize)] +@@ -262,7 +283,7 @@ pub struct NuveiSessionResponse { + #[derive(Debug, Serialize, Default)] + #[serde(rename_all = "camelCase")] + pub struct NuvieAmountDetails { +- total_tax: Option, ++ total_tax: Option, + } + #[serde_with::skip_serializing_none] + #[derive(Debug, Serialize, Default)] +@@ -273,7 +294,7 @@ pub struct NuveiPaymentsRequest { + pub merchant_id: Secret, + pub merchant_site_id: Secret, + pub client_request_id: Secret, +- pub amount: String, ++ pub amount: StringMajorUnit, + pub currency: enums::Currency, + /// This ID uniquely identifies your consumer/user in your system. + pub user_token_id: Option, +@@ -286,9 +307,30 @@ pub struct NuveiPaymentsRequest { + pub device_details: DeviceDetails, + pub checksum: Secret, + pub billing_address: Option, ++ pub shipping_address: Option, + pub related_transaction_id: Option, + pub url_details: Option, + pub amount_details: Option, ++ pub is_partial_approval: Option, ++} ++ ++#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] ++#[serde(rename_all = "UPPERCASE")] ++pub enum PartialApprovalFlag { ++ #[serde(rename = "1")] ++ Enabled, ++ #[serde(rename = "0")] ++ Disabled, ++} ++ ++impl From for PartialApprovalFlag { ++ fn from(value: bool) -> Self { ++ if value { ++ Self::Enabled ++ } else { ++ Self::Disabled ++ } ++ } + } + + #[derive(Debug, Serialize, Default)] +@@ -305,7 +347,7 @@ pub struct NuveiInitPaymentRequest { + pub merchant_id: Secret, + pub merchant_site_id: Secret, + pub client_request_id: String, +- pub amount: String, ++ pub amount: StringMajorUnit, + pub currency: String, + pub payment_option: PaymentOption, + pub checksum: Secret, +@@ -319,7 +361,7 @@ pub struct NuveiPaymentFlowRequest { + pub merchant_id: Secret, + pub merchant_site_id: Secret, + pub client_request_id: String, +- pub amount: String, ++ pub amount: StringMajorUnit, + pub currency: enums::Currency, + pub related_transaction_id: Option, + pub checksum: Secret, +@@ -347,6 +389,7 @@ pub struct PaymentOption { + pub user_payment_option_id: Option, + pub alternative_payment_method: Option, + pub billing_address: Option, ++ pub shipping_address: Option, + } + + #[derive(Debug, Clone, Serialize, Deserialize)] +@@ -413,8 +456,104 @@ pub struct BillingAddress { + pub first_name: Option>, + pub last_name: Option>, + pub country: api_models::enums::CountryAlpha2, ++ pub phone: Option>, ++ pub city: Option>, ++ pub address: Option>, ++ pub street_number: Option>, ++ pub zip: Option>, ++ pub state: Option>, ++ pub cell: Option>, ++ pub address_match: Option>, ++ pub address_line2: Option>, ++ pub address_line3: Option>, ++ pub home_phone: Option>, ++ pub work_phone: Option>, ++} ++ ++#[serde_with::skip_serializing_none] ++#[derive(Debug, Clone, Default, Serialize, Deserialize)] ++#[serde(rename_all = "camelCase")] ++pub struct ShippingAddress { ++ pub salutation: Option>, ++ pub first_name: Option>, ++ pub last_name: Option>, ++ pub address: Option>, ++ pub cell: Option>, ++ pub phone: Option>, ++ pub zip: Option>, ++ pub city: Option>, ++ pub country: api_models::enums::CountryAlpha2, ++ pub state: Option>, ++ pub email: Email, ++ pub county: Option>, ++ pub address_line2: Option>, ++ pub address_line3: Option>, ++ pub street_number: Option>, ++ pub company_name: Option>, ++ pub care_of: Option>, + } + ++impl From<&Address> for BillingAddress { ++ fn from(address: &Address) -> Self { ++ let address_details = address.address.as_ref(); ++ Self { ++ email: address.email.clone().unwrap_or_default(), ++ first_name: address.get_optional_first_name(), ++ last_name: address_details.and_then(|address| address.get_optional_last_name()), ++ country: address_details ++ .and_then(|address| address.get_optional_country()) ++ .unwrap_or_default(), ++ phone: address ++ .phone ++ .as_ref() ++ .and_then(|phone| phone.number.clone()), ++ city: address_details ++ .and_then(|address| address.get_optional_city().map(|city| city.into())), ++ address: address_details.and_then(|address| address.get_optional_line1()), ++ street_number: None, ++ zip: address_details.and_then(|details| details.get_optional_zip()), ++ state: None, ++ cell: None, ++ address_match: None, ++ address_line2: address_details.and_then(|address| address.get_optional_line2()), ++ address_line3: address_details.and_then(|address| address.get_optional_line3()), ++ home_phone: None, ++ work_phone: None, ++ } ++ } ++} ++ ++impl From<&Address> for ShippingAddress { ++ fn from(address: &Address) -> Self { ++ let address_details = address.address.as_ref(); ++ ++ Self { ++ email: address.email.clone().unwrap_or_default(), ++ first_name: address_details.and_then(|details| details.get_optional_first_name()), ++ last_name: address_details.and_then(|details| details.get_optional_last_name()), ++ country: address_details ++ .and_then(|details| details.get_optional_country()) ++ .unwrap_or_default(), ++ phone: address ++ .phone ++ .as_ref() ++ .and_then(|phone| phone.number.clone()), ++ city: address_details ++ .and_then(|details| details.get_optional_city().map(|city| city.into())), ++ address: address_details.and_then(|details| details.get_optional_line1()), ++ street_number: None, ++ zip: address_details.and_then(|details| details.get_optional_zip()), ++ state: None, ++ cell: None, ++ address_line2: address_details.and_then(|details| details.get_optional_line2()), ++ address_line3: address_details.and_then(|details| details.get_optional_line3()), ++ county: None, ++ company_name: None, ++ care_of: None, ++ salutation: None, ++ } ++ } ++} + #[serde_with::skip_serializing_none] + #[derive(Debug, Clone, Default, Serialize, Deserialize)] + #[serde(rename_all = "camelCase")] +@@ -435,7 +574,7 @@ pub struct Card { + pub cvv2_reply: Option, + pub avs_code: Option, + pub card_type: Option, +- pub card_brand: Option, ++ pub brand: Option, + pub issuer_bank_name: Option, + pub issuer_country: Option, + pub is_prepaid: Option, +@@ -446,7 +585,9 @@ pub struct Card { + #[serde(rename_all = "camelCase")] + pub struct ExternalToken { + pub external_token_provider: ExternalTokenProvider, +- pub mobile_token: Secret, ++ pub mobile_token: Option>, ++ pub cryptogram: Option>, ++ pub eci_provider: Option, + } + + #[derive(Debug, Clone, Default, Serialize, Deserialize)] +@@ -644,53 +785,226 @@ pub struct NuveiCardDetails { + card_holder_name: Option>, + } + ++// Define new structs with camelCase serialization ++#[derive(Serialize, Debug)] ++#[serde(rename_all = "camelCase")] ++struct GooglePayCamelCase { ++ pm_type: Secret, ++ description: Secret, ++ info: GooglePayInfoCamelCase, ++ tokenization_data: GooglePayTokenizationDataCamelCase, ++} ++ ++#[derive(Serialize, Debug)] ++#[serde(rename_all = "camelCase")] ++struct GooglePayInfoCamelCase { ++ card_network: Secret, ++ card_details: Secret, ++ assurance_details: Option, ++} ++ ++#[derive(Serialize, Debug)] ++#[serde(rename_all = "camelCase")] ++struct GooglePayAssuranceDetailsCamelCase { ++ card_holder_authenticated: bool, ++ account_verified: bool, ++} ++ ++#[derive(Serialize, Debug)] ++#[serde(rename_all = "camelCase")] ++struct GooglePayTokenizationDataCamelCase { ++ #[serde(rename = "type")] ++ token_type: Secret, ++ token: Secret, ++} ++ ++// Define ApplePay structs with camelCase serialization ++#[derive(Serialize, Debug)] ++#[serde(rename_all = "camelCase")] ++struct ApplePayCamelCase { ++ payment_data: Secret, ++ payment_method: ApplePayPaymentMethodCamelCase, ++ transaction_identifier: Secret, ++} ++ ++#[derive(Serialize, Debug)] ++#[serde(rename_all = "camelCase")] ++struct ApplePayPaymentMethodCamelCase { ++ display_name: Secret, ++ network: Secret, ++ #[serde(rename = "type")] ++ pm_type: Secret, ++} ++ + impl TryFrom for NuveiPaymentsRequest { + type Error = error_stack::Report; + fn try_from(gpay_data: GooglePayWalletData) -> Result { +- Ok(Self { +- payment_option: PaymentOption { +- card: Some(Card { +- external_token: Some(ExternalToken { +- external_token_provider: ExternalTokenProvider::GooglePay, +- mobile_token: Secret::new( +- utils::GooglePayWalletData::try_from(gpay_data) +- .change_context(errors::ConnectorError::InvalidDataFormat { +- field_name: "google_pay_data", +- })? +- .encode_to_string_of_json() +- .change_context(errors::ConnectorError::RequestEncodingFailed)?, ++ match gpay_data.tokenization_data { ++ GpayTokenizationData::Decrypted(ref gpay_predecrypt_data) => Ok(Self { ++ payment_option: PaymentOption { ++ card: Some(Card { ++ brand: Some(gpay_data.info.card_network.clone()), ++ card_number: Some( ++ gpay_predecrypt_data ++ .application_primary_account_number ++ .clone(), + ), ++ last4_digits: Some(Secret::new( ++ gpay_predecrypt_data ++ .application_primary_account_number ++ .clone() ++ .get_last4(), ++ )), ++ expiration_month: Some(gpay_predecrypt_data.card_exp_month.clone()), ++ expiration_year: Some(gpay_predecrypt_data.card_exp_year.clone()), ++ external_token: Some(ExternalToken { ++ external_token_provider: ExternalTokenProvider::GooglePay, ++ mobile_token: None, ++ cryptogram: gpay_predecrypt_data.cryptogram.clone(), ++ eci_provider: gpay_predecrypt_data.eci_indicator.clone(), ++ }), ++ ..Default::default() + }), + ..Default::default() +- }), ++ }, + ..Default::default() +- }, +- ..Default::default() +- }) ++ }), ++ GpayTokenizationData::Encrypted(encrypted_data) => Ok(Self { ++ payment_option: PaymentOption { ++ card: Some(Card { ++ external_token: Some(ExternalToken { ++ external_token_provider: ExternalTokenProvider::GooglePay, ++ ++ mobile_token: { ++ let (token_type, token) = ( ++ encrypted_data.token_type.clone(), ++ encrypted_data.token.clone(), ++ ); ++ ++ let google_pay: GooglePayCamelCase = GooglePayCamelCase { ++ pm_type: Secret::new(gpay_data.pm_type.clone()), ++ description: Secret::new(gpay_data.description.clone()), ++ info: GooglePayInfoCamelCase { ++ card_network: Secret::new( ++ gpay_data.info.card_network.clone(), ++ ), ++ card_details: Secret::new( ++ gpay_data.info.card_details.clone(), ++ ), ++ assurance_details: gpay_data ++ .info ++ .assurance_details ++ .as_ref() ++ .map(|details| GooglePayAssuranceDetailsCamelCase { ++ card_holder_authenticated: details ++ .card_holder_authenticated, ++ account_verified: details.account_verified, ++ }), ++ }, ++ tokenization_data: GooglePayTokenizationDataCamelCase { ++ token_type: token_type.into(), ++ token: token.into(), ++ }, ++ }; ++ Some(Secret::new( ++ google_pay.encode_to_string_of_json().change_context( ++ errors::ConnectorError::RequestEncodingFailed, ++ )?, ++ )) ++ }, ++ cryptogram: None, ++ eci_provider: None, ++ }), ++ ..Default::default() ++ }), ++ ..Default::default() ++ }, ++ ..Default::default() ++ }), ++ } + } + } + impl TryFrom for NuveiPaymentsRequest { + type Error = error_stack::Report; + fn try_from(apple_pay_data: ApplePayWalletData) -> Result { +- let apple_pay_encrypted_data = apple_pay_data +- .payment_data +- .get_encrypted_apple_pay_payment_data_mandatory() +- .change_context(errors::ConnectorError::MissingRequiredField { +- field_name: "Apple pay encrypted data", +- })?; +- Ok(Self { +- payment_option: PaymentOption { +- card: Some(Card { +- external_token: Some(ExternalToken { +- external_token_provider: ExternalTokenProvider::ApplePay, +- mobile_token: Secret::new(apple_pay_encrypted_data.clone()), ++ match apple_pay_data.payment_data { ++ ApplePayPaymentData::Decrypted(apple_pay_predecrypt_data) => Ok(Self { ++ payment_option: PaymentOption { ++ card: Some(Card { ++ brand:Some(apple_pay_data.payment_method.network.clone()), ++ card_number: Some( ++ apple_pay_predecrypt_data ++ .application_primary_account_number ++ .clone(), ++ ), ++ last4_digits: Some(Secret::new( ++ apple_pay_predecrypt_data ++ .application_primary_account_number ++ .get_last4(), ++ )), ++ expiration_month: Some( ++ apple_pay_predecrypt_data ++ .application_expiration_month ++ .clone(), ++ ), ++ expiration_year: Some( ++ apple_pay_predecrypt_data ++ .application_expiration_year ++ .clone(), ++ ), ++ external_token: Some(ExternalToken { ++ external_token_provider: ExternalTokenProvider::ApplePay, ++ mobile_token: None, ++ cryptogram: Some( ++ apple_pay_predecrypt_data ++ .payment_data ++ .online_payment_cryptogram, ++ ), ++ eci_provider: Some( ++ apple_pay_predecrypt_data ++ .payment_data ++ .eci_indicator ++ .ok_or_else(missing_field_err("payment_method_data.wallet.apple_pay.payment_data.eci_indicator"))?, ++ ), ++ }), ++ ..Default::default() + }), + ..Default::default() +- }), ++ }, + ..Default::default() +- }, +- ..Default::default() +- }) ++ }), ++ ApplePayPaymentData::Encrypted(encrypted_data) => Ok(Self { ++ payment_option: PaymentOption { ++ card: Some(Card { ++ external_token: Some(ExternalToken { ++ external_token_provider: ExternalTokenProvider::ApplePay, ++ mobile_token: { ++ let apple_pay: ApplePayCamelCase = ApplePayCamelCase { ++ payment_data:encrypted_data.into(), ++ payment_method: ApplePayPaymentMethodCamelCase { ++ display_name: Secret::new(apple_pay_data.payment_method.display_name.clone()), ++ network: Secret::new(apple_pay_data.payment_method.network.clone()), ++ pm_type: Secret::new(apple_pay_data.payment_method.pm_type.clone()), ++ }, ++ transaction_identifier: Secret::new(apple_pay_data.transaction_identifier.clone()), ++ }; ++ ++ Some(Secret::new( ++ apple_pay.encode_to_string_of_json().change_context( ++ errors::ConnectorError::RequestEncodingFailed, ++ )?, ++ )) ++ }, ++ cryptogram: None, ++ eci_provider: None, ++ }), ++ ..Default::default() ++ }), ++ ..Default::default() ++ }, ++ ..Default::default() ++ }), ++ } + } + } + +@@ -869,58 +1183,32 @@ where + ), + ) -> Result { + let (payment_method, redirect, item) = data; +- let (billing_address, bank_id) = match (&payment_method, redirect) { +- (AlternativePaymentMethodType::Expresscheckout, _) => ( +- Some(BillingAddress { +- email: item.request.get_email_required()?, +- country: item.get_billing_country()?, +- ..Default::default() +- }), +- None, +- ), +- (AlternativePaymentMethodType::Giropay, _) => ( +- Some(BillingAddress { +- email: item.request.get_email_required()?, +- country: item.get_billing_country()?, +- ..Default::default() +- }), +- None, +- ), ++ let bank_id = match (&payment_method, redirect) { ++ (AlternativePaymentMethodType::Expresscheckout, _) => None, ++ (AlternativePaymentMethodType::Giropay, _) => None, + (AlternativePaymentMethodType::Sofort, _) | (AlternativePaymentMethodType::Eps, _) => { + let address = item.get_billing_address()?; +- let first_name = address.get_first_name()?; +- ( +- Some(BillingAddress { +- first_name: Some(first_name.clone()), +- last_name: Some(address.get_last_name().unwrap_or(first_name).clone()), +- email: item.request.get_email_required()?, +- country: item.get_billing_country()?, +- }), +- None, +- ) ++ address.get_first_name()?; ++ item.request.get_email_required()?; ++ item.get_billing_country()?; ++ None + } + ( + AlternativePaymentMethodType::Ideal, + Some(BankRedirectData::Ideal { bank_name, .. }), + ) => { + let address = item.get_billing_address()?; +- let first_name = address.get_first_name()?.clone(); +- ( +- Some(BillingAddress { +- first_name: Some(first_name.clone()), +- last_name: Some( +- address.get_last_name().ok().unwrap_or(&first_name).clone(), +- ), +- email: item.request.get_email_required()?, +- country: item.get_billing_country()?, +- }), +- bank_name.map(NuveiBIC::try_from).transpose()?, +- ) ++ address.get_first_name()?; ++ item.request.get_email_required()?; ++ item.get_billing_country()?; ++ bank_name.map(NuveiBIC::try_from).transpose()? + } + _ => Err(errors::ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("Nuvei"), + ))?, + }; ++ let billing_address: Option = ++ item.get_billing().ok().map(|billing| billing.into()); + Ok(Self { + payment_option: PaymentOption { + alternative_payment_method: Some(AlternativePaymentMethod { +@@ -947,20 +1235,17 @@ where + .address + .as_ref() + .ok_or_else(missing_field_err("billing.address"))?; +- let first_name = address.get_first_name()?; ++ address.get_first_name()?; + let payment_method = payment_method_type; ++ address.get_country()?; //country is necessary check ++ item.request.get_email_required()?; + Ok(NuveiPaymentsRequest { + payment_option: PaymentOption { + alternative_payment_method: Some(AlternativePaymentMethod { + payment_method, + ..Default::default() + }), +- billing_address: Some(BillingAddress { +- email: item.request.get_email_required()?, +- first_name: Some(first_name.clone()), +- last_name: Some(address.get_last_name().unwrap_or(first_name).clone()), +- country: address.get_country()?.to_owned(), +- }), ++ billing_address: item.get_billing().ok().map(|billing| billing.into()), + ..Default::default() + }, + ..Default::default() +@@ -1104,36 +1389,64 @@ where + }?; + let currency = item.request.get_currency_required()?; + let request = Self::try_from(NuveiPaymentRequestData { +- amount: utils::to_currency_base_unit(item.request.get_amount_required()?, currency)?, ++ amount: convert_amount( ++ NUVEI_AMOUNT_CONVERTOR, ++ item.request.get_minor_amount_required()?, ++ currency, ++ )?, + currency, + connector_auth_type: item.connector_auth_type.clone(), + client_request_id: item.connector_request_reference_id.clone(), + session_token: Secret::new(data.1), + capture_method: item.request.get_capture_method(), ++ + ..Default::default() + })?; + let return_url = item.request.get_return_url_required()?; + + let amount_details = match item.request.get_order_tax_amount()? { + Some(tax) => Some(NuvieAmountDetails { +- total_tax: Some(utils::to_currency_base_unit(tax, currency)?), ++ total_tax: Some(convert_amount(NUVEI_AMOUNT_CONVERTOR, tax, currency)?), + }), + None => None, + }; ++ let address = { ++ if let Some(billing_address) = item.get_optional_billing() { ++ let mut billing_address = billing_address.clone(); ++ item.get_billing_first_name()?; ++ billing_address.email = match item.get_billing_email() { ++ Ok(email) => Some(email), ++ Err(_) => Some(item.request.get_email_required()?), ++ }; ++ item.get_billing_country()?; ++ ++ Some(billing_address) ++ } else { ++ None ++ } ++ }; ++ ++ let shipping_address: Option = ++ item.get_optional_shipping().map(|address| address.into()); ++ ++ let billing_address: Option = address.map(|ref address| address.into()); + Ok(Self { + is_rebilling: request_data.is_rebilling, + user_token_id: item.customer_id.clone(), + related_transaction_id: request_data.related_transaction_id, + payment_option: request_data.payment_option, +- billing_address: request_data.billing_address, +- device_details: request_data.device_details, ++ billing_address, ++ shipping_address, ++ device_details: DeviceDetails::foreign_try_from( ++ &item.request.get_browser_info().clone(), ++ )?, + url_details: Some(UrlDetails { + success_url: return_url.clone(), + failure_url: return_url.clone(), + pending_url: return_url.clone(), + }), + amount_details, +- ++ is_partial_approval: item.request.get_is_partial_approval(), + ..request + }) + } +@@ -1157,18 +1470,13 @@ where + .get_optional_billing() + .and_then(|billing_details| billing_details.address.as_ref()); + +- let billing_address = match address { +- Some(address) => { +- let first_name = address.get_first_name()?.clone(); +- Some(BillingAddress { +- first_name: Some(first_name.clone()), +- last_name: Some(address.get_last_name().ok().unwrap_or(&first_name).clone()), +- email: item.request.get_email_required()?, +- country: item.get_billing_country()?, +- }) +- } +- None => None, +- }; ++ if let Some(address) = address { ++ // mandatory feilds check ++ address.get_first_name()?; ++ item.request.get_email_required()?; ++ item.get_billing_country()?; ++ } ++ + let (is_rebilling, additional_params, user_token_id) = + match item.request.get_setup_mandate_details().clone() { + Some(mandate_data) => { +@@ -1262,7 +1570,7 @@ where + three_d, + card_holder_name: item.get_optional_billing_full_name(), + }), +- billing_address, ++ + is_moto, + ..Default::default() + }) +@@ -1329,7 +1637,11 @@ impl TryFrom<(&types::PaymentsCompleteAuthorizeRouterData, Secret)> + )), + }?; + let request = Self::try_from(NuveiPaymentRequestData { +- amount: utils::to_currency_base_unit(item.request.amount, item.request.currency)?, ++ amount: convert_amount( ++ NUVEI_AMOUNT_CONVERTOR, ++ item.request.minor_amount, ++ item.request.currency, ++ )?, + currency: item.request.currency, + connector_auth_type: item.connector_auth_type.clone(), + client_request_id: item.connector_request_reference_id.clone(), +@@ -1363,7 +1675,7 @@ impl TryFrom for NuveiPaymentsRequest { + let merchant_secret = connector_meta.merchant_secret; + let transaction_type = TransactionType::get_from_capture_method_and_amount_string( + request.capture_method.unwrap_or_default(), +- &request.amount, ++ &request.amount.get_amount_as_string(), + ); + Ok(Self { + merchant_id: merchant_id.clone(), +@@ -1376,7 +1688,7 @@ impl TryFrom for NuveiPaymentsRequest { + merchant_id.peek(), + merchant_site_id.peek(), + &client_request_id, +- &request.amount.clone(), ++ &request.amount.get_amount_as_string(), + &request.currency.to_string(), + &time_stamp, + merchant_secret.peek(), +@@ -1409,7 +1721,7 @@ impl TryFrom for NuveiPaymentFlowRequest { + merchant_id.peek(), + merchant_site_id.peek(), + &client_request_id, +- &request.amount.clone(), ++ &request.amount.get_amount_as_string(), + &request.currency.to_string(), + &request.related_transaction_id.clone().unwrap_or_default(), + &time_stamp, +@@ -1424,7 +1736,7 @@ impl TryFrom for NuveiPaymentFlowRequest { + + #[derive(Debug, Clone, Default)] + pub struct NuveiPaymentRequestData { +- pub amount: String, ++ pub amount: StringMajorUnit, + pub currency: enums::Currency, + pub related_transaction_id: Option, + pub client_request_id: String, +@@ -1439,8 +1751,9 @@ impl TryFrom<&types::PaymentsCaptureRouterData> for NuveiPaymentFlowRequest { + Self::try_from(NuveiPaymentRequestData { + client_request_id: item.connector_request_reference_id.clone(), + connector_auth_type: item.connector_auth_type.clone(), +- amount: utils::to_currency_base_unit( +- item.request.amount_to_capture, ++ amount: convert_amount( ++ NUVEI_AMOUNT_CONVERTOR, ++ item.request.minor_amount_to_capture, + item.request.currency, + )?, + currency: item.request.currency, +@@ -1455,8 +1768,9 @@ impl TryFrom<&types::RefundExecuteRouterData> for NuveiPaymentFlowRequest { + Self::try_from(NuveiPaymentRequestData { + client_request_id: item.connector_request_reference_id.clone(), + connector_auth_type: item.connector_auth_type.clone(), +- amount: utils::to_currency_base_unit( +- item.request.refund_amount, ++ amount: convert_amount( ++ NUVEI_AMOUNT_CONVERTOR, ++ item.request.minor_refund_amount, + item.request.currency, + )?, + currency: item.request.currency, +@@ -1533,8 +1847,11 @@ impl TryFrom<&types::PaymentsCancelRouterData> for NuveiPaymentFlowRequest { + Self::try_from(NuveiPaymentRequestData { + client_request_id: item.connector_request_reference_id.clone(), + connector_auth_type: item.connector_auth_type.clone(), +- amount: utils::to_currency_base_unit( +- item.request.get_amount()?, ++ amount: convert_amount( ++ NUVEI_AMOUNT_CONVERTOR, ++ item.request ++ .minor_amount ++ .ok_or_else(missing_field_err("amount"))?, + item.request.get_currency()?, + )?, + currency: item.request.get_currency()?, +@@ -1603,6 +1920,15 @@ impl From for enums::AttemptStatus { + } + } + ++#[derive(Debug, Clone, Default, Serialize, Deserialize)] ++#[serde(rename_all = "camelCase")] ++pub struct NuveiPartialApproval { ++ pub requested_amount: StringMajorUnit, ++ pub requested_currency: enums::Currency, ++ pub processed_amount: StringMajorUnit, ++ pub processed_currency: enums::Currency, ++} ++ + #[derive(Debug, Clone, Default, Serialize, Deserialize)] + #[serde(rename_all = "camelCase")] + pub struct NuveiPaymentsResponse { +@@ -1623,6 +1949,7 @@ pub struct NuveiPaymentsResponse { + pub fraud_details: Option, + pub external_scheme_transaction_id: Option>, + pub session_token: Option>, ++ pub partial_approval: Option, + //The ID of the transaction in the merchant’s system. + pub client_unique_id: Option, + pub internal_request_id: Option, +@@ -1635,6 +1962,37 @@ pub struct NuveiPaymentsResponse { + pub client_request_id: Option, + pub merchant_advice_code: Option, + } ++impl NuveiPaymentsResponse { ++ /// returns amount_captured and minor_amount_capturable ++ pub fn get_amount_captured( ++ &self, ++ ) -> Result<(Option, Option), error_stack::Report> { ++ match &self.partial_approval { ++ Some(partial_approval) => { ++ let amount = utils::convert_back_amount_to_minor_units( ++ NUVEI_AMOUNT_CONVERTOR, ++ partial_approval.processed_amount.clone(), ++ partial_approval.processed_currency, ++ )?; ++ match self.transaction_type { ++ None => Ok((None, None)), ++ Some(NuveiTransactionType::Sale) => { ++ Ok((Some(MinorUnit::get_amount_as_i64(amount)), None)) ++ } ++ Some(NuveiTransactionType::Auth) => Ok((None, Some(amount))), ++ Some(NuveiTransactionType::Auth3D) => { ++ Ok((Some(MinorUnit::get_amount_as_i64(amount)), None)) ++ } ++ Some(NuveiTransactionType::InitAuth3D) => Ok((None, Some(amount))), ++ Some(NuveiTransactionType::Credit) => Ok((None, None)), ++ Some(NuveiTransactionType::Void) => Ok((None, None)), ++ Some(NuveiTransactionType::Settle) => Ok((None, None)), ++ } ++ } ++ None => Ok((None, None)), ++ } ++ } ++} + + #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] + pub enum NuveiTransactionType { +@@ -1708,36 +2066,27 @@ fn get_payment_status( + } + } + +-fn build_error_response( +- response: &NuveiPaymentsResponse, +- http_code: u16, +-) -> Option>> { ++fn build_error_response(response: &NuveiPaymentsResponse, http_code: u16) -> Option { + match response.status { +- NuveiPaymentStatus::Error => Some( +- get_error_response( +- response.err_code, +- &response.reason, ++ NuveiPaymentStatus::Error => Some(get_error_response( ++ response.err_code, ++ &response.reason, ++ http_code, ++ &response.merchant_advice_code, ++ &response.gw_error_code.map(|e| e.to_string()), ++ &response.gw_error_reason, ++ )), ++ ++ _ => { ++ let err = Some(get_error_response( ++ response.gw_error_code, ++ &response.gw_error_reason, + http_code, + &response.merchant_advice_code, + &response.gw_error_code.map(|e| e.to_string()), + &response.gw_error_reason, +- ) +- .map_err(|_err| error_stack::report!(errors::ConnectorError::ResponseHandlingFailed)), +- ), +- _ => { +- let err = Some( +- get_error_response( +- response.gw_error_code, +- &response.gw_error_reason, +- http_code, +- &response.merchant_advice_code, +- &response.gw_error_code.map(|e| e.to_string()), +- &response.gw_error_reason, +- ) +- .map_err(|_err| { +- error_stack::report!(errors::ConnectorError::ResponseHandlingFailed) +- }), +- ); ++ )); ++ + match response.transaction_status { + Some(NuveiTransactionStatus::Error) | Some(NuveiTransactionStatus::Declined) => err, + _ => match response +@@ -1798,7 +2147,6 @@ where + form_fields: std::collections::HashMap::from([("creq".to_string(), creq.expose())]), + }), + }; +- + let connector_response_data = + convert_to_additional_payment_method_connector_response(&item.response) + .map(ConnectorResponseData::with_additional_payment_method_data); +@@ -1812,12 +2160,7 @@ where + fn create_transaction_response( + response: &NuveiPaymentsResponse, + redirection_data: Option, +- http_code: u16, + ) -> Result> { +- if let Some(err) = build_error_response(response, http_code) { +- return err; +- } +- + Ok(PaymentsResponseData::TransactionResponse { + resource_id: response + .transaction_id +@@ -1882,13 +2225,19 @@ impl + let (status, redirection_data, connector_response_data) = + process_nuvei_payment_response(&item, amount)?; + ++ let (amount_captured, minor_amount_capturable) = item.response.get_amount_captured()?; + Ok(Self { + status, +- response: Ok(create_transaction_response( +- &item.response, +- redirection_data, +- item.http_code, +- )?), ++ response: if let Some(err) = build_error_response(&item.response, item.http_code) { ++ Err(err) ++ } else { ++ Ok(create_transaction_response( ++ &item.response, ++ redirection_data, ++ )?) ++ }, ++ amount_captured, ++ minor_amount_capturable, + connector_response: connector_response_data, + ..item.data + }) +@@ -1915,13 +2264,19 @@ where + let (status, redirection_data, connector_response_data) = + process_nuvei_payment_response(&item, amount)?; + ++ let (amount_captured, minor_amount_capturable) = item.response.get_amount_captured()?; + Ok(Self { + status, +- response: Ok(create_transaction_response( +- &item.response, +- redirection_data, +- item.http_code, +- )?), ++ response: if let Some(err) = build_error_response(&item.response, item.http_code) { ++ Err(err) ++ } else { ++ Ok(create_transaction_response( ++ &item.response, ++ redirection_data, ++ )?) ++ }, ++ amount_captured, ++ minor_amount_capturable, + connector_response: connector_response_data, + ..item.data + }) +@@ -1982,10 +2337,10 @@ impl TryFrom> + .ok_or(errors::ConnectorError::MissingConnectorTransactionID)?; + + let refund_response = +- get_refund_response(item.response.clone(), item.http_code, transaction_id)?; ++ get_refund_response(item.response.clone(), item.http_code, transaction_id); + + Ok(Self { +- response: Ok(refund_response), ++ response: refund_response.map_err(|err| *err), + ..item.data + }) + } +@@ -2005,10 +2360,10 @@ impl TryFrom> + .ok_or(errors::ConnectorError::MissingConnectorTransactionID)?; + + let refund_response = +- get_refund_response(item.response.clone(), item.http_code, transaction_id)?; ++ get_refund_response(item.response.clone(), item.http_code, transaction_id); + + Ok(Self { +- response: Ok(refund_response), ++ response: refund_response.map_err(|err| *err), + ..item.data + }) + } +@@ -2032,6 +2387,7 @@ where + } else { + None + }; ++ + Ok(Self { + related_transaction_id, + device_details: DeviceDetails::foreign_try_from( +@@ -2065,32 +2421,30 @@ fn get_refund_response( + response: NuveiPaymentsResponse, + http_code: u16, + txn_id: String, +-) -> Result> { ++) -> Result> { + let refund_status = response + .transaction_status + .clone() + .map(enums::RefundStatus::from) + .unwrap_or(enums::RefundStatus::Failure); + match response.status { +- NuveiPaymentStatus::Error => get_error_response( ++ NuveiPaymentStatus::Error => Err(Box::new(get_error_response( + response.err_code, + &response.reason, + http_code, + &response.merchant_advice_code, + &response.gw_error_code.map(|e| e.to_string()), + &response.gw_error_reason, +- ) +- .map_err(|_err| error_stack::report!(errors::ConnectorError::ResponseHandlingFailed)), ++ ))), + _ => match response.transaction_status { +- Some(NuveiTransactionStatus::Error) => get_error_response( ++ Some(NuveiTransactionStatus::Error) => Err(Box::new(get_error_response( + response.err_code, + &response.reason, + http_code, + &response.merchant_advice_code, + &response.gw_error_code.map(|e| e.to_string()), + &response.gw_error_reason, +- ) +- .map_err(|_err| error_stack::report!(errors::ConnectorError::ResponseHandlingFailed)), ++ ))), + _ => Ok(RefundsResponseData { + connector_refund_id: txn_id, + refund_status, +@@ -2099,15 +2453,15 @@ fn get_refund_response( + } + } + +-fn get_error_response( ++fn get_error_response( + error_code: Option, + error_msg: &Option, + http_code: u16, + network_advice_code: &Option, + network_decline_code: &Option, + network_error_message: &Option, +-) -> Result> { +- Err(Box::new(ErrorResponse { ++) -> ErrorResponse { ++ ErrorResponse { + code: error_code + .map(|c| c.to_string()) + .unwrap_or_else(|| NO_ERROR_CODE.to_string()), +@@ -2122,7 +2476,7 @@ fn get_error_response( + network_decline_code: network_decline_code.clone(), + network_error_message: network_error_message.clone(), + connector_metadata: None, +- })) ++ } + } + + /// Represents any possible webhook notification from Nuvei. +@@ -2394,7 +2748,7 @@ fn convert_to_additional_payment_method_connector_response( + "merchant_advice_code_description": merchant_advice_description + }); + +- let card_network = card.card_brand.clone(); ++ let card_network = card.brand.clone(); + let three_ds_data = card + .three_d + .clone() +diff --git a/crates/router/src/types/api/connector_mapping.rs b/crates/router/src/types/api/connector_mapping.rs +index c184c9db..29f14f79 100644 +--- a/crates/router/src/types/api/connector_mapping.rs ++++ b/crates/router/src/types/api/connector_mapping.rs +@@ -322,7 +322,9 @@ impl ConnectorData { + enums::Connector::Novalnet => { + Ok(ConnectorEnum::Old(Box::new(connector::Novalnet::new()))) + } +- enums::Connector::Nuvei => Ok(ConnectorEnum::Old(Box::new(&connector::Nuvei))), ++ enums::Connector::Nuvei => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Nuvei::new()))) ++ } + enums::Connector::Opennode => { + Ok(ConnectorEnum::Old(Box::new(connector::Opennode::new()))) + } +diff --git a/crates/router/src/types/api/feature_matrix.rs b/crates/router/src/types/api/feature_matrix.rs +index ac7754fa..d7307e7a 100644 +--- a/crates/router/src/types/api/feature_matrix.rs ++++ b/crates/router/src/types/api/feature_matrix.rs +@@ -239,7 +239,9 @@ impl FeatureMatrixConnectorData { + enums::Connector::Novalnet => { + Ok(ConnectorEnum::Old(Box::new(connector::Novalnet::new()))) + } +- enums::Connector::Nuvei => Ok(ConnectorEnum::Old(Box::new(&connector::Nuvei))), ++ enums::Connector::Nuvei => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Nuvei::new()))) ++ } + enums::Connector::Opennode => { + Ok(ConnectorEnum::Old(Box::new(connector::Opennode::new()))) + } +diff --git a/crates/router/tests/connectors/nuvei.rs b/crates/router/tests/connectors/nuvei.rs +index f2db3c94..395ad1d1 100644 +--- a/crates/router/tests/connectors/nuvei.rs ++++ b/crates/router/tests/connectors/nuvei.rs +@@ -16,7 +16,7 @@ impl utils::Connector for NuveiTest { + fn get_data(&self) -> types::api::ConnectorData { + use router::connector::Nuvei; + utils::construct_connector_data_old( +- Box::new(&Nuvei), ++ Box::new(Nuvei::new()), + types::Connector::Nuvei, + types::api::GetToken::Connector, + None, + +----- END CHUNK ----- \ No newline at end of file diff --git a/raw/08/08166991f814c73b4217800ecdee560626b4986c.txt b/raw/08/08166991f814c73b4217800ecdee560626b4986c.txt new file mode 100644 index 0000000000000000000000000000000000000000..e49de8156227545717223a604693db3e62a17fe7 --- /dev/null +++ b/raw/08/08166991f814c73b4217800ecdee560626b4986c.txt @@ -0,0 +1,515 @@ +ROUTE: juspay/hyperswitch@08166991f814c73b4217800ecdee560626b4986c +REPO: https://github.com/juspay/hyperswitch +COMMIT: 08166991f814c73b4217800ecdee560626b4986c +AUTHOR: Swangi Kumari <85639103+swangi-kumari@users.noreply.github.com> +DATE: 2025-08-19T11:00:59 + +=== ISSUE_AND_PR === +[PR #8988] refactor: [Netcetera] Handle response deserialization error +URL: https://github.com/juspay/hyperswitch/pull/8988 +BODY: +## Type of Change + + +- [ ] Bugfix +- [ ] New feature +- [ ] Enhancement +- [ ] Refactoring +- [ ] Dependency updates +- [ ] Documentation +- [ ] CI/CD + +## Description +- Handle response deserialization error +- three_ds_requestor_challenge_ind can be vector or string + +### Additional Changes + +- [ ] This PR modifies the API contract +- [ ] This PR modifies the database schema +- [ ] This PR modifies application configuration/environment variables + + + + +## Motivation and Context + + + +## How did you test it? +Sanity flow with netcetra and cybersource +Profile update +``` +curl --location 'http://localhost:8080/account/merchant_1755510755/business_profile/pro_BwyTBsmG8NfDWCJNSozM' \ +--header 'Content-Type: application/json' \ +--header 'Accept: application/json' \ +--header 'api-key: dev_QBdrxdNVk1Qi1kfHVAxfkkN4It60LAsZB1Zfb1SWaXePTncdQ8qS6v0ikHyHcXJy' \ +--data '{ + + "authentication_connector_details": { + "authentication_connectors": ["netcetera"], + "three_ds_requestor_url": "https://google.com" + } +}' +``` +Response +``` +{ + "merchant_id": "merchant_1755510755", + "profile_id": "pro_BwyTBsmG8NfDWCJNSozM", + "profile_name": "US_default", + "return_url": "https://google.com/success", + "enable_payment_response_hash": true, + "payment_response_hash_key": "iCpLwpK7rw6BuAvVHhA4n73QtuDLJ82MUwAqMzWsiAhytB8SnxVVjrqRmOhRuLD4", + "redirect_to_merchant_with_http_post": false, + "webhook_details": { + "webhook_version": "1.0.1", + "webhook_username": "ekart_retail", + "webhook_password": "password_ekart@123", + "webhook_url": null, + "payment_created_enabled": true, + "payment_succeeded_enabled": true, + "payment_failed_enabled": true, + "payment_statuses_enabled": null, + "refund_statuses_enabled": null, + "payout_statuses_enabled": null + }, + "metadata": null, + "routing_algorithm": null, + "intent_fulfillment_time": 900, + "frm_routing_algorithm": null, + "payout_routing_algorithm": null, + "applepay_verified_domains": null, + "session_expiry": 900, + "payment_link_config": null, + "authentication_connector_details": { + "authentication_connectors": [ + "netcetera" + ], + "three_ds_requestor_url": "https://google.com", + "three_ds_requestor_app_url": null + }, + "use_billing_as_payment_method_billing": true, + "extended_card_info_config": null, + "collect_shipping_details_from_wallet_connector": false, + "collect_billing_details_from_wallet_connector": false, + "always_collect_shipping_details_from_wallet_connector": false, + "always_collect_billing_details_from_wallet_connector": false, + "is_connector_agnostic_mit_enabled": false, + "payout_link_config": null, + "outgoing_webhook_custom_http_headers": null, + "tax_connector_id": null, + "is_tax_connector_enabled": false, + "is_network_tokenization_enabled": false, + "is_auto_retries_enabled": false, + "max_auto_retries_enabled": null, + "always_request_extended_authorization": null, + "is_click_to_pay_enabled": false, + "authentication_product_ids": null, + "card_testing_guard_config": { + "card_ip_blocking_status": "disabled", + "card_ip_blocking_threshold": 3, + "guest_user_card_blocking_status": "disabled", + "guest_user_card_blocking_threshold": 10, + "customer_id_blocking_status": "disabled", + "customer_id_blocking_threshold": 5, + "card_testing_guard_expiry": 3600 + }, + "is_clear_pan_retries_enabled": false, + "force_3ds_challenge": false, + "is_debit_routing_enabled": false, + "merchant_business_country": null, + "is_pre_network_tokenization_enabled": false, + "acquirer_configs": null, + "is_iframe_redirection_enabled": null, + "merchant_category_code": null, + "merchant_country_code": null, + "dispute_polling_interval": null +} +``` + +Card request +``` +{ + "amount": 2540, + "currency": "USD", + "profile_id": "pro_BwyTBsmG8NfDWCJNSozM", + "confirm": true, + "amount_to_capture": 2540, + "capture_method": "automatic", + "capture_on": "2022-09-10T10:11:12Z", + "customer_id": "StripeCustomer", + "email": "abcdef123@gmail.com", + "name": "John Doe", + "phone": "999999999", + "request_external_three_ds_authentication": true, + "phone_country_code": "+65", + "description": "Its my first payment request", + "authentication_type": "three_ds", + "return_url": "https://google.com", + "setup_future_usage": "on_session", + "browser_info": { + "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36", + "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8", + "language": "nl-NL", + "color_depth": 24, + "screen_height": 723, + "screen_width": 1536, + "time_zone": 0, + "java_enabled": true, + "java_script_enabled": true, + "ip_address": "127.0.0.1" + }, + "shipping": { + "address": { + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "city": "San Fransico", + "state": "California", + "zip": "94122", + "country": "US", + "first_name": "John", + "last_name": "Doe" + } + }, + "routing": { + "type": "single", + "data": "nmi" + }, + "statement_descriptor_name": "joseph", + "statement_descriptor_suffix": "JS", + "metadata": { + "udf1": "value1", + "new_customer": "true", + "login_date": "2019-09-10T10:11:12Z" + }, + "payment_method": "card", + "payment_method_type": "credit", + "payment_method_data": { + "card": { + "card_number": "4035 5014 2814 6300", + "card_exp_month": "03", + "card_exp_year": "2030", + "card_holder_name": "joseph Doe", + "card_cvc": "737" + // "card_network": "CartesBancaires" + } + }, + "billing": { + "address": { + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "city": "San Fransico", + "state": "California", + "zip": "94122", + "country": "US", + "first_name": "John", + "last_name": "Doe" + } + } +} +``` +response +``` +{ + "payment_id": "pay_VIDTWLGUcRV3CD9htaVR", + "merchant_id": "merchant_1755510755", + "status": "requires_customer_action", + "amount": 2540, + "net_amount": 2540, + "shipping_cost": null, + "amount_capturable": 0, + "amount_received": null, + "connector": "cybersource", + "client_secret": "pay_VIDTWLGUcRV3CD9htaVR_secret_oQT12tBHvaPkuODXoyex", + "created": "2025-08-19T10:17:28.860Z", + "currency": "USD", + "customer_id": "StripeCustomer", + "customer": { + "id": "StripeCustomer", + "name": "John Doe", + "email": "abcdef123@gmail.com", + "phone": "999999999", + "phone_country_code": "+65" + }, + "description": "Its my first payment request", + "refunds": null, + "disputes": null, + "mandate_id": null, + "mandate_data": null, + "setup_future_usage": "on_session", + "off_session": null, + "capture_on": null, + "capture_method": "automatic", + "payment_method": "card", + "payment_method_data": { + "card": { + "last4": "6300", + "card_type": null, + "card_network": null, + "card_issuer": null, + "card_issuing_country": null, + "card_isin": "403550", + "card_extended_bin": null, + "card_exp_month": "03", + "card_exp_year": "2030", + "card_holder_name": "joseph Doe", + "payment_checks": null, + "authentication_data": null + }, + "billing": null + }, + "payment_token": "token_V0xBNOlCVuSJuByMCfEB", + "shipping": { + "address": { + "city": "San Fransico", + "country": "US", + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "zip": "94122", + "state": "California", + "first_name": "John", + "last_name": "Doe", + "origin_zip": null + }, + "phone": null, + "email": null + }, + "billing": { + "address": { + "city": "San Fransico", + "country": "US", + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "zip": "94122", + "state": "California", + "first_name": "John", + "last_name": "Doe", + "origin_zip": null + }, + "phone": null, + "email": null + }, + "order_details": null, + "email": "abcdef123@gmail.com", + "name": "John Doe", + "phone": "999999999", + "return_url": "https://google.com/", + "authentication_type": "three_ds", + "statement_descriptor_name": "joseph", + "statement_descriptor_suffix": "JS", + "next_action": { + "type": "three_ds_invoke", + "three_ds_data": { + "three_ds_authentication_url": "http://localhost:8080/payments/pay_VIDTWLGUcRV3CD9htaVR/3ds/authentication", + "three_ds_authorize_url": "http://localhost:8080/payments/pay_VIDTWLGUcRV3CD9htaVR/merchant_1755510755/authorize/cybersource", + "three_ds_method_details": { + "three_ds_method_key": "threeDSMethodData", + "three_ds_method_data_submission": true, + "three_ds_method_data": "eyJ0aHJlZURTTWV0aG9kTm90aWZpY2F0aW9uVVJMIjoiaHR0cHM6Ly9leGFtcGxlLmNvbS8zZHMtbWV0aG9kLW5vdGlmaWNhdGlvbi11cmwiLCJ0aHJlZURTU2VydmVyVHJhbnNJRCI6IjNiMGRhOGE5LWJhY2UtNGNlMS05NWI4LTJhMWNmOTlmOThhOCJ9", + "three_ds_method_url": "https://ndm-prev.3dss-non-prod.cloud.netcetera.com/acs/3ds-method" + }, + "poll_config": { + "poll_id": "external_authentication_pay_VIDTWLGUcRV3CD9htaVR", + "delay_in_secs": 2, + "frequency": 5 + }, + "message_version": "2.3.1", + "directory_server_id": "A000000003" + } + }, + "cancellation_reason": null, + "error_code": null, + "error_message": null, + "unified_code": null, + "unified_message": null, + "payment_experience": null, + "payment_method_type": "credit", + "connector_label": null, + "business_country": null, + "business_label": "default", + "business_sub_label": null, + "allowed_payment_method_types": null, + "ephemeral_key": { + "customer_id": "StripeCustomer", + "created_at": 1755598648, + "expires": 1755602248, + "secret": "epk_fd1d2eec8768439685e62ee45dabb4bc" + }, + "manual_retry_allowed": null, + "connector_transaction_id": null, + "frm_message": null, + "metadata": { + "udf1": "value1", + "login_date": "2019-09-10T10:11:12Z", + "new_customer": "true" + }, + "connector_metadata": null, + "feature_metadata": null, + "reference_id": null, + "payment_link": null, + "profile_id": "pro_BwyTBsmG8NfDWCJNSozM", + "surcharge_details": null, + "attempt_count": 1, + "merchant_decision": null, + "merchant_connector_id": "mca_dRvP71fPP5fDcWrMaE2z", + "incremental_authorization_allowed": null, + "authorization_count": null, + "incremental_authorizations": null, + "external_authentication_details": { + "authentication_flow": null, + "electronic_commerce_indicator": null, + "status": "pending", + "ds_transaction_id": "3b0da8a9-bace-4ce1-95b8-2a1cf99f98a8", + "version": "2.3.1", + "error_code": null, + "error_message": null + }, + "external_3ds_authentication_attempted": true, + "expires_on": "2025-08-19T10:32:28.860Z", + "fingerprint": null, + "browser_info": { + "language": "nl-NL", + "time_zone": 0, + "ip_address": "127.0.0.1", + "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36", + "color_depth": 24, + "java_enabled": true, + "screen_width": 1536, + "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8", + "screen_height": 723, + "java_script_enabled": true + }, + "payment_channel": null, + "payment_method_id": null, + "network_transaction_id": null, + "payment_method_status": null, + "updated": "2025-08-19T10:17:29.573Z", + "split_payments": null, + "frm_metadata": null, + "extended_authorization_applied": null, + "capture_before": null, + "merchant_order_reference_id": null, + "order_tax_amount": null, + "connector_mandate_id": null, + "card_discovery": "manual", + "force_3ds_challenge": false, + "force_3ds_challenge_trigger": false, + "issuer_error_code": null, + "issuer_error_message": null, + "is_iframe_redirection_enabled": null, + "whole_connector_response": null, + "enable_partial_authorization": null +} + +Create challenge +``` +curl --location 'http://localhost:8080/payments/pay_VIDTWLGUcRV3CD9htaVR/3ds/authentication' \ +--header 'Content-Type: application/json' \ +--header 'Accept: application/json' \ +--header 'api-key: pk_dev_5b6e1d248e7f412eaba54679208f9a84' \ +--data '{ + "client_secret": "pay_VIDTWLGUcRV3CD9htaVR_secret_oQT12tBHvaPkuODXoyex", + "device_channel": "BRW", + "threeds_method_comp_ind": "Y" +}' +Response +``` +{ + "trans_status": "C", + "acs_url": "https://ndm-prev.3dss-non-prod.cloud.netcetera.com/acs/challenge", + "challenge_request": "eyJtZXNzYWdlVHlwZSI6IkNSZXEiLCJ0aHJlZURTU2VydmVyVHJhbnNJRCI6IjNiMGRhOGE5LWJhY2UtNGNlMS05NWI4LTJhMWNmOTlmOThhOCIsImFjc1RyYW5zSUQiOiJlNjcxYWM4ZS0wZWEyLTRhNzQtOGY5NC0zMzAyMDRhMWI3NmUiLCJjaGFsbGVuZ2VXaW5kb3dTaXplIjoiMDUiLCJtZXNzYWdlVmVyc2lvbiI6IjIuMy4xIn0", + "acs_reference_number": "3DS_LOA_ACS_201_13579", + "acs_trans_id": "e671ac8e-0ea2-4a74-8f94-330204a1b76e", + "three_dsserver_trans_id": "3b0da8a9-bace-4ce1-95b8-2a1cf99f98a8", + "acs_signed_content": null, + "three_ds_requestor_url": "https://google.com", + "three_ds_requestor_app_url": null +} +``` + + + +## Checklist + + +- [x] I formatted the code `cargo +nightly fmt --all` +- [x] I addressed lints thrown by `cargo clippy` +- [x] I reviewed the submitted code +- [ ] I added unit tests for my changes where possible +COMMENTS: +- semanticdiff-com[bot]: Review changes with  SemanticDiff +
+Changed Files +
+ +| File | Status | +| :--- | :--- | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8988/changes#crates/hyperswitch_connectors/src/connectors/netcetera/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/netcetera/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8988/changes#crates/hyperswitch_connectors/src/connectors/netcetera/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8988/changes#crates/hyperswitch_connectors/src/connectors/netcetera/transformers.rs)  28% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8988/changes#crates/hyperswitch_domain_models/src/router_request_types/authentication.rs)  [crates/hyperswitch\_domain\_models/src/router\_request\_types/authentication\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8988/changes#crates/hyperswitch_domain_models/src/router_request_types/authentication.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8988/changes#crates/hyperswitch_domain_models/src/router_request_types/authentication.rs)  0% smaller | + +
+ +=== COMMIT === +SUBJECT: refactor: [Netcetera] Handle response deserialization error (#8988) + +=== FILES === +Summary: 1 files changed, +12 -2 +- crates/hyperswitch_connectors/src/connectors/netcetera/transformers.rs (+12 -2) + +=== PATCH === +diff --git a/crates/hyperswitch_connectors/src/connectors/netcetera/transformers.rs b/crates/hyperswitch_connectors/src/connectors/netcetera/transformers.rs +index 8444c7b9..b6e85aea 100644 +--- a/crates/hyperswitch_connectors/src/connectors/netcetera/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/netcetera/transformers.rs +@@ -163,7 +163,10 @@ impl + .authentication_request + .as_ref() + .and_then(|req| req.three_ds_requestor_challenge_ind.as_ref()) +- .and_then(|v| v.first().cloned()); ++ .and_then(|ind| match ind { ++ ThreedsRequestorChallengeInd::Single(s) => Some(s.clone()), ++ ThreedsRequestorChallengeInd::Multiple(v) => v.first().cloned(), ++ }); + + let message_extension = response + .authentication_request +@@ -680,10 +683,17 @@ pub struct NetceteraAuthenticationFailureResponse { + #[serde(rename_all = "camelCase")] + pub struct AuthenticationRequest { + #[serde(rename = "threeDSRequestorChallengeInd")] +- pub three_ds_requestor_challenge_ind: Option>, ++ pub three_ds_requestor_challenge_ind: Option, + pub message_extension: Option, + } + ++#[derive(Debug, Serialize, Deserialize)] ++#[serde(untagged)] ++pub enum ThreedsRequestorChallengeInd { ++ Single(String), ++ Multiple(Vec), ++} ++ + #[derive(Debug, Deserialize, Serialize)] + #[serde(rename_all = "camelCase")] + pub struct AuthenticationResponse { + +----- END CHUNK ----- \ No newline at end of file diff --git a/raw/0b/0b59b9086cd68eef346413a27d03fa61fb6bb1f7.txt b/raw/0b/0b59b9086cd68eef346413a27d03fa61fb6bb1f7.txt new file mode 100644 index 0000000000000000000000000000000000000000..7bd6091f73c2d50adb836921e232be0da5de6e33 --- /dev/null +++ b/raw/0b/0b59b9086cd68eef346413a27d03fa61fb6bb1f7.txt @@ -0,0 +1,2452 @@ +ROUTE: juspay/hyperswitch@0b59b9086cd68eef346413a27d03fa61fb6bb1f7 +REPO: https://github.com/juspay/hyperswitch +COMMIT: 0b59b9086cd68eef346413a27d03fa61fb6bb1f7 +AUTHOR: Aniket Burman <93077964+aniketburman014@users.noreply.github.com> +DATE: 2025-08-25T09:28:39 + +=== ISSUE_AND_PR === +[PR #8846] feat(revenue_recovery): Add redis-based payment processor token tracking for revenue recovery +URL: https://github.com/juspay/hyperswitch/pull/8846 +BODY: +## Type of Change + + +- [ ] Bugfix +- [x] New feature +- [ ] Enhancement +- [ ] Refactoring +- [ ] Dependency updates +- [ ] Documentation +- [ ] CI/CD + +## Description + +This module implements a **Redis-backed system** for managing and selecting the best **payment processor token** during **payment retries**. + +It ensures: +- **Safe** token usage (no race conditions with locks) locked on connector customer level - if a payment has been scheduled then all other invoices for that customer will be in a queue. +- **Consistent** retry limit enforcement + +--- + +## Why This Exists +In the **revenue recovery flow**, there is **no direct mapping between a customer and their payment methods**. + +However, card networks enforce **retry limits** (daily and rolling 30-day) for **each merchant–customer card**. +Without tracking at this level, retries could breach these limits, leading to: +- Higher decline rates +- Potential network penalties + +### The Solution +1. **Group multiple cards of a customer** under a single **`connector_customer_id`**. +2. **Store all payment processor tokens** for that connector customer in Redis. +3. Allow tokens to be: + - **Inserted** when a webhook is received + - **Retrieved** during the process tracker’s calculation flow to select the best retry candidate + +This enables: +- Enforcement of **daily** and **30-day rolling thresholds** +- Compliance with **network-level** retry rules +- Token availability across flows without additional database lookups + +--- + +## Redis Schema + +| Key Pattern | Type | Purpose | +|-------------|--------|---------| +| `customer:{customer_id}:status` | String | Lock key storing the `payment_id` to prevent parallel updates | +| `customer:{customer_id}:tokens` | Hash | Maps `token_id` → `TokenStatus` JSON | + +### Example `TokenStatus` JSON +```json +{ + "token_id": "tok_abc123", + "error_code": "do_not_honor", + "network": "visa", + "added_by_payment_id": "pay_xyz789", + "retry_history": { + "2025-08-01": 1, + "2025-08-02": 2 + } +} +``` + +## Flow + +### **Step 1 – Acquire Lock** +- Create a lock key: + `customer:{customer_id}:status` → value = `payment_id` +- Purpose: Prevent parallel processes from working on the same customer +- If the lock is already present: + - Exit early with message: *"Customer is already locked by another process."* + +--- + +### **Step 2– Fetch Existing Tokens** +- Retrieve all payment processor tokens from + `customer:{customer_id}:tokens` +- These tokens are then evaluated for retry eligibility + +--- + +### **Step 3 – Check Retry Limits** +For each token: +- Count retries in the **last 30 days** +- Check if daily or rolling 30-day limit is exceeded +- If limit exceeded → give a wait time for those tokens +- Calculate **wait time** before the token can be retried again + +--- + +### **Step 4 – Decider Logic (Upcoming)** +- For all eligible tokens: + 1. Determine the ** schedule time** for the psp tokens + 2. Select the token with the **earliest schedule time** + +--- + +### **Step 5 – Update Retry State** +- After Transaction Executed +- Increment **today’s retry count** for the selected token +- Persist the updated `TokenStatus` back to Redis + +--- + +### **Step 6 – Release Lock** +- Delete `customer:{customer_id}:status` lock key +- Allow the next payment flow to proceed + + +### Additional Changes + +- [ ] This PR modifies the API contract +- [ ] This PR modifies the database schema +- [ ] This PR modifies application configuration/environment variables + + + + +## Motivation and Context + + + +## How did you test it? + +-- Curl + + +### Payment Processor curl + +``` +curl --location 'http://localhost:8080/v2/connector-accounts' \ +--header 'Content-Type: application/json' \ +--header 'Accept: application/json' \ +--header 'x-merchant-id: {{}}' \ +--header 'x-profile-id: {{}}' \ +--header 'Authorization: admin-api-key=test_admin' \ +--header 'api-key: {{}}' \ +--data ' +{ + "connector_type": "payment_processor", + "connector_name": "worldpayvantiv", + "connector_account_details": { + "auth_type": "SignatureKey", + "api_key": "u83996941026920501", + "key1": "010193081", + "api_secret": "qRfXV7aPcvkX6Fr" + }, + "payment_methods_enabled": [ + { + "payment_method_type": "card", + "payment_method_subtypes": [ + { + "payment_method_subtype": "credit", + "payment_experience": null, + "card_networks": [ + "Visa", + "Mastercard" + ], + "accepted_currencies": null, + "accepted_countries": null, + "minimum_amount": -1, + "maximum_amount": 68607706, + "recurring_enabled": true, + "installment_payment_enabled": true + }, + { + "payment_method_subtype": "debit", + "payment_experience": null, + "card_networks": [ + "Visa", + "Mastercard" + ], + "accepted_currencies": null, + "accepted_countries": null, + "minimum_amount": -1, + "maximum_amount": 68607706, + "recurring_enabled": true, + "installment_payment_enabled": true + } + ] + } + ], + "frm_configs": null, + "connector_webhook_details": { + "merchant_secret": "" + }, + "metadata": { + "report_group": "Hello", + "merchant_config_currency": "USD" + }, + "profile_id": "pro_6BnIGqGPytQ3vwObbAw6" +}' +``` +### Billing Processor curl +``` +curl --location 'http://localhost:8080/v2/connector-accounts' \ +--header 'Content-Type: application/json' \ +--header 'Accept: application/json' \ +--header 'x-merchant-id: {{}}' \ +--header 'x-profile-id: {{}}' \ +--header 'Authorization: admin-api-key=test_admin' \ +--header 'api-key: {{}}' \ +--data '{ + "connector_type": "billing_processor", + "connector_name": "custombilling", + "connector_account_details": { + "auth_type": "NoKey" + }, + "feature_metadata" : { + "revenue_recovery" : { + "max_retry_count" : 9, + "billing_connector_retry_threshold" : 0, + "billing_account_reference" :{ + "{{connector_mca_id}}" : "{{connector_mca_id}}" + }, + "switch_payment_method_config" : { + "retry_threshold" : 0, + "time_threshold_after_creation": 0 + } + } + }, + "profile_id": "pro_6BnIGqGPytQ3vwObbAw6" +}' + +``` + + +### Api +``` +curl --location 'http://localhost:8080/v2/payments/recovery' \ +--header 'Authorization: api-key=dev_qHo39mf1hdLbY7GW7FOr89FaoCM1NQOdwPddWguUDI3RnsjQKPzG71uZIkuULDQu' \ +--header 'x-profile-id: pro_xsbw9tuM9f6whrwaZKC2' \ +--header 'x-merchant-id: cloth_seller_2px3Q1TUxtGOvO3Yzm0S' \ +--header 'Content-Type: application/json' \ +--header 'api-key: dev_qHo39mf1hdLbY7GW7FOr89FaoCM1NQOdwPddWguUDI3RnsjQKPzG71uZIkuULDQu' \ +--data '{ + "amount_details": { + "order_amount": 2250, + "currency": "USD" + }, + "merchant_reference_id": "1234567891", + "connector_transaction_id": "43255654", + "connector_customer_id": "526755", + "error": { + "code": "110", + "message": "Insufficient Funds" + }, + "billing": { + "address": { + "state": "CA", + "country": "US" + } + }, + "payment_method_type": "card", + "payment_method_sub_type": "credit", + "payment_method_data": { + "primary_processor_payment_method_token": "2541911049890008", + "additional_payment_method_info": { + "card_exp_month": "12", + "card_exp_year": "25", + "last_four_digits": 1997, + "card_network": "VISA", + "card_issuer": "Wells Fargo NA", + "card_type": "credit" + } + }, + "billing_started_at": "2024-05-29T08:10:58Z", + "transaction_created_at": "2024-05-29T08:10:58Z", + "attempt_status": "failure", + "action": "schedule_failed_payment", + "billing_merchant_connector_id": "mca_6y5xtQUL2tgnHbjS7Bai", + "payment_merchant_connector_id": "mca_OWLpnzoAxkhT1eZVJ3Q3" + }' +``` + +### Output +The payment processor token details is getting stored in redis. +Screenshot 2025-08-22 at 1 05 58 PM + + + +## Checklist + + +- [x] I formatted the code `cargo +nightly fmt --all` +- [x] addressed lints thrown by `cargo clippy` +- [x] I reviewed the submitted code +- [ ] I added unit tests for my changes where possible +COMMENTS: +- semanticdiff-com[bot]: Review changes with  SemanticDiff +
+Changed Files +
+ +| File | Status | +| :--- | :--- | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#crates/router/src/core/payments/transformers.rs)  [crates/router/src/core/payments/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#crates/router/src/core/payments/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#crates/router/src/core/payments/transformers.rs)  51% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#crates/router/src/core/revenue_recovery/transformers.rs)  [crates/router/src/core/revenue\_recovery/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#crates/router/src/core/revenue_recovery/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#crates/router/src/core/revenue_recovery/transformers.rs)  19% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#crates/router/src/workflows/revenue_recovery.rs)  [crates/router/src/workflows/revenue\_recovery\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#crates/router/src/workflows/revenue_recovery.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#crates/router/src/workflows/revenue_recovery.rs)  11% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#crates/router/src/types/storage/revenue_recovery.rs)  [crates/router/src/types/storage/revenue\_recovery\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#crates/router/src/types/storage/revenue_recovery.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#crates/router/src/types/storage/revenue_recovery.rs)  8% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#crates/router/src/core/webhooks/recovery_incoming.rs)  [crates/router/src/core/webhooks/recovery\_incoming\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#crates/router/src/core/webhooks/recovery_incoming.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#crates/router/src/core/webhooks/recovery_incoming.rs)  7% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#crates/hyperswitch_connectors/src/connectors/stripebilling/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/stripebilling/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#crates/hyperswitch_connectors/src/connectors/stripebilling/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#crates/hyperswitch_connectors/src/connectors/stripebilling/transformers.rs)  4% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#config/config.example.toml)  [config/config\.example\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#config/config.example.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#config/deployments/env_specific.toml)  [config/deployments/env\_specific\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#config/deployments/env_specific.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#config/deployments/integration_test.toml)  [config/deployments/integration\_test\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#config/deployments/integration_test.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#config/deployments/production.toml)  [config/deployments/production\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#config/deployments/production.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#config/deployments/sandbox.toml)  [config/deployments/sandbox\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#config/deployments/sandbox.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#config/development.toml)  [config/development\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#config/development.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#config/docker_compose.toml)  [config/docker\_compose\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#config/docker_compose.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/chargebee/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#crates/hyperswitch_connectors/src/connectors/recurly/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/recurly/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#crates/hyperswitch_connectors/src/connectors/recurly/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#crates/hyperswitch_connectors/src/connectors/recurly/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#crates/hyperswitch_domain_models/src/payments.rs)  [crates/hyperswitch\_domain\_models/src/payments\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#crates/hyperswitch_domain_models/src/payments.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#crates/hyperswitch_domain_models/src/payments.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#crates/hyperswitch_domain_models/src/revenue_recovery.rs)  [crates/hyperswitch\_domain\_models/src/revenue\_recovery\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#crates/hyperswitch_domain_models/src/revenue_recovery.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#crates/hyperswitch_domain_models/src/revenue_recovery.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#crates/hyperswitch_domain_models/src/router_response_types/revenue_recovery.rs)  [crates/hyperswitch\_domain\_models/src/router\_response\_types/revenue\_recovery\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#crates/hyperswitch_domain_models/src/router_response_types/revenue_recovery.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#crates/hyperswitch_domain_models/src/router_response_types/revenue_recovery.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#crates/router/src/core/errors.rs)  [crates/router/src/core/errors\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#crates/router/src/core/errors.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#crates/router/src/core/errors.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#crates/router/src/core/revenue_recovery/api.rs)  [crates/router/src/core/revenue\_recovery/api\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#crates/router/src/core/revenue_recovery/api.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#crates/router/src/core/revenue_recovery/api.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#crates/router/src/types/storage.rs)  [crates/router/src/types/storage\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#crates/router/src/types/storage.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#crates/router/src/types/storage.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#crates/router/src/types/storage/revenue_recovery_redis_operation.rs)  [crates/router/src/types/storage/revenue\_recovery\_redis\_operation\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#crates/router/src/types/storage/revenue_recovery_redis_operation.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#crates/router/src/types/storage/revenue_recovery_redis_operation.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#loadtest/config/development.toml)  [loadtest/config/development\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#loadtest/config/development.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#proto/recovery_decider.proto)  [proto/recovery\_decider\.proto](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8846/changes#proto/recovery_decider.proto) | Unsupported file format | + +
+- Aprabhat19: As discussed in the next PR can you also do the RedisMap changes, and while reading have a deserialisation logic where if you find a value without internal RedisMap , you read it as a Struct on the application's end else just read it as a HashMap +- srujanchikke [config/deployments/integration_test.toml:835]: nit : can change the names to +```suggestion +[revenue_recovery.card_config.amex] +max_retries_per_day = 3 +max_retries_last_30_days = 20 +``` +- srujanchikke [crates/hyperswitch_domain_models/src/payments.rs:759]: Why are you mapping this to default? +- srujanchikke [crates/hyperswitch_domain_models/src/router_response_types/revenue_recovery.rs:38]: If you are adding card info , can we remove card related fields from parent struct +- srujanchikke [crates/hyperswitch_connectors/src/connectors/recurly/transformers.rs:225]: card_isin, card network can be populated for all 3 connectors . + +- srujanchikke [crates/router/src/core/webhooks/recovery_incoming.rs:691]: We should only consider inserting in redis when application response is success. Can we use map_err ? +- srujanchikke [crates/router/src/core/webhooks/recovery_incoming.rs:962]: Don't you already have recovery_attempt in self ? +- srujanchikke [crates/router/src/types/storage/revenue_recovery_redis_operation.rs:35]: Can't this type be global id ? +- srujanchikke [config/deployments/integration_test.toml:842]: Make this optional and set actual values +- srujanchikke [crates/router/src/types/storage/revenue_recovery_redis_operation.rs:27]: Can you make them Secret ? +- srujanchikke [crates/router/src/types/storage/revenue_recovery_redis_operation.rs:411]: Can we delete this token before fetching all customer tokens ? +- srujanchikke [crates/router/src/workflows/revenue_recovery.rs:517]: import this at start of file + +- srujanchikke [crates/router/src/workflows/revenue_recovery.rs:543]: Should the locking be done before fetching ? +- srujanchikke [crates/router/src/workflows/revenue_recovery.rs:567]: Can this be optional instead ? + +- aniketburman014 [crates/router/src/types/storage/revenue_recovery_redis_operation.rs:411]: Currently the flow to delete is GetAll -> remove the psp token from the local list - > delete entire field from redis-> insert the remaining token +this is inefficient and we need to implement HDel command for redis +Can we pick this changes later ? +- aniketburman014 [config/deployments/integration_test.toml:842]: Will keep the max_daily_retry_count = retry_count_30_day for the ones who do not have daily limit. +- aniketburman014 [crates/router/src/core/webhooks/recovery_incoming.rs:962]: we have RevenueRecoveryAttemptData in self not revenue_recovery::RecoveryPaymentAttempt +- aniketburman014 [crates/hyperswitch_connectors/src/connectors/recurly/transformers.rs:225]: done +- aniketburman014 [crates/router/src/types/storage/revenue_recovery_redis_operation.rs:35]: done +- aniketburman014 [crates/router/src/workflows/revenue_recovery.rs:567]: done +- srujanchikke [crates/router/src/workflows/revenue_recovery.rs:716]: Why are we considering default value to be hard decline ? + +=== COMMIT === +SUBJECT: feat(revenue_recovery): Add redis-based payment processor token tracking for revenue recovery (#8846) +BODY: +Co-authored-by: Aniket Burman +Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> +Co-authored-by: chikke srujan <121822803+srujanchikke@users.noreply.github.com> +Co-authored-by: Aditya Chaurasia <113281443+AdityaKumaar21@users.noreply.github.com> + +=== FILES === +Summary: 24 files changed, +1364 -172 +- config/config.example.toml (+18 -0) +- config/deployments/env_specific.toml (+23 -0) +- config/deployments/integration_test.toml (+0 -5) +- config/deployments/production.toml (+1 -5) +- config/deployments/sandbox.toml (+0 -4) +- config/development.toml (+17 -0) +- config/docker_compose.toml (+18 -0) +- crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs (+18 -2) +- crates/hyperswitch_connectors/src/connectors/recurly/transformers.rs (+18 -2) +- crates/hyperswitch_connectors/src/connectors/stripebilling/transformers.rs (+20 -4) +- crates/hyperswitch_domain_models/src/payments.rs (+17 -2) +- crates/hyperswitch_domain_models/src/revenue_recovery.rs (+3 -6) +- crates/hyperswitch_domain_models/src/router_response_types/revenue_recovery.rs (+2 -4) +- crates/router/src/core/errors.rs (+2 -0) +- crates/router/src/core/payments/transformers.rs (+4 -1) +- crates/router/src/core/revenue_recovery/api.rs (+1 -1) +- crates/router/src/core/revenue_recovery/transformers.rs (+19 -4) +- crates/router/src/core/webhooks/recovery_incoming.rs (+98 -7) +- crates/router/src/types/storage.rs (+2 -0) +- crates/router/src/types/storage/revenue_recovery.rs (+32 -16) +- crates/router/src/types/storage/revenue_recovery_redis_operation.rs (+655 -0) +- crates/router/src/workflows/revenue_recovery.rs (+375 -107) +- loadtest/config/development.toml (+18 -0) +- proto/recovery_decider.proto (+3 -2) + +=== PATCH === +diff --git a/config/config.example.toml b/config/config.example.toml +index 00f7ba33..eb976ce8 100644 +--- a/config/config.example.toml ++++ b/config/config.example.toml +@@ -1179,6 +1179,24 @@ billing_connectors_which_requires_invoice_sync_call = "recurly" # List of billin + [revenue_recovery] + monitoring_threshold_in_seconds = 60 # 60 secs , threshold for monitoring the retry system + retry_algorithm_type = "cascading" # type of retry algorithm ++redis_ttl_in_seconds=3888000 # ttl for redis for storing payment processor token details ++ ++# Card specific configuration for Revenue Recovery ++[revenue_recovery.card_config.amex] ++max_retries_per_day = 20 ++max_retry_count_for_thirty_day = 20 ++ ++[revenue_recovery.card_config.mastercard] ++max_retries_per_day = 10 ++max_retry_count_for_thirty_day = 35 ++ ++[revenue_recovery.card_config.visa] ++max_retries_per_day = 20 ++max_retry_count_for_thirty_day = 20 ++ ++[revenue_recovery.card_config.discover] ++max_retries_per_day = 20 ++max_retry_count_for_thirty_day = 20 + + [revenue_recovery.recovery_timestamp] # Timestamp configuration for Revenue Recovery + initial_timestamp_in_hours = 1 # number of hours added to start time for Decider service of Revenue Recovery +diff --git a/config/deployments/env_specific.toml b/config/deployments/env_specific.toml +index 64db7079..40868da8 100644 +--- a/config/deployments/env_specific.toml ++++ b/config/deployments/env_specific.toml +@@ -386,6 +386,29 @@ base_url = "http://localhost:8000" # Unified Connector Service Base URL + connection_timeout = 10 # Connection Timeout Duration in Seconds + ucs_only_connectors = "paytm, phonepe" # Comma-separated list of connectors that use UCS only + ++[revenue_recovery] ++# monitoring threshold - 120 days ++monitoring_threshold_in_seconds = 10368000 ++retry_algorithm_type = "cascading" ++redis_ttl_in_seconds=3888000 ++ ++# Card specific configuration for Revenue Recovery ++[revenue_recovery.card_config.amex] ++max_retries_per_day = 20 ++max_retry_count_for_thirty_day = 20 ++ ++[revenue_recovery.card_config.mastercard] ++max_retries_per_day = 10 ++max_retry_count_for_thirty_day = 35 ++ ++[revenue_recovery.card_config.visa] ++max_retries_per_day = 20 ++max_retry_count_for_thirty_day = 20 ++ ++[revenue_recovery.card_config.discover] ++max_retries_per_day = 20 ++max_retry_count_for_thirty_day = 20 ++ + [revenue_recovery.recovery_timestamp] # Timestamp configuration for Revenue Recovery + initial_timestamp_in_hours = 1 # number of hours added to start time for Decider service of Revenue Recovery + +diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml +index 40a0bdb1..7ebb3e10 100644 +--- a/config/deployments/integration_test.toml ++++ b/config/deployments/integration_test.toml +@@ -850,11 +850,6 @@ billing_connectors_which_require_payment_sync = "stripebilling, recurly" + [billing_connectors_invoice_sync] + billing_connectors_which_requires_invoice_sync_call = "recurly" + +- +-[revenue_recovery] +-monitoring_threshold_in_seconds = 60 +-retry_algorithm_type = "cascading" +- + [authentication_providers] + click_to_pay = {connector_list = "adyen, cybersource, trustpay"} + +diff --git a/config/deployments/production.toml b/config/deployments/production.toml +index c4c37289..3cb914fd 100644 +--- a/config/deployments/production.toml ++++ b/config/deployments/production.toml +@@ -865,10 +865,6 @@ billing_connectors_which_requires_invoice_sync_call = "recurly" + [authentication_providers] + click_to_pay = {connector_list = "adyen, cybersource, trustpay"} + +- +-[revenue_recovery] +-monitoring_threshold_in_seconds = 60 +-retry_algorithm_type = "cascading" +- + [grpc_client.unified_connector_service] + ucs_only_connectors = "paytm, phonepe" # Comma-separated list of connectors that use UCS only ++ +diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml +index 171b4bf0..b91df6cf 100644 +--- a/config/deployments/sandbox.toml ++++ b/config/deployments/sandbox.toml +@@ -872,10 +872,6 @@ billing_connectors_which_requires_invoice_sync_call = "recurly" + [authentication_providers] + click_to_pay = {connector_list = "adyen, cybersource, trustpay"} + +-[revenue_recovery] +-monitoring_threshold_in_seconds = 60 +-retry_algorithm_type = "cascading" +- + [list_dispute_supported_connectors] + connector_list = "worldpayvantiv" + +diff --git a/config/development.toml b/config/development.toml +index a2d06e7d..02a5dce3 100644 +--- a/config/development.toml ++++ b/config/development.toml +@@ -1295,10 +1295,27 @@ ucs_only_connectors = "paytm, phonepe" # Comma-separated list of connectors t + [revenue_recovery] + monitoring_threshold_in_seconds = 60 + retry_algorithm_type = "cascading" ++redis_ttl_in_seconds=3888000 + + [revenue_recovery.recovery_timestamp] + initial_timestamp_in_hours = 1 + ++[revenue_recovery.card_config.amex] ++max_retries_per_day = 20 ++max_retry_count_for_thirty_day = 20 ++ ++[revenue_recovery.card_config.mastercard] ++max_retries_per_day = 10 ++max_retry_count_for_thirty_day = 35 ++ ++[revenue_recovery.card_config.visa] ++max_retries_per_day = 20 ++max_retry_count_for_thirty_day = 20 ++ ++[revenue_recovery.card_config.discover] ++max_retries_per_day = 20 ++max_retry_count_for_thirty_day = 20 ++ + [clone_connector_allowlist] + merchant_ids = "merchant_123, merchant_234" # Comma-separated list of allowed merchant IDs + connector_names = "stripe, adyen" # Comma-separated list of allowed connector names +diff --git a/config/docker_compose.toml b/config/docker_compose.toml +index 544caf4c..c60a2b03 100644 +--- a/config/docker_compose.toml ++++ b/config/docker_compose.toml +@@ -1197,6 +1197,24 @@ click_to_pay = {connector_list = "adyen, cybersource, trustpay"} + [revenue_recovery] + monitoring_threshold_in_seconds = 60 # threshold for monitoring the retry system + retry_algorithm_type = "cascading" # type of retry algorithm ++redis_ttl_in_seconds=3888000 # ttl for redis for storing payment processor token details ++ ++# Card specific configuration for Revenue Recovery ++[revenue_recovery.card_config.amex] ++max_retries_per_day = 20 ++max_retry_count_for_thirty_day = 20 ++ ++[revenue_recovery.card_config.mastercard] ++max_retries_per_day = 10 ++max_retry_count_for_thirty_day = 35 ++ ++[revenue_recovery.card_config.visa] ++max_retries_per_day = 20 ++max_retry_count_for_thirty_day = 20 ++ ++[revenue_recovery.card_config.discover] ++max_retries_per_day = 20 ++max_retry_count_for_thirty_day = 20 + + [clone_connector_allowlist] + merchant_ids = "merchant_123, merchant_234" # Comma-separated list of allowed merchant IDs +diff --git a/crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs b/crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs +index b8bf2db6..95f105c6 100644 +--- a/crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs +@@ -515,10 +515,26 @@ impl TryFrom for revenue_recovery::RevenueRecoveryAttemptD + retry_count, + invoice_next_billing_time, + invoice_billing_started_at_time, +- card_network: Some(payment_method_details.card.brand), +- card_isin: Some(payment_method_details.card.iin), + // This field is none because it is specific to stripebilling. + charge_id: None, ++ // Need to populate these card info field ++ card_info: api_models::payments::AdditionalCardInfo { ++ card_network: Some(payment_method_details.card.brand), ++ card_isin: Some(payment_method_details.card.iin), ++ card_issuer: None, ++ card_type: None, ++ card_issuing_country: None, ++ bank_code: None, ++ last4: None, ++ card_extended_bin: None, ++ card_exp_month: None, ++ card_exp_year: None, ++ card_holder_name: None, ++ payment_checks: None, ++ authentication_data: None, ++ is_regulated: None, ++ signature_network: None, ++ }, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/recurly/transformers.rs b/crates/hyperswitch_connectors/src/connectors/recurly/transformers.rs +index 42dfc3f8..7338500d 100644 +--- a/crates/hyperswitch_connectors/src/connectors/recurly/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/recurly/transformers.rs +@@ -204,10 +204,26 @@ impl + payment_method_type: common_enums::PaymentMethod::from( + item.response.payment_method.object, + ), +- card_network: Some(item.response.payment_method.card_type), +- card_isin: Some(item.response.payment_method.first_six), + // This none because this field is specific to stripebilling. + charge_id: None, ++ // Need to populate these card info field ++ card_info: api_models::payments::AdditionalCardInfo { ++ card_network: Some(item.response.payment_method.card_type), ++ card_isin: Some(item.response.payment_method.first_six), ++ card_issuer: None, ++ card_type: None, ++ card_issuing_country: None, ++ bank_code: None, ++ last4: None, ++ card_extended_bin: None, ++ card_exp_month: None, ++ card_exp_year: None, ++ card_holder_name: None, ++ payment_checks: None, ++ authentication_data: None, ++ is_regulated: None, ++ signature_network: None, ++ }, + }, + ), + ..item.data +diff --git a/crates/hyperswitch_connectors/src/connectors/stripebilling/transformers.rs b/crates/hyperswitch_connectors/src/connectors/stripebilling/transformers.rs +index ffabab2a..a5e4610f 100644 +--- a/crates/hyperswitch_connectors/src/connectors/stripebilling/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/stripebilling/transformers.rs +@@ -560,12 +560,28 @@ impl + payment_method_type: common_enums::PaymentMethod::from( + charge_details.payment_method_details.type_of_payment_method, + ), +- card_network: Some(common_enums::CardNetwork::from( +- charge_details.payment_method_details.card_details.network, +- )), + // Todo: Fetch Card issuer details. Generally in the other billing connector we are getting card_issuer using the card bin info. But stripe dosent provide any such details. We should find a way for stripe billing case +- card_isin: None, + charge_id: Some(charge_details.charge_id.clone()), ++ // Need to populate these card info field ++ card_info: api_models::payments::AdditionalCardInfo { ++ card_network: Some(common_enums::CardNetwork::from( ++ charge_details.payment_method_details.card_details.network, ++ )), ++ card_isin: None, ++ card_issuer: None, ++ card_type: None, ++ card_issuing_country: None, ++ bank_code: None, ++ last4: None, ++ card_extended_bin: None, ++ card_exp_month: None, ++ card_exp_year: None, ++ card_holder_name: None, ++ payment_checks: None, ++ authentication_data: None, ++ is_regulated: None, ++ signature_network: None, ++ }, + }, + ), + ..item.data +diff --git a/crates/hyperswitch_domain_models/src/payments.rs b/crates/hyperswitch_domain_models/src/payments.rs +index 36eece96..0a63c036 100644 +--- a/crates/hyperswitch_domain_models/src/payments.rs ++++ b/crates/hyperswitch_domain_models/src/payments.rs +@@ -752,10 +752,25 @@ impl PaymentIntent { + retry_count: None, + invoice_next_billing_time: None, + invoice_billing_started_at_time: None, +- card_isin: None, +- card_network: None, + // No charge id is present here since it is an internal payment and we didn't call connector yet. + charge_id: None, ++ card_info: api_models::payments::AdditionalCardInfo { ++ card_issuer: None, ++ card_network: None, ++ card_type: None, ++ card_issuing_country: None, ++ bank_code: None, ++ last4: None, ++ card_isin: None, ++ card_extended_bin: None, ++ card_exp_month: None, ++ card_exp_year: None, ++ card_holder_name: None, ++ payment_checks: None, ++ authentication_data: None, ++ is_regulated: None, ++ signature_network: None, ++ }, + }) + } + +diff --git a/crates/hyperswitch_domain_models/src/revenue_recovery.rs b/crates/hyperswitch_domain_models/src/revenue_recovery.rs +index fd36c442..094905b1 100644 +--- a/crates/hyperswitch_domain_models/src/revenue_recovery.rs ++++ b/crates/hyperswitch_domain_models/src/revenue_recovery.rs +@@ -54,12 +54,10 @@ pub struct RevenueRecoveryAttemptData { + pub invoice_next_billing_time: Option, + /// Time at which the invoice created + pub invoice_billing_started_at_time: Option, +- /// card network type +- pub card_network: Option, +- /// card isin +- pub card_isin: Option, + /// stripe specific id used to validate duplicate attempts in revenue recovery flow + pub charge_id: Option, ++ /// Additional card details ++ pub card_info: api_payments::AdditionalCardInfo, + } + + /// This is unified struct for Revenue Recovery Invoice Data and it is constructed from billing connectors +@@ -227,10 +225,9 @@ impl + network_error_message: None, + retry_count: invoice_details.retry_count, + invoice_next_billing_time: invoice_details.next_billing_at, +- card_network: billing_connector_payment_details.card_network.clone(), +- card_isin: billing_connector_payment_details.card_isin.clone(), + charge_id: billing_connector_payment_details.charge_id.clone(), + invoice_billing_started_at_time: invoice_details.billing_started_at, ++ card_info: billing_connector_payment_details.card_info.clone(), + } + } + } +diff --git a/crates/hyperswitch_domain_models/src/router_response_types/revenue_recovery.rs b/crates/hyperswitch_domain_models/src/router_response_types/revenue_recovery.rs +index 3df81e6b..65a62f62 100644 +--- a/crates/hyperswitch_domain_models/src/router_response_types/revenue_recovery.rs ++++ b/crates/hyperswitch_domain_models/src/router_response_types/revenue_recovery.rs +@@ -28,12 +28,10 @@ pub struct BillingConnectorPaymentsSyncResponse { + pub payment_method_type: common_enums::enums::PaymentMethod, + /// payment method sub type of the payment attempt. + pub payment_method_sub_type: common_enums::enums::PaymentMethodType, +- /// card netword network +- pub card_network: Option, +- /// card isin +- pub card_isin: Option, + /// stripe specific id used to validate duplicate attempts. + pub charge_id: Option, ++ /// card information ++ pub card_info: api_models::payments::AdditionalCardInfo, + } + + #[derive(Debug, Clone)] +diff --git a/crates/router/src/core/errors.rs b/crates/router/src/core/errors.rs +index c8e7cb4e..bc8397b4 100644 +--- a/crates/router/src/core/errors.rs ++++ b/crates/router/src/core/errors.rs +@@ -496,4 +496,6 @@ pub enum RevenueRecoveryError { + RetryAlgorithmUpdationFailed, + #[error("Failed to create the revenue recovery attempt data")] + RevenueRecoveryAttemptDataCreateFailed, ++ #[error("Failed to insert the revenue recovery payment method data in redis")] ++ RevenueRecoveryRedisInsertFailed, + } +diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs +index 8a3594c3..cdd552da 100644 +--- a/crates/router/src/core/payments/transformers.rs ++++ b/crates/router/src/core/payments/transformers.rs +@@ -5508,7 +5508,10 @@ impl ForeignFrom<&hyperswitch_domain_models::payments::payment_attempt::PaymentA + created_at: attempt.created_at, + modified_at: attempt.modified_at, + cancellation_reason: attempt.cancellation_reason.clone(), +- payment_token: attempt.payment_token.clone(), ++ payment_token: attempt ++ .connector_token_details ++ .as_ref() ++ .and_then(|details| details.connector_mandate_id.clone()), + connector_metadata: attempt.connector_metadata.clone(), + payment_experience: attempt.payment_experience, + payment_method_type: attempt.payment_method_type, +diff --git a/crates/router/src/core/revenue_recovery/api.rs b/crates/router/src/core/revenue_recovery/api.rs +index b8f91203..d942db48 100644 +--- a/crates/router/src/core/revenue_recovery/api.rs ++++ b/crates/router/src/core/revenue_recovery/api.rs +@@ -1,5 +1,5 @@ + use actix_web::{web, Responder}; +-use api_models::payments as payments_api; ++use api_models::{payments as payments_api, payments as api_payments}; + use common_utils::id_type; + use error_stack::{report, FutureExt, ResultExt}; + use hyperswitch_domain_models::{ +diff --git a/crates/router/src/core/revenue_recovery/transformers.rs b/crates/router/src/core/revenue_recovery/transformers.rs +index b282ac1e..f78d496a 100644 +--- a/crates/router/src/core/revenue_recovery/transformers.rs ++++ b/crates/router/src/core/revenue_recovery/transformers.rs +@@ -107,10 +107,25 @@ impl ForeignFrom<&api_models::payments::RecoveryPaymentsCreate> + retry_count: None, + invoice_next_billing_time: None, + invoice_billing_started_at_time: data.billing_started_at, +- card_network: card_info +- .as_ref() +- .and_then(|info| info.card_network.clone()), +- card_isin: card_info.as_ref().and_then(|info| info.card_isin.clone()), ++ card_info: card_info ++ .cloned() ++ .unwrap_or(api_models::payments::AdditionalCardInfo { ++ card_issuer: None, ++ card_network: None, ++ card_type: None, ++ card_issuing_country: None, ++ bank_code: None, ++ last4: None, ++ card_isin: None, ++ card_extended_bin: None, ++ card_exp_month: None, ++ card_exp_year: None, ++ card_holder_name: None, ++ payment_checks: None, ++ authentication_data: None, ++ is_regulated: None, ++ signature_network: None, ++ }), + charge_id: None, + } + } +diff --git a/crates/router/src/core/webhooks/recovery_incoming.rs b/crates/router/src/core/webhooks/recovery_incoming.rs +index 32cb5552..5f00dd0c 100644 +--- a/crates/router/src/core/webhooks/recovery_incoming.rs ++++ b/crates/router/src/core/webhooks/recovery_incoming.rs +@@ -1,4 +1,4 @@ +-use std::{marker::PhantomData, str::FromStr}; ++use std::{collections::HashMap, marker::PhantomData, str::FromStr}; + + use api_models::{enums as api_enums, payments as api_payments, webhooks}; + use common_utils::{ +@@ -30,11 +30,19 @@ use crate::{ + connector_integration_interface::{self, RouterDataConversion}, + }, + types::{ +- self, api, domain, storage::revenue_recovery as storage_churn_recovery, ++ self, api, domain, ++ storage::{ ++ revenue_recovery as storage_revenue_recovery, ++ revenue_recovery_redis_operation::{ ++ PaymentProcessorTokenDetails, PaymentProcessorTokenStatus, RedisTokenManager, ++ }, ++ }, + transformers::ForeignFrom, + }, + workflows::revenue_recovery as revenue_recovery_flow, + }; ++#[cfg(feature = "v2")] ++pub const REVENUE_RECOVERY: &str = "revenue_recovery"; + + #[allow(clippy::too_many_arguments)] + #[instrument(skip_all)] +@@ -617,14 +625,15 @@ impl RevenueRecoveryAttempt { + errors::RevenueRecoveryError, + > { + let payment_connector_id = payment_connector_account.as_ref().map(|account: &hyperswitch_domain_models::merchant_connector_account::MerchantConnectorAccount| account.id.clone()); ++ let payment_connector_name = payment_connector_account ++ .as_ref() ++ .map(|account| account.connector_name); + let request_payload: api_payments::PaymentsAttemptRecordRequest = self + .create_payment_record_request( + state, + billing_connector_account_id, + payment_connector_id, +- payment_connector_account +- .as_ref() +- .map(|account| account.connector_name), ++ payment_connector_name, + common_enums::TriggeredBy::External, + ) + .await?; +@@ -685,6 +694,16 @@ impl RevenueRecoveryAttempt { + + let response = (recovery_attempt, updated_recovery_intent); + ++ self.store_payment_processor_tokens_in_redis(state, &response.0, payment_connector_name) ++ .await ++ .map_err(|e| { ++ router_env::logger::error!( ++ "Failed to store payment processor tokens in Redis: {:?}", ++ e ++ ); ++ errors::RevenueRecoveryError::RevenueRecoveryRedisInsertFailed ++ })?; ++ + Ok(response) + } + +@@ -709,6 +728,7 @@ impl RevenueRecoveryAttempt { + }; + + let card_info = revenue_recovery_attempt_data ++ .card_info + .card_isin + .clone() + .async_and_then(|isin| async move { +@@ -755,7 +775,7 @@ impl RevenueRecoveryAttempt { + invoice_billing_started_at_time: revenue_recovery_attempt_data + .invoice_billing_started_at_time, + triggered_by, +- card_network: revenue_recovery_attempt_data.card_network.clone(), ++ card_network: revenue_recovery_attempt_data.card_info.card_network.clone(), + card_issuer, + }) + } +@@ -899,7 +919,7 @@ impl RevenueRecoveryAttempt { + .attach_printable("payment attempt id is required for pcr workflow tracking")?; + + let execute_workflow_tracking_data = +- storage_churn_recovery::RevenueRecoveryWorkflowTrackingData { ++ storage_revenue_recovery::RevenueRecoveryWorkflowTrackingData { + billing_mca_id: billing_mca_id.clone(), + global_payment_id: payment_id.clone(), + merchant_id, +@@ -934,6 +954,77 @@ impl RevenueRecoveryAttempt { + status: payment_intent.status, + }) + } ++ ++ /// Store payment processor tokens in Redis for retry management ++ async fn store_payment_processor_tokens_in_redis( ++ &self, ++ state: &SessionState, ++ recovery_attempt: &revenue_recovery::RecoveryPaymentAttempt, ++ payment_connector_name: Option, ++ ) -> CustomResult<(), errors::RevenueRecoveryError> { ++ let revenue_recovery_attempt_data = &self.0; ++ let error_code = revenue_recovery_attempt_data.error_code.clone(); ++ let error_message = revenue_recovery_attempt_data.error_message.clone(); ++ let connector_name = payment_connector_name ++ .ok_or(errors::RevenueRecoveryError::TransactionWebhookProcessingFailed) ++ .attach_printable("unable to derive payment connector")? ++ .to_string(); ++ ++ let gsm_record = helpers::get_gsm_record( ++ state, ++ error_code.clone(), ++ error_message, ++ connector_name, ++ REVENUE_RECOVERY.to_string(), ++ ) ++ .await; ++ ++ let is_hard_decline = gsm_record ++ .and_then(|record| record.error_category) ++ .map(|category| category == common_enums::ErrorCategory::HardDecline) ++ .unwrap_or(false); ++ ++ // Extract required fields from the revenue recovery attempt data ++ let connector_customer_id = revenue_recovery_attempt_data.connector_customer_id.clone(); ++ ++ let attempt_id = recovery_attempt.attempt_id.clone(); ++ let token_unit = PaymentProcessorTokenStatus { ++ error_code, ++ inserted_by_attempt_id: attempt_id.clone(), ++ daily_retry_history: HashMap::from([(recovery_attempt.created_at.date(), 1)]), ++ scheduled_at: None, ++ is_hard_decline: Some(is_hard_decline), ++ payment_processor_token_details: PaymentProcessorTokenDetails { ++ payment_processor_token: revenue_recovery_attempt_data ++ .processor_payment_method_token ++ .clone(), ++ expiry_month: revenue_recovery_attempt_data ++ .card_info ++ .card_exp_month ++ .clone(), ++ expiry_year: revenue_recovery_attempt_data ++ .card_info ++ .card_exp_year ++ .clone(), ++ card_issuer: revenue_recovery_attempt_data.card_info.card_issuer.clone(), ++ last_four_digits: revenue_recovery_attempt_data.card_info.last4.clone(), ++ card_network: revenue_recovery_attempt_data.card_info.card_network.clone(), ++ card_type: revenue_recovery_attempt_data.card_info.card_type.clone(), ++ }, ++ }; ++ ++ // Make the Redis call to store tokens ++ RedisTokenManager::upsert_payment_processor_token( ++ state, ++ &connector_customer_id, ++ token_unit, ++ ) ++ .await ++ .change_context(errors::RevenueRecoveryError::RevenueRecoveryRedisInsertFailed) ++ .attach_printable("Failed to store payment processor tokens in Redis")?; ++ ++ Ok(()) ++ } + } + + pub struct BillingConnectorPaymentsSyncResponseData( +diff --git a/crates/router/src/types/storage.rs b/crates/router/src/types/storage.rs +index 341f9327..70a0a344 100644 +--- a/crates/router/src/types/storage.rs ++++ b/crates/router/src/types/storage.rs +@@ -36,6 +36,8 @@ pub mod payouts; + pub mod refund; + #[cfg(feature = "v2")] + pub mod revenue_recovery; ++#[cfg(feature = "v2")] ++pub mod revenue_recovery_redis_operation; + pub mod reverse_lookup; + pub mod role; + pub mod routing_algorithm; +diff --git a/crates/router/src/types/storage/revenue_recovery.rs b/crates/router/src/types/storage/revenue_recovery.rs +index 1c1a076f..81a012ba 100644 +--- a/crates/router/src/types/storage/revenue_recovery.rs ++++ b/crates/router/src/types/storage/revenue_recovery.rs +@@ -1,7 +1,8 @@ +-use std::fmt::Debug; ++use std::{collections::HashMap, fmt::Debug}; + +-use common_enums::enums; ++use common_enums::enums::{self, CardNetwork}; + use common_utils::{date_time, ext_traits::ValueExt, id_type}; ++use error_stack::ResultExt; + use external_services::grpc_client::{self as external_grpc_client, GrpcHeaders}; + use hyperswitch_domain_models::{ + business_profile, merchant_account, merchant_connector_account, merchant_key_store, +@@ -10,6 +11,7 @@ use hyperswitch_domain_models::{ + }; + use masking::PeekInterface; + use router_env::logger; ++use serde::{Deserialize, Serialize}; + + use crate::{db::StorageInterface, routes::SessionState, workflows::revenue_recovery}; + #[derive(serde::Serialize, serde::Deserialize, Debug)] +@@ -53,20 +55,7 @@ impl RevenueRecoveryPaymentData { + ) + .await + } +- enums::RevenueRecoveryAlgorithmType::Smart => { +- if is_hard_decline { +- None +- } else { +- // TODO: Integrate the smart retry call to return back a schedule time +- revenue_recovery::get_schedule_time_for_smart_retry( +- state, +- payment_attempt, +- payment_intent, +- retry_count, +- ) +- .await +- } +- } ++ enums::RevenueRecoveryAlgorithmType::Smart => None, + } + } + } +@@ -76,6 +65,8 @@ pub struct RevenueRecoverySettings { + pub monitoring_threshold_in_seconds: i64, + pub retry_algorithm_type: enums::RevenueRecoveryAlgorithmType, + pub recovery_timestamp: RecoveryTimestamp, ++ pub card_config: RetryLimitsConfig, ++ pub redis_ttl_in_seconds: i64, + } + + #[derive(Debug, serde::Deserialize, Clone)] +@@ -90,3 +81,28 @@ impl Default for RecoveryTimestamp { + } + } + } ++ ++#[derive(Debug, serde::Deserialize, Clone, Default)] ++pub struct RetryLimitsConfig(pub HashMap); ++ ++#[derive(Debug, serde::Deserialize, Clone, Default)] ++pub struct NetworkRetryConfig { ++ pub max_retries_per_day: i32, ++ pub max_retry_count_for_thirty_day: i32, ++} ++ ++impl RetryLimitsConfig { ++ pub fn get_network_config(&self, network: Option) -> &NetworkRetryConfig { ++ // Hardcoded fallback default config ++ static DEFAULT_CONFIG: NetworkRetryConfig = NetworkRetryConfig { ++ max_retries_per_day: 20, ++ max_retry_count_for_thirty_day: 20, ++ }; ++ ++ if let Some(net) = network { ++ self.0.get(&net).unwrap_or(&DEFAULT_CONFIG) ++ } else { ++ self.0.get(&CardNetwork::Visa).unwrap_or(&DEFAULT_CONFIG) ++ } ++ } ++} +diff --git a/crates/router/src/types/storage/revenue_recovery_redis_operation.rs b/crates/router/src/types/storage/revenue_recovery_redis_operation.rs +new file mode 100644 +index 00000000..433de9c2 +--- /dev/null ++++ b/crates/router/src/types/storage/revenue_recovery_redis_operation.rs +@@ -0,0 +1,655 @@ ++use std::collections::HashMap; ++ ++use common_enums::enums::CardNetwork; ++use common_utils::{date_time, errors::CustomResult, id_type}; ++use error_stack::ResultExt; ++use masking::Secret; ++use redis_interface::{DelReply, SetnxReply}; ++use router_env::{instrument, tracing}; ++use serde::{Deserialize, Serialize}; ++use time::{Date, Duration, OffsetDateTime, PrimitiveDateTime}; ++ ++use crate::{db::errors, SessionState}; ++ ++// Constants for retry window management ++const RETRY_WINDOW_DAYS: i32 = 30; ++const INITIAL_RETRY_COUNT: i32 = 0; ++ ++/// Payment processor token details including card information ++#[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq)] ++pub struct PaymentProcessorTokenDetails { ++ pub payment_processor_token: String, ++ pub expiry_month: Option>, ++ pub expiry_year: Option>, ++ pub card_issuer: Option, ++ pub last_four_digits: Option, ++ pub card_network: Option, ++ pub card_type: Option, ++} ++ ++/// Represents the status and retry history of a payment processor token ++#[derive(Debug, Clone, Serialize, Deserialize)] ++pub struct PaymentProcessorTokenStatus { ++ /// Payment processor token details including card information and token ID ++ pub payment_processor_token_details: PaymentProcessorTokenDetails, ++ /// Payment intent ID that originally inserted this token ++ pub inserted_by_attempt_id: id_type::GlobalAttemptId, ++ /// Error code associated with the token failure ++ pub error_code: Option, ++ /// Daily retry count history for the last 30 days (date -> retry_count) ++ pub daily_retry_history: HashMap, ++ /// Scheduled time for the next retry attempt ++ pub scheduled_at: Option, ++ /// Indicates if the token is a hard decline (no retries allowed) ++ pub is_hard_decline: Option, ++} ++ ++/// Token retry availability information with detailed wait times ++#[derive(Debug, Clone)] ++pub struct TokenRetryInfo { ++ pub monthly_wait_hours: i64, // Hours to wait for 30-day limit reset ++ pub daily_wait_hours: i64, // Hours to wait for daily limit reset ++ pub total_30_day_retries: i32, // Current total retry count in 30-day window ++} ++ ++/// Complete token information with retry limits and wait times ++#[derive(Debug, Clone)] ++pub struct PaymentProcessorTokenWithRetryInfo { ++ /// The complete token status information ++ pub token_status: PaymentProcessorTokenStatus, ++ /// Hours to wait before next retry attempt (max of daily/monthly wait) ++ pub retry_wait_time_hours: i64, ++ /// Number of retries remaining in the 30-day rolling window ++ pub monthly_retry_remaining: i32, ++} ++ ++/// Redis-based token management struct ++pub struct RedisTokenManager; ++ ++impl RedisTokenManager { ++ /// Lock connector customer ++ #[instrument(skip_all)] ++ pub async fn lock_connector_customer_status( ++ state: &SessionState, ++ connector_customer_id: &str, ++ payment_id: &id_type::GlobalPaymentId, ++ ) -> CustomResult { ++ let redis_conn = ++ state ++ .store ++ .get_redis_conn() ++ .change_context(errors::StorageError::RedisError( ++ errors::RedisError::RedisConnectionError.into(), ++ ))?; ++ ++ let lock_key = format!("customer:{connector_customer_id}:status"); ++ let seconds = &state.conf.revenue_recovery.redis_ttl_in_seconds; ++ ++ let result: bool = match redis_conn ++ .set_key_if_not_exists_with_expiry( ++ &lock_key.into(), ++ payment_id.get_string_repr(), ++ Some(*seconds), ++ ) ++ .await ++ { ++ Ok(resp) => resp == SetnxReply::KeySet, ++ Err(error) => { ++ tracing::error!(operation = "lock_stream", err = ?error); ++ false ++ } ++ }; ++ ++ tracing::debug!( ++ connector_customer_id = connector_customer_id, ++ payment_id = payment_id.get_string_repr(), ++ lock_acquired = %result, ++ "Connector customer lock attempt" ++ ); ++ ++ Ok(result) ++ } ++ ++ /// Unlock connector customer status ++ #[instrument(skip_all)] ++ pub async fn unlock_connector_customer_status( ++ state: &SessionState, ++ connector_customer_id: &str, ++ ) -> CustomResult { ++ let redis_conn = ++ state ++ .store ++ .get_redis_conn() ++ .change_context(errors::StorageError::RedisError( ++ errors::RedisError::RedisConnectionError.into(), ++ ))?; ++ ++ let lock_key = format!("customer:{connector_customer_id}:status"); ++ ++ match redis_conn.delete_key(&lock_key.into()).await { ++ Ok(DelReply::KeyDeleted) => { ++ tracing::debug!( ++ connector_customer_id = connector_customer_id, ++ "Connector customer unlocked" ++ ); ++ Ok(true) ++ } ++ Ok(DelReply::KeyNotDeleted) => { ++ tracing::debug!("Tried to unlock a stream which is already unlocked"); ++ Ok(false) ++ } ++ Err(err) => { ++ tracing::error!(?err, "Failed to delete lock key"); ++ Ok(false) ++ } ++ } ++ } ++ ++ /// Get all payment processor tokens for a connector customer ++ #[instrument(skip_all)] ++ pub async fn get_connector_customer_payment_processor_tokens( ++ state: &SessionState, ++ connector_customer_id: &str, ++ ) -> CustomResult, errors::StorageError> { ++ let redis_conn = ++ state ++ .store ++ .get_redis_conn() ++ .change_context(errors::StorageError::RedisError( ++ errors::RedisError::RedisConnectionError.into(), ++ ))?; ++ let tokens_key = format!("customer:{connector_customer_id}:tokens"); ++ ++ let get_hash_err = ++ errors::StorageError::RedisError(errors::RedisError::GetHashFieldFailed.into()); ++ ++ let payment_processor_tokens: HashMap = redis_conn ++ .get_hash_fields(&tokens_key.into()) ++ .await ++ .change_context(get_hash_err)?; ++ ++ // build the result map using iterator adapters (explicit match preserved for logging) ++ let payment_processor_token_info_map: HashMap = ++ payment_processor_tokens ++ .into_iter() ++ .filter_map(|(token_id, token_data)| { ++ match serde_json::from_str::(&token_data) { ++ Ok(token_status) => Some((token_id, token_status)), ++ Err(err) => { ++ tracing::warn!( ++ connector_customer_id = %connector_customer_id, ++ token_id = %token_id, ++ error = %err, ++ "Failed to deserialize token data, skipping", ++ ); ++ None ++ } ++ } ++ }) ++ .collect(); ++ tracing::debug!( ++ connector_customer_id = connector_customer_id, ++ "Fetched payment processor tokens", ++ ); ++ ++ Ok(payment_processor_token_info_map) ++ } ++ ++ /// Update connector customer payment processor tokens or add if doesn't exist ++ #[instrument(skip_all)] ++ pub async fn update_or_add_connector_customer_payment_processor_tokens( ++ state: &SessionState, ++ connector_customer_id: &str, ++ payment_processor_token_info_map: HashMap, ++ ) -> CustomResult<(), errors::StorageError> { ++ let redis_conn = ++ state ++ .store ++ .get_redis_conn() ++ .change_context(errors::StorageError::RedisError( ++ errors::RedisError::RedisConnectionError.into(), ++ ))?; ++ let tokens_key = format!("customer:{connector_customer_id}:tokens"); ++ ++ // allocate capacity up-front to avoid rehashing ++ let mut serialized_payment_processor_tokens: HashMap = ++ HashMap::with_capacity(payment_processor_token_info_map.len()); ++ ++ // serialize all tokens, preserving explicit error handling and attachable diagnostics ++ for (payment_processor_token_id, payment_processor_token_status) in ++ payment_processor_token_info_map ++ { ++ let serialized = serde_json::to_string(&payment_processor_token_status) ++ .change_context(errors::StorageError::SerializationFailed) ++ .attach_printable("Failed to serialize token status")?; ++ ++ serialized_payment_processor_tokens.insert(payment_processor_token_id, serialized); ++ } ++ let seconds = &state.conf.revenue_recovery.redis_ttl_in_seconds; ++ ++ // Update or add tokens ++ redis_conn ++ .set_hash_fields( ++ &tokens_key.into(), ++ serialized_payment_processor_tokens, ++ Some(*seconds), ++ ) ++ .await ++ .change_context(errors::StorageError::RedisError( ++ errors::RedisError::SetHashFieldFailed.into(), ++ ))?; ++ ++ tracing::info!( ++ connector_customer_id = %connector_customer_id, ++ "Successfully updated or added customer tokens", ++ ); ++ ++ Ok(()) ++ } ++ ++ /// Get current date in `yyyy-mm-dd` format. ++ pub fn get_current_date() -> String { ++ let today = date_time::now().date(); ++ ++ let (year, month, day) = (today.year(), today.month(), today.day()); ++ ++ format!("{year:04}-{month:02}-{day:02}",) ++ } ++ ++ /// Normalize retry window to exactly `RETRY_WINDOW_DAYS` days (today to `RETRY_WINDOW_DAYS - 1` days ago). ++ pub fn normalize_retry_window( ++ payment_processor_token: &mut PaymentProcessorTokenStatus, ++ today: Date, ++ ) { ++ let mut normalized_retry_history: HashMap = HashMap::new(); ++ ++ for days_ago in 0..RETRY_WINDOW_DAYS { ++ let date = today - Duration::days(days_ago.into()); ++ ++ payment_processor_token ++ .daily_retry_history ++ .get(&date) ++ .map(|&retry_count| { ++ normalized_retry_history.insert(date, retry_count); ++ }); ++ } ++ ++ payment_processor_token.daily_retry_history = normalized_retry_history; ++ } ++ ++ /// Get all payment processor tokens with retry information and wait times. ++ pub fn get_tokens_with_retry_metadata( ++ state: &SessionState, ++ payment_processor_token_info_map: &HashMap, ++ ) -> HashMap { ++ let today = OffsetDateTime::now_utc().date(); ++ let card_config = &state.conf.revenue_recovery.card_config; ++ ++ let mut result: HashMap = ++ HashMap::with_capacity(payment_processor_token_info_map.len()); ++ ++ for (payment_processor_token_id, payment_processor_token_status) in ++ payment_processor_token_info_map.iter() ++ { ++ let card_network = payment_processor_token_status ++ .payment_processor_token_details ++ .card_network ++ .clone(); ++ ++ // Calculate retry information. ++ let retry_info = Self::payment_processor_token_retry_info( ++ state, ++ payment_processor_token_status, ++ today, ++ card_network.clone(), ++ ); ++ ++ // Determine the wait time (max of monthly and daily wait hours). ++ let retry_wait_time_hours = retry_info ++ .monthly_wait_hours ++ .max(retry_info.daily_wait_hours); ++ ++ // Obtain network-specific limits and compute remaining monthly retries. ++ let card_network_config = card_config.get_network_config(card_network); ++ ++ let monthly_retry_remaining = card_network_config ++ .max_retry_count_for_thirty_day ++ .saturating_sub(retry_info.total_30_day_retries); ++ ++ // Build the per-token result struct. ++ let token_with_retry_info = PaymentProcessorTokenWithRetryInfo { ++ token_status: payment_processor_token_status.clone(), ++ retry_wait_time_hours, ++ monthly_retry_remaining, ++ }; ++ ++ result.insert(payment_processor_token_id.clone(), token_with_retry_info); ++ } ++ tracing::debug!("Fetched payment processor tokens with retry metadata",); ++ ++ result ++ } ++ ++ /// Sum retries over exactly the last 30 days ++ fn calculate_total_30_day_retries(token: &PaymentProcessorTokenStatus, today: Date) -> i32 { ++ (0..RETRY_WINDOW_DAYS) ++ .map(|i| { ++ let date = today - Duration::days(i.into()); ++ token ++ .daily_retry_history ++ .get(&date) ++ .copied() ++ .unwrap_or(INITIAL_RETRY_COUNT) ++ }) ++ .sum() ++ } ++ ++ /// Calculate wait hours ++ fn calculate_wait_hours(target_date: Date, now: OffsetDateTime) -> i64 { ++ let expiry_time = target_date.midnight().assume_utc(); ++ (expiry_time - now).whole_hours().max(0) ++ } ++ ++ /// Calculate retry counts for exactly the last 30 days ++ pub fn payment_processor_token_retry_info( ++ state: &SessionState, ++ token: &PaymentProcessorTokenStatus, ++ today: Date, ++ network_type: Option, ++ ) -> TokenRetryInfo { ++ let card_config = &state.conf.revenue_recovery.card_config; ++ let card_network_config = card_config.get_network_config(network_type); ++ ++ let now = OffsetDateTime::now_utc(); ++ ++ let total_30_day_retries = Self::calculate_total_30_day_retries(token, today); ++ ++ let monthly_wait_hours = ++ if total_30_day_retries >= card_network_config.max_retry_count_for_thirty_day { ++ (0..RETRY_WINDOW_DAYS) ++ .map(|i| today - Duration::days(i.into())) ++ .find(|date| token.daily_retry_history.get(date).copied().unwrap_or(0) > 0) ++ .map(|date| Self::calculate_wait_hours(date + Duration::days(31), now)) ++ .unwrap_or(0) ++ } else { ++ 0 ++ }; ++ ++ let today_retries = token ++ .daily_retry_history ++ .get(&today) ++ .copied() ++ .unwrap_or(INITIAL_RETRY_COUNT); ++ ++ let daily_wait_hours = if today_retries >= card_network_config.max_retries_per_day { ++ Self::calculate_wait_hours(today + Duration::days(1), now) ++ } else { ++ 0 ++ }; ++ ++ TokenRetryInfo { ++ monthly_wait_hours, ++ daily_wait_hours, ++ total_30_day_retries, ++ } ++ } ++ ++ // Upsert payment processor token ++ #[instrument(skip_all)] ++ pub async fn upsert_payment_processor_token( ++ state: &SessionState, ++ connector_customer_id: &str, ++ token_data: PaymentProcessorTokenStatus, ++ ) -> CustomResult { ++ let mut token_map = ++ Self::get_connector_customer_payment_processor_tokens(state, connector_customer_id) ++ .await?; ++ ++ let token_id = token_data ++ .payment_processor_token_details ++ .payment_processor_token ++ .clone(); ++ ++ let was_existing = token_map.contains_key(&token_id); ++ ++ let error_code = token_data.error_code.clone(); ++ let today = OffsetDateTime::now_utc().date(); ++ ++ token_map ++ .get_mut(&token_id) ++ .map(|existing_token| { ++ error_code.map(|err| existing_token.error_code = Some(err)); ++ ++ Self::normalize_retry_window(existing_token, today); ++ ++ for (date, &value) in &token_data.daily_retry_history { ++ existing_token ++ .daily_retry_history ++ .entry(*date) ++ .and_modify(|v| *v += value) ++ .or_insert(value); ++ } ++ }) ++ .or_else(|| { ++ token_map.insert(token_id.clone(), token_data); ++ None ++ }); ++ ++ Self::update_or_add_connector_customer_payment_processor_tokens( ++ state, ++ connector_customer_id, ++ token_map, ++ ) ++ .await?; ++ tracing::debug!( ++ connector_customer_id = connector_customer_id, ++ "Upsert payment processor tokens", ++ ); ++ ++ Ok(!was_existing) ++ } ++ ++ // Update payment processor token error code with billing connector response ++ #[instrument(skip_all)] ++ pub async fn update_payment_processor_token_error_code_from_process_tracker( ++ state: &SessionState, ++ connector_customer_id: &str, ++ error_code: &Option, ++ is_hard_decline: &Option, ++ ) -> CustomResult { ++ let today = OffsetDateTime::now_utc().date(); ++ let updated_token = ++ Self::get_connector_customer_payment_processor_tokens(state, connector_customer_id) ++ .await? ++ .values() ++ .find(|status| status.scheduled_at.is_some()) ++ .map(|status| PaymentProcessorTokenStatus { ++ payment_processor_token_details: status.payment_processor_token_details.clone(), ++ inserted_by_attempt_id: status.inserted_by_attempt_id.clone(), ++ error_code: error_code.clone(), ++ daily_retry_history: status.daily_retry_history.clone(), ++ scheduled_at: None, ++ is_hard_decline: *is_hard_decline, ++ }); ++ ++ match updated_token { ++ Some(mut token) => { ++ Self::normalize_retry_window(&mut token, today); ++ ++ match token.error_code { ++ None => token.daily_retry_history.clear(), ++ Some(_) => { ++ let current_count = token ++ .daily_retry_history ++ .get(&today) ++ .copied() ++ .unwrap_or(INITIAL_RETRY_COUNT); ++ token.daily_retry_history.insert(today, current_count + 1); ++ } ++ } ++ ++ let mut tokens_map = HashMap::new(); ++ tokens_map.insert( ++ token ++ .payment_processor_token_details ++ .payment_processor_token ++ .clone(), ++ token.clone(), ++ ); ++ ++ Self::update_or_add_connector_customer_payment_processor_tokens( ++ state, ++ connector_customer_id, ++ tokens_map, ++ ) ++ .await?; ++ tracing::debug!( ++ connector_customer_id = connector_customer_id, ++ "Updated payment processor tokens with error code", ++ ); ++ Ok(true) ++ } ++ None => { ++ tracing::debug!( ++ connector_customer_id = connector_customer_id, ++ "No Token found with scheduled time to update error code", ++ ); ++ Ok(false) ++ } ++ } ++ } ++ ++ // Update payment processor token schedule time ++ #[instrument(skip_all)] ++ pub async fn update_payment_processor_token_schedule_time( ++ state: &SessionState, ++ connector_customer_id: &str, ++ payment_processor_token: &str, ++ schedule_time: Option, ++ ) -> CustomResult { ++ let updated_token = ++ Self::get_connector_customer_payment_processor_tokens(state, connector_customer_id) ++ .await? ++ .values() ++ .find(|status| { ++ status ++ .payment_processor_token_details ++ .payment_processor_token ++ == payment_processor_token ++ }) ++ .map(|status| PaymentProcessorTokenStatus { ++ payment_processor_token_details: status.payment_processor_token_details.clone(), ++ inserted_by_attempt_id: status.inserted_by_attempt_id.clone(), ++ error_code: status.error_code.clone(), ++ daily_retry_history: status.daily_retry_history.clone(), ++ scheduled_at: schedule_time, ++ is_hard_decline: status.is_hard_decline, ++ }); ++ ++ match updated_token { ++ Some(token) => { ++ let mut tokens_map = HashMap::new(); ++ tokens_map.insert( ++ token ++ .payment_processor_token_details ++ .payment_processor_token ++ .clone(), ++ token.clone(), ++ ); ++ Self::update_or_add_connector_customer_payment_processor_tokens( ++ state, ++ connector_customer_id, ++ tokens_map, ++ ) ++ .await?; ++ tracing::debug!( ++ connector_customer_id = connector_customer_id, ++ "Updated payment processor tokens with schedule time", ++ ); ++ Ok(true) ++ } ++ None => { ++ tracing::debug!( ++ connector_customer_id = connector_customer_id, ++ "payment processor tokens with not found", ++ ); ++ Ok(false) ++ } ++ } ++ } ++ ++ // Get payment processor token with schedule time ++ #[instrument(skip_all)] ++ pub async fn get_payment_processor_token_with_schedule_time( ++ state: &SessionState, ++ connector_customer_id: &str, ++ ) -> CustomResult, errors::StorageError> { ++ let tokens = ++ Self::get_connector_customer_payment_processor_tokens(state, connector_customer_id) ++ .await?; ++ ++ let scheduled_token = tokens ++ .values() ++ .find(|status| status.scheduled_at.is_some()) ++ .cloned(); ++ ++ tracing::debug!( ++ connector_customer_id = connector_customer_id, ++ "Fetched payment processor token with schedule time", ++ ); ++ ++ Ok(scheduled_token) ++ } ++ ++ // Get payment processor token with max retry remaining for cascading retry algorithm ++ #[instrument(skip_all)] ++ pub async fn get_token_with_max_retry_remaining( ++ state: &SessionState, ++ connector_customer_id: &str, ++ ) -> CustomResult, errors::StorageError> { ++ // Get all tokens for the customer ++ let tokens_map = ++ Self::get_connector_customer_payment_processor_tokens(state, connector_customer_id) ++ .await?; ++ ++ // Tokens with retry metadata ++ let tokens_with_retry = Self::get_tokens_with_retry_metadata(state, &tokens_map); ++ ++ // Find the token with max retry remaining ++ let max_retry_token = tokens_with_retry ++ .into_iter() ++ .filter(|(_, token_info)| !token_info.token_status.is_hard_decline.unwrap_or(false)) ++ .max_by_key(|(_, token_info)| token_info.monthly_retry_remaining) ++ .map(|(_, token_info)| token_info); ++ ++ tracing::debug!( ++ connector_customer_id = connector_customer_id, ++ "Fetched payment processor token with max retry remaining", ++ ); ++ ++ Ok(max_retry_token) ++ } ++ ++ // Check if all tokens are hard declined or no token found for the customer ++ #[instrument(skip_all)] ++ pub async fn are_all_tokens_hard_declined( ++ state: &SessionState, ++ connector_customer_id: &str, ++ ) -> CustomResult { ++ let tokens_map = ++ Self::get_connector_customer_payment_processor_tokens(state, connector_customer_id) ++ .await?; ++ let all_hard_declined = tokens_map.is_empty() ++ && tokens_map ++ .values() ++ .all(|token| token.is_hard_decline.unwrap_or(false)); ++ ++ tracing::debug!( ++ connector_customer_id = connector_customer_id, ++ all_hard_declined, ++ "Checked if all tokens are hard declined or no token found for the customer", ++ ); ++ ++ Ok(all_hard_declined) ++ } ++} +diff --git a/crates/router/src/workflows/revenue_recovery.rs b/crates/router/src/workflows/revenue_recovery.rs +index c962aeb6..8f3b3f0e 100644 +--- a/crates/router/src/workflows/revenue_recovery.rs ++++ b/crates/router/src/workflows/revenue_recovery.rs +@@ -1,14 +1,19 @@ + #[cfg(feature = "v2")] +-use api_models::payments::PaymentsGetIntentRequest; ++use std::collections::HashMap; ++ ++#[cfg(feature = "v2")] ++use api_models::{enums::RevenueRecoveryAlgorithmType, payments::PaymentsGetIntentRequest}; + #[cfg(feature = "v2")] + use common_utils::{ ++ errors::CustomResult, ++ ext_traits::AsyncExt, + ext_traits::{StringExt, ValueExt}, + id_type, + }; + #[cfg(feature = "v2")] + use diesel_models::types::BillingConnectorPaymentMethodDetails; + #[cfg(feature = "v2")] +-use error_stack::ResultExt; ++use error_stack::{Report, ResultExt}; + #[cfg(all(feature = "revenue_recovery", feature = "v2"))] + use external_services::{ + date_time, grpc_client::revenue_recovery::recovery_decider_client as external_grpc_client, +@@ -16,21 +21,37 @@ use external_services::{ + #[cfg(feature = "v2")] + use hyperswitch_domain_models::{ + payment_method_data::PaymentMethodData, +- payments::{ +- payment_attempt::PaymentAttempt, PaymentConfirmData, PaymentIntent, PaymentIntentData, +- }, ++ payments::{payment_attempt, PaymentConfirmData, PaymentIntent, PaymentIntentData}, ++ router_flow_types, + router_flow_types::Authorize, + }; + #[cfg(feature = "v2")] + use masking::{ExposeInterface, PeekInterface, Secret}; + #[cfg(feature = "v2")] +-use router_env::logger; ++use router_env::{logger, tracing}; + use scheduler::{consumer::workflows::ProcessTrackerWorkflow, errors}; + #[cfg(feature = "v2")] + use scheduler::{types::process_data, utils as scheduler_utils}; + #[cfg(feature = "v2")] + use storage_impl::errors as storage_errors; ++#[cfg(feature = "v2")] ++use time::Date; + ++#[cfg(feature = "v2")] ++use crate::core::payments::operations; ++#[cfg(feature = "v2")] ++use crate::routes::app::ReqState; ++#[cfg(feature = "v2")] ++use crate::services; ++#[cfg(feature = "v2")] ++use crate::types::storage::{ ++ revenue_recovery::RetryLimitsConfig, ++ revenue_recovery_redis_operation::{ ++ PaymentProcessorTokenStatus, PaymentProcessorTokenWithRetryInfo, RedisTokenManager, ++ }, ++}; ++#[cfg(feature = "v2")] ++use crate::workflows::revenue_recovery::pcr::api; + #[cfg(feature = "v2")] + use crate::{ + core::{ +@@ -42,11 +63,16 @@ use crate::{ + types::{ + api::{self as api_types}, + domain, +- storage::revenue_recovery as pcr_storage_types, ++ storage::{ ++ revenue_recovery as pcr_storage_types, ++ revenue_recovery_redis_operation::PaymentProcessorTokenDetails, ++ }, + }, + }; + use crate::{routes::SessionState, types::storage}; + pub struct ExecutePcrWorkflow; ++#[cfg(feature = "v2")] ++pub const REVENUE_RECOVERY: &str = "revenue_recovery"; + + #[async_trait::async_trait] + impl ProcessTrackerWorkflow for ExecutePcrWorkflow { +@@ -218,21 +244,21 @@ pub(crate) async fn get_schedule_time_to_retry_mit_payments( + #[cfg(feature = "v2")] + pub(crate) async fn get_schedule_time_for_smart_retry( + state: &SessionState, +- payment_attempt: &PaymentAttempt, + payment_intent: &PaymentIntent, +- retry_count: i32, +-) -> Option { +- let first_error_message = match payment_attempt.error.as_ref() { +- Some(error) => error.message.clone(), +- None => { +- logger::error!( +- payment_intent_id = ?payment_intent.get_id(), +- attempt_id = ?payment_attempt.get_id(), +- "Payment attempt error information not found - cannot proceed with smart retry" +- ); +- return None; +- } +- }; ++ retry_after_time: Option, ++ token_with_retry_info: &PaymentProcessorTokenWithRetryInfo, ++) -> Result, errors::ProcessTrackerError> { ++ let card_config = &state.conf.revenue_recovery.card_config; ++ ++ // Not populating it right now ++ let first_error_message = "None".to_string(); ++ let retry_count_left = token_with_retry_info.monthly_retry_remaining; ++ let pg_error_code = token_with_retry_info.token_status.error_code.clone(); ++ ++ let card_info = token_with_retry_info ++ .token_status ++ .payment_processor_token_details ++ .clone(); + + let billing_state = payment_intent + .billing_address +@@ -241,54 +267,19 @@ pub(crate) async fn get_schedule_time_for_smart_retry( + .and_then(|details| details.state.as_ref()) + .cloned(); + +- // Check if payment_method_data itself is None +- if payment_attempt.payment_method_data.is_none() { +- logger::debug!( +- payment_intent_id = ?payment_intent.get_id(), +- attempt_id = ?payment_attempt.get_id(), +- message = "payment_attempt.payment_method_data is None" +- ); +- } +- +- let billing_connector_payment_method_details = payment_intent +- .feature_metadata +- .as_ref() +- .and_then(|revenue_recovery_data| { +- revenue_recovery_data +- .payment_revenue_recovery_metadata +- .as_ref() +- }) +- .and_then(|payment_metadata| { +- payment_metadata +- .billing_connector_payment_method_details +- .as_ref() +- }); +- + let revenue_recovery_metadata = payment_intent + .feature_metadata + .as_ref() + .and_then(|metadata| metadata.payment_revenue_recovery_metadata.as_ref()); + +- let card_network_str = billing_connector_payment_method_details +- .and_then(|details| match details { +- BillingConnectorPaymentMethodDetails::Card(card_info) => card_info.card_network.clone(), +- }) +- .map(|cn| cn.to_string()); ++ let card_network = card_info.card_network.clone(); ++ let total_retry_count_within_network = card_config.get_network_config(card_network.clone()); + +- let card_issuer_str = +- billing_connector_payment_method_details.and_then(|details| match details { +- BillingConnectorPaymentMethodDetails::Card(card_info) => card_info.card_issuer.clone(), +- }); ++ let card_network_str = card_network.map(|network| network.to_string()); + +- let card_funding_str = payment_intent +- .feature_metadata +- .as_ref() +- .and_then(|revenue_recovery_data| { +- revenue_recovery_data +- .payment_revenue_recovery_metadata +- .as_ref() +- }) +- .map(|payment_metadata| payment_metadata.payment_method_subtype.to_string()); ++ let card_issuer_str = card_info.card_issuer.clone(); ++ ++ let card_funding_str = card_info.card_type.clone(); + + let start_time_primitive = payment_intent.created_at; + let recovery_timestamp_config = &state.conf.revenue_recovery.recovery_timestamp; +@@ -296,6 +287,7 @@ pub(crate) async fn get_schedule_time_for_smart_retry( + let modified_start_time_primitive = start_time_primitive.saturating_add(time::Duration::hours( + recovery_timestamp_config.initial_timestamp_in_hours, + )); ++ + let start_time_proto = date_time::convert_to_prost_timestamp(modified_start_time_primitive); + + let merchant_id = Some(payment_intent.merchant_id.get_string_repr().to_string()); +@@ -321,33 +313,6 @@ pub(crate) async fn get_schedule_time_for_smart_retry( + .and_then(|details| details.city.as_ref()) + .cloned(); + +- let attempt_currency = Some(payment_intent.amount_details.currency.to_string()); +- let attempt_status = Some(payment_attempt.status.to_string()); +- let attempt_amount = Some( +- payment_attempt +- .amount_details +- .get_net_amount() +- .get_amount_as_i64(), +- ); +- let attempt_response_time = Some(date_time::convert_to_prost_timestamp( +- payment_attempt.created_at, +- )); +- let payment_method_type = Some(payment_attempt.payment_method_type.to_string()); +- let payment_gateway = payment_attempt.connector.clone(); +- +- let pg_error_code = payment_attempt +- .error +- .as_ref() +- .map(|error| error.code.clone()); +- let network_advice_code = payment_attempt +- .error +- .as_ref() +- .and_then(|error| error.network_advice_code.clone()); +- let network_error_code = payment_attempt +- .error +- .as_ref() +- .and_then(|error| error.network_decline_code.clone()); +- + let first_pg_error_code = revenue_recovery_metadata + .and_then(|metadata| metadata.first_payment_attempt_pg_error_code.clone()); + let first_network_advice_code = revenue_recovery_metadata +@@ -365,29 +330,37 @@ pub(crate) async fn get_schedule_time_for_smart_retry( + card_funding: card_funding_str, + card_network: card_network_str, + card_issuer: card_issuer_str, +- invoice_start_time: start_time_proto, +- retry_count: Some(retry_count.into()), ++ invoice_start_time: Some(start_time_proto), ++ retry_count: Some( ++ (total_retry_count_within_network.max_retry_count_for_thirty_day - retry_count_left) ++ .into(), ++ ), + merchant_id, + invoice_amount, + invoice_currency, + invoice_due_date, + billing_country, + billing_city, +- attempt_currency, +- attempt_status, +- attempt_amount, ++ attempt_currency: None, ++ attempt_status: None, ++ attempt_amount: None, + pg_error_code, +- network_advice_code, +- network_error_code, ++ network_advice_code: None, ++ network_error_code: None, + first_pg_error_code, + first_network_advice_code, + first_network_error_code, +- attempt_response_time, +- payment_method_type, +- payment_gateway, +- retry_count_left: None, ++ attempt_response_time: None, ++ payment_method_type: None, ++ payment_gateway: None, ++ retry_count_left: Some(retry_count_left.into()), ++ total_retry_count_within_network: Some( ++ total_retry_count_within_network ++ .max_retry_count_for_thirty_day ++ .into(), ++ ), + first_error_msg_time: None, +- wait_time: None, ++ wait_time: retry_after_time, + }; + + if let Some(mut client) = state.grpc_client.recovery_decider_client.clone() { +@@ -395,7 +368,7 @@ pub(crate) async fn get_schedule_time_for_smart_retry( + .decide_on_retry(decider_request.into(), state.get_recovery_grpc_headers()) + .await + { +- Ok(grpc_response) => grpc_response ++ Ok(grpc_response) => Ok(grpc_response + .retry_flag + .then_some(()) + .and(grpc_response.retry_time) +@@ -409,16 +382,16 @@ pub(crate) async fn get_schedule_time_for_smart_retry( + None // If conversion fails, treat as no valid retry time + } + } +- }), ++ })), + + Err(e) => { + logger::error!("Recovery decider gRPC call failed: {e:?}"); +- None ++ Ok(None) + } + } + } else { + logger::debug!("Recovery decider client is not configured"); +- None ++ Ok(None) + } + } + +@@ -430,7 +403,7 @@ struct InternalDeciderRequest { + card_funding: Option, + card_network: Option, + card_issuer: Option, +- invoice_start_time: prost_types::Timestamp, ++ invoice_start_time: Option, + retry_count: Option, + merchant_id: Option, + invoice_amount: Option, +@@ -451,6 +424,7 @@ struct InternalDeciderRequest { + payment_method_type: Option, + payment_gateway: Option, + retry_count_left: Option, ++ total_retry_count_within_network: Option, + first_error_msg_time: Option, + wait_time: Option, + } +@@ -464,7 +438,7 @@ impl From for external_grpc_client::DeciderRequest { + card_funding: internal_request.card_funding, + card_network: internal_request.card_network, + card_issuer: internal_request.card_issuer, +- invoice_start_time: Some(internal_request.invoice_start_time), ++ invoice_start_time: internal_request.invoice_start_time, + retry_count: internal_request.retry_count, + merchant_id: internal_request.merchant_id, + invoice_amount: internal_request.invoice_amount, +@@ -485,8 +459,302 @@ impl From for external_grpc_client::DeciderRequest { + payment_method_type: internal_request.payment_method_type, + payment_gateway: internal_request.payment_gateway, + retry_count_left: internal_request.retry_count_left, ++ total_retry_count_within_network: internal_request.total_retry_count_within_network, + first_error_msg_time: internal_request.first_error_msg_time, + wait_time: internal_request.wait_time, + } + } + } ++ ++#[cfg(feature = "v2")] ++#[derive(Debug, Clone)] ++pub struct ScheduledToken { ++ pub token_details: PaymentProcessorTokenDetails, ++ pub schedule_time: time::PrimitiveDateTime, ++} ++ ++#[cfg(feature = "v2")] ++pub async fn get_token_with_schedule_time_based_on_retry_alogrithm_type( ++ state: &SessionState, ++ connector_customer_id: &str, ++ payment_intent: &PaymentIntent, ++ retry_algorithm_type: RevenueRecoveryAlgorithmType, ++ retry_count: i32, ++) -> CustomResult, errors::ProcessTrackerError> { ++ let mut scheduled_time = None; ++ ++ match retry_algorithm_type { ++ RevenueRecoveryAlgorithmType::Monitoring => { ++ logger::error!("Monitoring type found for Revenue Recovery retry payment"); ++ } ++ ++ RevenueRecoveryAlgorithmType::Cascading => { ++ let time = get_schedule_time_to_retry_mit_payments( ++ state.store.as_ref(), ++ &payment_intent.merchant_id, ++ retry_count, ++ ) ++ .await ++ .ok_or(errors::ProcessTrackerError::EApiErrorResponse)?; ++ ++ scheduled_time = Some(time); ++ ++ let token = ++ RedisTokenManager::get_token_with_max_retry_remaining(state, connector_customer_id) ++ .await ++ .change_context(errors::ProcessTrackerError::EApiErrorResponse)?; ++ ++ match token { ++ Some(token) => { ++ RedisTokenManager::update_payment_processor_token_schedule_time( ++ state, ++ connector_customer_id, ++ &token ++ .token_status ++ .payment_processor_token_details ++ .payment_processor_token, ++ scheduled_time, ++ ) ++ .await ++ .change_context(errors::ProcessTrackerError::EApiErrorResponse)?; ++ ++ logger::debug!("PSP token available for cascading retry"); ++ } ++ None => { ++ logger::debug!("No PSP token available for cascading retry"); ++ scheduled_time = None; ++ } ++ } ++ } ++ ++ RevenueRecoveryAlgorithmType::Smart => { ++ scheduled_time = get_best_psp_token_available_for_smart_retry( ++ state, ++ connector_customer_id, ++ payment_intent, ++ ) ++ .await ++ .change_context(errors::ProcessTrackerError::EApiErrorResponse)?; ++ } ++ } ++ ++ Ok(scheduled_time) ++} ++ ++#[cfg(feature = "v2")] ++pub async fn get_best_psp_token_available_for_smart_retry( ++ state: &SessionState, ++ connector_customer_id: &str, ++ payment_intent: &PaymentIntent, ++) -> CustomResult, errors::ProcessTrackerError> { ++ // Lock using payment_id ++ let locked = RedisTokenManager::lock_connector_customer_status( ++ state, ++ connector_customer_id, ++ &payment_intent.id, ++ ) ++ .await ++ .change_context(errors::ProcessTrackerError::ERedisError( ++ errors::RedisError::RedisConnectionError.into(), ++ ))?; ++ ++ match !locked { ++ true => Ok(None), ++ ++ false => { ++ // Get existing tokens from Redis ++ let existing_tokens = ++ RedisTokenManager::get_connector_customer_payment_processor_tokens( ++ state, ++ connector_customer_id, ++ ) ++ .await ++ .change_context(errors::ProcessTrackerError::ERedisError( ++ errors::RedisError::RedisConnectionError.into(), ++ ))?; ++ ++ // TODO: Insert into payment_intent_feature_metadata (DB operation) ++ ++ let result = RedisTokenManager::get_tokens_with_retry_metadata(state, &existing_tokens); ++ ++ let best_token_time = call_decider_for_payment_processor_tokens_select_closet_time( ++ state, ++ &result, ++ payment_intent, ++ connector_customer_id, ++ ) ++ .await ++ .change_context(errors::ProcessTrackerError::EApiErrorResponse)?; ++ ++ Ok(best_token_time) ++ } ++ } ++} ++ ++#[cfg(feature = "v2")] ++pub async fn calculate_smart_retry_time( ++ state: &SessionState, ++ payment_intent: &PaymentIntent, ++ token_with_retry_info: &PaymentProcessorTokenWithRetryInfo, ++) -> Result, errors::ProcessTrackerError> { ++ let wait_hours = token_with_retry_info.retry_wait_time_hours; ++ let current_time = time::OffsetDateTime::now_utc(); ++ let future_time = current_time + time::Duration::hours(wait_hours); ++ ++ // Timestamp after which retry can be done without penalty ++ let future_timestamp = Some(prost_types::Timestamp { ++ seconds: future_time.unix_timestamp(), ++ nanos: 0, ++ }); ++ ++ get_schedule_time_for_smart_retry( ++ state, ++ payment_intent, ++ future_timestamp, ++ token_with_retry_info, ++ ) ++ .await ++} ++ ++#[cfg(feature = "v2")] ++async fn process_token_for_retry( ++ state: &SessionState, ++ token_with_retry_info: &PaymentProcessorTokenWithRetryInfo, ++ payment_intent: &PaymentIntent, ++) -> Result, errors::ProcessTrackerError> { ++ let token_status: &PaymentProcessorTokenStatus = &token_with_retry_info.token_status; ++ let inserted_by_attempt_id = &token_status.inserted_by_attempt_id; ++ ++ let skip = token_status.is_hard_decline.unwrap_or(false); ++ ++ match skip { ++ true => { ++ logger::info!( ++ "Skipping decider call due to hard decline for attempt_id: {}", ++ inserted_by_attempt_id.get_string_repr() ++ ); ++ Ok(None) ++ } ++ false => { ++ let schedule_time = ++ calculate_smart_retry_time(state, payment_intent, token_with_retry_info).await?; ++ Ok(schedule_time.map(|schedule_time| ScheduledToken { ++ token_details: token_status.payment_processor_token_details.clone(), ++ schedule_time, ++ })) ++ } ++ } ++} ++ ++#[cfg(feature = "v2")] ++#[allow(clippy::too_many_arguments)] ++pub async fn call_decider_for_payment_processor_tokens_select_closet_time( ++ state: &SessionState, ++ processor_tokens: &HashMap, ++ payment_intent: &PaymentIntent, ++ connector_customer_id: &str, ++) -> CustomResult, errors::ProcessTrackerError> { ++ tracing::debug!("Filtered payment attempts based on payment tokens",); ++ let mut tokens_with_schedule_time: Vec = Vec::new(); ++ ++ for token_with_retry_info in processor_tokens.values() { ++ let token_details = &token_with_retry_info ++ .token_status ++ .payment_processor_token_details; ++ let error_code = token_with_retry_info.token_status.error_code.clone(); ++ ++ match error_code { ++ None => { ++ let utc_schedule_time = ++ time::OffsetDateTime::now_utc() + time::Duration::minutes(1); ++ let schedule_time = time::PrimitiveDateTime::new( ++ utc_schedule_time.date(), ++ utc_schedule_time.time(), ++ ); ++ tokens_with_schedule_time = vec![ScheduledToken { ++ token_details: token_details.clone(), ++ schedule_time, ++ }]; ++ tracing::debug!( ++ "Found payment processor token with no error code scheduling it for {schedule_time}", ++ ); ++ break; ++ } ++ Some(_) => { ++ process_token_for_retry(state, token_with_retry_info, payment_intent) ++ .await? ++ .map(|token_with_schedule_time| { ++ tokens_with_schedule_time.push(token_with_schedule_time) ++ }); ++ } ++ } ++ } ++ ++ let best_token = tokens_with_schedule_time ++ .iter() ++ .min_by_key(|token| token.schedule_time) ++ .cloned(); ++ ++ match best_token { ++ None => { ++ RedisTokenManager::unlock_connector_customer_status(state, connector_customer_id) ++ .await ++ .change_context(errors::ProcessTrackerError::EApiErrorResponse)?; ++ tracing::debug!("No payment processor tokens available for scheduling"); ++ Ok(None) ++ } ++ ++ Some(token) => { ++ tracing::debug!("Found payment processor token with least schedule time"); ++ ++ RedisTokenManager::update_payment_processor_token_schedule_time( ++ state, ++ connector_customer_id, ++ &token.token_details.payment_processor_token, ++ Some(token.schedule_time), ++ ) ++ .await ++ .change_context(errors::ProcessTrackerError::EApiErrorResponse)?; ++ ++ Ok(Some(token.schedule_time)) ++ } ++ } ++} ++ ++#[cfg(feature = "v2")] ++pub async fn check_hard_decline( ++ state: &SessionState, ++ payment_attempt: &payment_attempt::PaymentAttempt, ++) -> Result> { ++ let error_message = payment_attempt ++ .error ++ .as_ref() ++ .map(|details| details.message.clone()); ++ ++ let error_code = payment_attempt ++ .error ++ .as_ref() ++ .map(|details| details.code.clone()); ++ ++ let connector_name = payment_attempt ++ .connector ++ .clone() ++ .ok_or(storage_impl::errors::RecoveryError::ValueNotFound) ++ .attach_printable("unable to derive payment connector from payment attempt")?; ++ ++ let gsm_record = payments::helpers::get_gsm_record( ++ state, ++ error_code, ++ error_message, ++ connector_name, ++ REVENUE_RECOVERY.to_string(), ++ ) ++ .await; ++ ++ let is_hard_decline = gsm_record ++ .and_then(|record| record.error_category) ++ .map(|category| category == common_enums::ErrorCategory::HardDecline) ++ .unwrap_or(false); ++ ++ Ok(is_hard_decline) ++} +diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml +index b49713eb..c42a880f 100644 +--- a/loadtest/config/development.toml ++++ b/loadtest/config/development.toml +@@ -786,3 +786,21 @@ billing_connectors_which_requires_invoice_sync_call = "recurly" + [chat] + enabled = false + hyperswitch_ai_host = "http://0.0.0.0:8000" ++ ++ ++ ++[revenue_recovery.card_config.amex] ++max_retries_per_day = 20 ++max_retry_count_for_thirty_day = 20 ++ ++[revenue_recovery.card_config.mastercard] ++max_retries_per_day = 10 ++max_retry_count_for_thirty_day = 35 ++ ++[revenue_recovery.card_config.visa] ++max_retries_per_day = 20 ++max_retry_count_for_thirty_day = 20 ++ ++[revenue_recovery.card_config.discover] ++max_retries_per_day = 20 ++max_retry_count_for_thirty_day = 20 +\ No newline at end of file +diff --git a/proto/recovery_decider.proto b/proto/recovery_decider.proto +index 28543b8f..b6346bc7 100644 +--- a/proto/recovery_decider.proto ++++ b/proto/recovery_decider.proto +@@ -35,8 +35,9 @@ message DeciderRequest { + optional string payment_method_type = 24; + optional string payment_gateway = 25; + optional int64 retry_count_left = 26; +- optional google.protobuf.Timestamp first_error_msg_time = 27; +- optional google.protobuf.Timestamp wait_time = 28; ++ optional int64 total_retry_count_within_network = 27; ++ optional google.protobuf.Timestamp first_error_msg_time = 28; ++ optional google.protobuf.Timestamp wait_time = 29; + } + + message DeciderResponse { + +----- END CHUNK ----- \ No newline at end of file diff --git a/raw/0b/0ba5d543496de040f637c5bf8d2529667d25e8a5.txt b/raw/0b/0ba5d543496de040f637c5bf8d2529667d25e8a5.txt new file mode 100644 index 0000000000000000000000000000000000000000..c314ac86dbd63870e8f6f3e5634ef080ce07e5a5 --- /dev/null +++ b/raw/0b/0ba5d543496de040f637c5bf8d2529667d25e8a5.txt @@ -0,0 +1,309 @@ +ROUTE: juspay/hyperswitch@0ba5d543496de040f637c5bf8d2529667d25e8a5 +REPO: https://github.com/juspay/hyperswitch +COMMIT: 0ba5d543496de040f637c5bf8d2529667d25e8a5 +AUTHOR: Ayush Anand <114248859+ayush22667@users.noreply.github.com> +DATE: 2025-08-22T13:05:42 + +=== ISSUE_AND_PR === +[PR #8999] feat(router): verify service for applepay merchant registration v2 +URL: https://github.com/juspay/hyperswitch/pull/8999 +BODY: +## Type of Change + + +- [ ] Bugfix +- [X] New feature +- [ ] Enhancement +- [ ] Refactoring +- [ ] Dependency updates +- [ ] Documentation +- [ ] CI/CD + +## Description + +Add Apple Pay merchant registration and verified domains retrieval for v2 + +### Additional Changes + +- [X] This PR modifies the API contract +- [ ] This PR modifies the database schema +- [ ] This PR modifies application configuration/environment variables + + + + +## Motivation and Context + + + + + +## How did you test it? + +Request: +``` +curl --location 'http://localhost:8080/v2/verify/apple-pay/cloth_seller_4hdx8pW2mxW0V6TZEQfm' \ +--header 'x-client-secret: cs_0198af34cbcd72d0becd4db96e800bd9' \ +--header 'x-profile-id: pro_833jt2bQKinLLA4pucBK' \ +--header 'Authorization: api-key=dev_WH5clkiXgFqCpCDr62FCsFnjcRDZzIdwbvuuLK3sjC0nR3g6YWUYWVkOOzlfhxpd' \ +--header 'Content-Type: application/json' \ +--header 'api-key: dev_WH5clkiXgFqCpCDr62FCsFnjcRDZzIdwbvuuLK3sjC0nR3g6YWUYWVkOOzlfhxpd' \ +--data '{ + "domain_names": ["hyperswitch-demo-store.netlify.app","sdk-test-app.netlify.app"], + "merchant_connector_account_id": "mca_zYpPX5yTd3vo5NeMn26P" + }' +``` +Response: +``` +{ + "status_message": "Applepay verification Completed" +} +``` +Request: +``` +curl --location 'http://localhost:8080/v2/verify/applepay-verified-domains?merchant_id=cloth_seller_4hdx8pW2mxW0V6TZEQfm&merchant_connector_account_id=mca_zYpPX5yTd3vo5NeMn26P' \ +--header 'x-profile-id: pro_833jt2bQKinLLA4pucBK' \ +--header 'Authorization: admin-api-key=test_admin' \ +--header 'api-key: dev_WH5clkiXgFqCpCDr62FCsFnjcRDZzIdwbvuuLK3sjC0nR3g6YWUYWVkOOzlfhxpd' \ +--data '' +``` +Response: +``` +{ + "verified_domains": [ + "hyperswitch-demo-store.netlify.app", + "sdk-test-app.netlify.app" + ] +} +``` +image +image + + + +closes #8998 + + +## Checklist + + +- [X] I formatted the code `cargo +nightly fmt --all` +- [X] I addressed lints thrown by `cargo clippy` +- [X] I reviewed the submitted code +- [ ] I added unit tests for my changes where possible +COMMENTS: +- semanticdiff-com[bot]: Review changes with  SemanticDiff +
+Changed Files +
+ +| File | Status | +| :--- | :--- | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8999/changes#crates/router/src/core/verification.rs)  [crates/router/src/core/verification\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8999/changes#crates/router/src/core/verification.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8999/changes#crates/router/src/core/verification.rs)  43% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8999/changes#crates/router/src/core/verification/utils.rs)  [crates/router/src/core/verification/utils\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8999/changes#crates/router/src/core/verification/utils.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8999/changes#crates/router/src/core/verification/utils.rs)  37% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8999/changes#crates/router/src/lib.rs)  [crates/router/src/lib\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8999/changes#crates/router/src/lib.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8999/changes#crates/router/src/lib.rs)  6% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8999/changes#crates/router/src/routes/app.rs)  [crates/router/src/routes/app\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8999/changes#crates/router/src/routes/app.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8999/changes#crates/router/src/routes/app.rs)  4% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8999/changes#crates/router/src/routes/verification.rs)  [crates/router/src/routes/verification\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8999/changes#crates/router/src/routes/verification.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8999/changes#crates/router/src/routes/verification.rs)  0% smaller | + +
+ +=== COMMIT === +SUBJECT: feat(router): verify service for applepay merchant registration v2 (#8999) + +=== FILES === +Summary: 5 files changed, +79 -14 +- crates/router/src/core/verification.rs (+10 -5) +- crates/router/src/core/verification/utils.rs (+9 -6) +- crates/router/src/lib.rs (+5 -1) +- crates/router/src/routes/app.rs (+17 -2) +- crates/router/src/routes/verification.rs (+38 -0) + +=== PATCH === +diff --git a/crates/router/src/core/verification.rs b/crates/router/src/core/verification.rs +index 3c1b95dd..f7ed33be 100644 +--- a/crates/router/src/core/verification.rs ++++ b/crates/router/src/core/verification.rs +@@ -117,11 +117,16 @@ pub async fn get_verified_apple_domains_with_mid_mca_id( + .unwrap_or_default(); + + #[cfg(feature = "v2")] +- let verified_domains = { +- let _ = merchant_connector_id; +- let _ = key_store; +- todo!() +- }; ++ let verified_domains = db ++ .find_merchant_connector_account_by_id( ++ key_manager_state, ++ &merchant_connector_id, ++ &key_store, ++ ) ++ .await ++ .change_context(errors::ApiErrorResponse::ResourceIdNotFound)? ++ .applepay_verified_domains ++ .unwrap_or_default(); + + Ok(services::api::ApplicationResponse::Json( + verifications::ApplepayVerifiedDomainsResponse { verified_domains }, +diff --git a/crates/router/src/core/verification/utils.rs b/crates/router/src/core/verification/utils.rs +index 81b91620..fb38d0a6 100644 +--- a/crates/router/src/core/verification/utils.rs ++++ b/crates/router/src/core/verification/utils.rs +@@ -43,12 +43,15 @@ pub async fn check_existence_and_add_domain_to_db( + .change_context(errors::ApiErrorResponse::InternalServerError)?; + + #[cfg(feature = "v2")] +- let merchant_connector_account: hyperswitch_domain_models::merchant_connector_account::MerchantConnectorAccount = { +- let _ = merchant_connector_id; +- let _ = key_store; +- let _ = domain_from_req; +- todo!() +- }; ++ let merchant_connector_account = state ++ .store ++ .find_merchant_connector_account_by_id( ++ key_manager_state, ++ &merchant_connector_id, ++ &key_store, ++ ) ++ .await ++ .change_context(errors::ApiErrorResponse::InternalServerError)?; + utils::validate_profile_id_from_auth_layer( + profile_id_from_auth_layer, + &merchant_connector_account, +diff --git a/crates/router/src/lib.rs b/crates/router/src/lib.rs +index 4584bee1..00df2908 100644 +--- a/crates/router/src/lib.rs ++++ b/crates/router/src/lib.rs +@@ -198,6 +198,11 @@ pub fn mk_app( + .service(routes::Routing::server(state.clone())) + .service(routes::Chat::server(state.clone())); + ++ #[cfg(all(feature = "olap", any(feature = "v1", feature = "v2")))] ++ { ++ server_app = server_app.service(routes::Verify::server(state.clone())); ++ } ++ + #[cfg(feature = "v1")] + { + server_app = server_app +@@ -208,7 +213,6 @@ pub fn mk_app( + .service(routes::ApplePayCertificatesMigration::server(state.clone())) + .service(routes::PaymentLink::server(state.clone())) + .service(routes::ConnectorOnboarding::server(state.clone())) +- .service(routes::Verify::server(state.clone())) + .service(routes::Analytics::server(state.clone())) + .service(routes::WebhookEvents::server(state.clone())) + .service(routes::FeatureMatrix::server(state.clone())); +diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs +index 1ff441c5..b5425e55 100644 +--- a/crates/router/src/routes/app.rs ++++ b/crates/router/src/routes/app.rs +@@ -56,7 +56,7 @@ use super::refunds; + use super::routing; + #[cfg(all(feature = "oltp", feature = "v2"))] + use super::tokenization as tokenization_routes; +-#[cfg(all(feature = "olap", feature = "v1"))] ++#[cfg(all(feature = "olap", any(feature = "v1", feature = "v2")))] + use super::verification::{apple_pay_merchant_registration, retrieve_apple_pay_verified_domains}; + #[cfg(feature = "oltp")] + use super::webhooks::*; +@@ -2362,7 +2362,6 @@ impl ThreeDsDecisionRule { + + #[cfg(feature = "olap")] + pub struct Verify; +- + #[cfg(all(feature = "olap", feature = "v1"))] + impl Verify { + pub fn server(state: AppState) -> Scope { +@@ -2379,6 +2378,22 @@ impl Verify { + } + } + ++#[cfg(all(feature = "olap", feature = "v2"))] ++impl Verify { ++ pub fn server(state: AppState) -> Scope { ++ web::scope("/v2/verify") ++ .app_data(web::Data::new(state)) ++ .service( ++ web::resource("/apple-pay/{merchant_id}") ++ .route(web::post().to(apple_pay_merchant_registration)), ++ ) ++ .service( ++ web::resource("/applepay-verified-domains") ++ .route(web::get().to(retrieve_apple_pay_verified_domains)), ++ ) ++ } ++} ++ + pub struct UserDeprecated; + + #[cfg(all(feature = "olap", feature = "v2"))] +diff --git a/crates/router/src/routes/verification.rs b/crates/router/src/routes/verification.rs +index ed987fb7..71b3c12d 100644 +--- a/crates/router/src/routes/verification.rs ++++ b/crates/router/src/routes/verification.rs +@@ -46,6 +46,44 @@ pub async fn apple_pay_merchant_registration( + .await + } + ++#[cfg(all(feature = "olap", feature = "v2"))] ++#[instrument(skip_all, fields(flow = ?Flow::Verification))] ++pub async fn apple_pay_merchant_registration( ++ state: web::Data, ++ req: HttpRequest, ++ json_payload: web::Json, ++ path: web::Path, ++) -> impl Responder { ++ let flow = Flow::Verification; ++ let merchant_id = path.into_inner(); ++ Box::pin(api::server_wrap( ++ flow, ++ state, ++ &req, ++ json_payload.into_inner(), ++ |state, auth: auth::AuthenticationData, body, _| { ++ verification::verify_merchant_creds_for_applepay( ++ state.clone(), ++ body, ++ merchant_id.clone(), ++ Some(auth.profile.get_id().clone()), ++ ) ++ }, ++ auth::auth_type( ++ &auth::V2ApiKeyAuth { ++ is_connected_allowed: false, ++ is_platform_allowed: false, ++ }, ++ &auth::JWTAuth { ++ permission: Permission::ProfileAccountWrite, ++ }, ++ req.headers(), ++ ), ++ api_locking::LockAction::NotApplicable, ++ )) ++ .await ++} ++ + #[instrument(skip_all, fields(flow = ?Flow::Verification))] + pub async fn retrieve_apple_pay_verified_domains( + state: web::Data, + +----- END CHUNK ----- \ No newline at end of file diff --git a/raw/19/19db2b5cb8eb8abac1a7a6a57a68422c10e2a9b4.txt b/raw/19/19db2b5cb8eb8abac1a7a6a57a68422c10e2a9b4.txt new file mode 100644 index 0000000000000000000000000000000000000000..1a0bc2acc663dfc36c089e5245fd3097f1cc8682 --- /dev/null +++ b/raw/19/19db2b5cb8eb8abac1a7a6a57a68422c10e2a9b4.txt @@ -0,0 +1,3518 @@ +ROUTE: juspay/hyperswitch@19db2b5cb8eb8abac1a7a6a57a68422c10e2a9b4 +REPO: https://github.com/juspay/hyperswitch +COMMIT: 19db2b5cb8eb8abac1a7a6a57a68422c10e2a9b4 +AUTHOR: Vani Gupta <118043711+Vani-1107@users.noreply.github.com> +DATE: 2025-08-21T10:26:42 + +=== ISSUE_AND_PR === +[PR #8936] feat(connector): [barclaycard] Implement 3DS flow for cards +URL: https://github.com/juspay/hyperswitch/pull/8936 +BODY: +## Type of Change + + +- [ ] Bugfix +- [x] New feature +- [ ] Enhancement +- [ ] Refactoring +- [ ] Dependency updates +- [ ] Documentation +- [ ] CI/CD + +## Description + +Added 3DS flow for cards. + +### Additional Changes + +- [ ] This PR modifies the API contract +- [ ] This PR modifies the database schema +- [ ] This PR modifies application configuration/environment variables + + + + +## Motivation and Context + + + +## How did you test it? + +Payments Create + +
+ + Request + +``` +{ + "amount": 6540, + "currency": "USD", + "confirm": true, + "capture_method": "automatic", + "connector":["barclaycard"], + "customer_id": "customer_123", + "email": "guest@example.com", + "description": "Its my first payment request", + "authentication_type": "three_ds", + "return_url": "https://duck.com", + "payment_method": "card", + "payment_method_data": { + "card": { + "card_number": "4000000000001091", + "card_exp_month": "01", + "card_exp_year": "2027", + "card_holder_name": "joseph Doe", + "card_cvc": "100" + } + }, + "billing": { + "address": { + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "city": "San Fransico", + "state": "California", + "zip": "94122", + "country": "US", + "first_name": "John", + "last_name": "Doe" + } + }, + "shipping": { + "address": { + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "city": "San Fransico", + "state": "California", + "zip": "94122", + "country": "US", + "first_name": "John" + } + }, + "statement_descriptor_name": "joseph", + "statement_descriptor_suffix": "JS", + "browser_info": { + "user_agent": "Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/70.0.3538.110 Safari\/537.36", + "accept_header": "text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,*\/*;q=0.8", + "language": "nl-NL", + "color_depth": 24, + "screen_height": 723, + "screen_width": 1536, + "time_zone": 0, + "java_enabled": true, + "java_script_enabled": true, + "ip_address": "128.0.0.1" + } +} + +``` +
+ +
+ + Response + +``` +{ + "payment_id": "pay_5hNPtnaAhcQtSJRJPu2f", + "merchant_id": "merchant_1755068373", + "status": "requires_customer_action", + "amount": 6540, + "net_amount": 6540, + "shipping_cost": null, + "amount_capturable": 6540, + "amount_received": null, + "connector": "barclaycard", + "client_secret": "pay_5hNPtnaAhcQtSJRJPu2f_secret_ZHbfJrVKRWAVtOaindOz", + "created": "2025-08-13T07:00:03.840Z", + "currency": "USD", + "customer_id": "customer_123", + "customer": { + "id": "customer_123", + "name": null, + "email": "guest@example.com", + "phone": null, + "phone_country_code": null + }, + "description": "Its my first payment request", + "refunds": null, + "disputes": null, + "mandate_id": null, + "mandate_data": null, + "setup_future_usage": null, + "off_session": null, + "capture_on": null, + "capture_method": "automatic", + "payment_method": "card", + "payment_method_data": { + "card": { + "last4": "1091", + "card_type": "CREDIT", + "card_network": "Visa", + "card_issuer": "INTL HDQTRS-CENTER OWNED", + "card_issuing_country": "UNITEDSTATES", + "card_isin": "400000", + "card_extended_bin": null, + "card_exp_month": "01", + "card_exp_year": "2027", + "card_holder_name": "joseph Doe", + "payment_checks": null, + "authentication_data": null + }, + "billing": null + }, + "payment_token": "token_qY543nleGWdZmdwjqp5J", + "shipping": { + "address": { + "city": "San Fransico", + "country": "US", + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "zip": "94122", + "state": "California", + "first_name": "PiX", + "last_name": null, + "origin_zip": null + }, + "phone": null, + "email": null + }, + "billing": { + "address": { + "city": "San Fransico", + "country": "US", + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "zip": "94122", + "state": "California", + "first_name": "joseph", + "last_name": "Doe", + "origin_zip": null + }, + "phone": null, + "email": null + }, + "order_details": null, + "email": "guest@example.com", + "name": null, + "phone": null, + "return_url": "https://duck.com/", + "authentication_type": "three_ds", + "statement_descriptor_name": "joseph", + "statement_descriptor_suffix": "JS", + "next_action": { + "type": "redirect_to_url", + "redirect_to_url": "http://localhost:8080/payments/redirect/pay_5hNPtnaAhcQtSJRJPu2f/merchant_1755068373/pay_5hNPtnaAhcQtSJRJPu2f_1" + }, + "cancellation_reason": null, + "error_code": null, + "error_message": null, + "unified_code": null, + "unified_message": null, + "payment_experience": null, + "payment_method_type": "credit", + "connector_label": null, + "business_country": null, + "business_label": "default", + "business_sub_label": null, + "allowed_payment_method_types": null, + "ephemeral_key": { + "customer_id": "customer_123", + "created_at": 1755068403, + "expires": 1755072003, + "secret": "epk_6e9902b6971c475c9e2ce103d8eb21f9" + }, + "manual_retry_allowed": null, + "connector_transaction_id": null, + "frm_message": null, + "metadata": null, + "connector_metadata": null, + "feature_metadata": null, + "reference_id": "pay_5hNPtnaAhcQtSJRJPu2f_1", + "payment_link": null, + "profile_id": "pro_GGDcCtQm3esdj2E8IQtN", + "surcharge_details": null, + "attempt_count": 1, + "merchant_decision": null, + "merchant_connector_id": "mca_nCQxbxIhRsZJkWHCReZx", + "incremental_authorization_allowed": null, + "authorization_count": null, + "incremental_authorizations": null, + "external_authentication_details": null, + "external_3ds_authentication_attempted": false, + "expires_on": "2025-08-13T07:15:03.839Z", + "fingerprint": null, + "browser_info": { + "language": "nl-NL", + "time_zone": 0, + "ip_address": "128.0.0.1", + "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36", + "color_depth": 24, + "java_enabled": true, + "screen_width": 1536, + "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8", + "screen_height": 723, + "java_script_enabled": true + }, + "payment_channel": null, + "payment_method_id": null, + "network_transaction_id": null, + "payment_method_status": null, + "updated": "2025-08-13T07:00:08.368Z", + "split_payments": null, + "frm_metadata": null, + "extended_authorization_applied": null, + "capture_before": null, + "merchant_order_reference_id": null, + "order_tax_amount": null, + "connector_mandate_id": null, + "card_discovery": "manual", + "force_3ds_challenge": false, + "force_3ds_challenge_trigger": false, + "issuer_error_code": null, + "issuer_error_message": null, + "is_iframe_redirection_enabled": null, + "enable_partial_authorization": null +} + +``` + +Screenshot 2025-08-13 at 12 30 57 PM + +Screenshot 2025-08-13 at 12 31 12 PM + +
+ +Psync call + +
+ + Response + +Screenshot 2025-08-13 at 12 42 07 PM + +
+ + +Manual Capture + +
+ + Request + +Screenshot 2025-08-14 at 3 22 49 PM + +
+ +
+ + Response + +Screenshot 2025-08-14 at 3 22 19 PM + +Screenshot 2025-08-14 at 3 24 05 PM + +
+ +Void + +
+ + Response + +``` + +{ + "payment_id": "pay_ZRt7ZPKq81NKO3OBSPSN", + "merchant_id": "merchant_1755164596", + "status": "cancelled", + "amount": 6544, + "net_amount": 6544, + "shipping_cost": null, + "amount_capturable": 0, + "amount_received": null, + "connector": "barclaycard", + "client_secret": "pay_ZRt7ZPKq81NKO3OBSPSN_secret_5VRKkOWWHuv1NkFvZ7yy", + "created": "2025-08-14T09:43:40.392Z", + "currency": "USD", + "customer_id": "customer_123", + "customer": { + "id": "customer_123", + "name": null, + "email": "guest@example.com", + "phone": null, + "phone_country_code": null + }, + "description": "Its my first payment request", + "refunds": null, + "disputes": null, + "mandate_id": null, + "mandate_data": null, + "setup_future_usage": null, + "off_session": null, + "capture_on": null, + "capture_method": "manual", + "payment_method": "card", + "payment_method_data": { + "card": { + "last4": "1091", + "card_type": null, + "card_network": null, + "card_issuer": null, + "card_issuing_country": null, + "card_isin": "400000", + "card_extended_bin": null, + "card_exp_month": "01", + "card_exp_year": "2027", + "card_holder_name": "joseph Doe", + "payment_checks": { + "avs_response": { + "code": "Y", + "codeRaw": "Y" + }, + "card_verification": { + "resultCode": "M", + "resultCodeRaw": "M" + } + }, + "authentication_data": null + }, + "billing": null + }, + "payment_token": "token_IF0cVtMJuLBwgtZ2NxC9", + "shipping": { + "address": { + "city": "San Fransico", + "country": "US", + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "zip": "94122", + "state": "California", + "first_name": "PiX", + "last_name": null, + "origin_zip": null + }, + "phone": null, + "email": null + }, + "billing": { + "address": { + "city": "San Fransico", + "country": "US", + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "zip": "94122", + "state": "California", + "first_name": "joseph", + "last_name": "Doe", + "origin_zip": null + }, + "phone": null, + "email": null + }, + "order_details": null, + "email": "guest@example.com", + "name": null, + "phone": null, + "return_url": "https://duck.com/", + "authentication_type": "three_ds", + "statement_descriptor_name": "joseph", + "statement_descriptor_suffix": "JS", + "next_action": null, + "cancellation_reason": "mistake", + "error_code": null, + "error_message": null, + "unified_code": null, + "unified_message": null, + "payment_experience": null, + "payment_method_type": null, + "connector_label": null, + "business_country": null, + "business_label": "default", + "business_sub_label": null, + "allowed_payment_method_types": null, + "ephemeral_key": null, + "manual_retry_allowed": false, + "connector_transaction_id": "7551647749496875004805", + "frm_message": null, + "metadata": null, + "connector_metadata": null, + "feature_metadata": null, + "reference_id": "pay_ZRt7ZPKq81NKO3OBSPSN_1", + "payment_link": null, + "profile_id": "pro_ZrxucPy12jJRn5yqlneZ", + "surcharge_details": null, + "attempt_count": 1, + "merchant_decision": null, + "merchant_connector_id": "mca_ULnoz4qQLpwBwBozYvIr", + "incremental_authorization_allowed": null, + "authorization_count": null, + "incremental_authorizations": null, + "external_authentication_details": null, + "external_3ds_authentication_attempted": false, + "expires_on": "2025-08-14T09:58:40.390Z", + "fingerprint": null, + "browser_info": { + "language": "nl-NL", + "time_zone": 0, + "ip_address": "128.0.0.1", + "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36", + "color_depth": 24, + "java_enabled": true, + "screen_width": 1536, + "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8", + "screen_height": 723, + "java_script_enabled": true + }, + "payment_channel": null, + "payment_method_id": null, + "network_transaction_id": null, + "payment_method_status": null, + "updated": "2025-08-14T09:46:15.320Z", + "split_payments": null, + "frm_metadata": null, + "extended_authorization_applied": null, + "capture_before": null, + "merchant_order_reference_id": null, + "order_tax_amount": null, + "connector_mandate_id": null, + "card_discovery": "manual", + "force_3ds_challenge": false, + "force_3ds_challenge_trigger": false, + "issuer_error_code": null, + "issuer_error_message": null, + "is_iframe_redirection_enabled": null, + "whole_connector_response": null, + "enable_partial_authorization": null +} + +``` + +
+ +--- + +
+ +Refund + +Screenshot 2025-08-14 at 3 38 09 PM + +
+ + +
+ + RSync + +Screenshot 2025-08-14 at 3 39 51 PM + +
+ +--- + +
+ + Cypress test + +Screenshot 2025-08-20 at 6 33 35 PM + +Some tests are failing because of redirection timeout: + +Screenshot 2025-08-20 at 6 34 11 PM + +
+ +## Checklist + + +- [x] I formatted the code `cargo +nightly fmt --all` +- [x] I addressed lints thrown by `cargo clippy` +- [x] I reviewed the submitted code +- [ ] I added unit tests for my changes where possible +COMMENTS: +- semanticdiff-com[bot]: Review changes with  SemanticDiff +
+Changed Files +
+ +| File | Status | +| :--- | :--- | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8936/changes#crates/router/src/types/api/connector_mapping.rs)  [crates/router/src/types/api/connector\_mapping\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8936/changes#crates/router/src/types/api/connector_mapping.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8936/changes#crates/router/src/types/api/connector_mapping.rs)  87% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8936/changes#crates/router/tests/connectors/barclaycard.rs)  [crates/router/tests/connectors/barclaycard\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8936/changes#crates/router/tests/connectors/barclaycard.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8936/changes#crates/router/tests/connectors/barclaycard.rs)  75% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8936/changes#crates/router/src/core/payments.rs)  [crates/router/src/core/payments\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8936/changes#crates/router/src/core/payments.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8936/changes#crates/router/src/core/payments.rs)  67% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8936/changes#crates/hyperswitch_connectors/src/connectors/barclaycard.rs)  [crates/hyperswitch\_connectors/src/connectors/barclaycard\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8936/changes#crates/hyperswitch_connectors/src/connectors/barclaycard.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8936/changes#crates/hyperswitch_connectors/src/connectors/barclaycard.rs)  12% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8936/changes#crates/payment_methods/src/configs/payment_connector_required_fields.rs)  [crates/payment\_methods/src/configs/payment\_connector\_required\_fields\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8936/changes#crates/payment_methods/src/configs/payment_connector_required_fields.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8936/changes#crates/payment_methods/src/configs/payment_connector_required_fields.rs)  12% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8936/changes#crates/hyperswitch_connectors/src/default_implementations.rs)  [crates/hyperswitch\_connectors/src/default\_implementations\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8936/changes#crates/hyperswitch_connectors/src/default_implementations.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8936/changes#crates/hyperswitch_connectors/src/default_implementations.rs)  10% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8936/changes#crates/hyperswitch_connectors/src/connectors/barclaycard/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/barclaycard/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8936/changes#crates/hyperswitch_connectors/src/connectors/barclaycard/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8936/changes#crates/hyperswitch_connectors/src/connectors/barclaycard/transformers.rs)  5% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8936/changes#config/config.example.toml)  [config/config\.example\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8936/changes#config/config.example.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8936/changes#config/deployments/integration_test.toml)  [config/deployments/integration\_test\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8936/changes#config/deployments/integration_test.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8936/changes#config/deployments/production.toml)  [config/deployments/production\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8936/changes#config/deployments/production.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8936/changes#config/deployments/sandbox.toml)  [config/deployments/sandbox\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8936/changes#config/deployments/sandbox.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8936/changes#config/development.toml)  [config/development\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8936/changes#config/development.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8936/changes#config/docker_compose.toml)  [config/docker\_compose\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8936/changes#config/docker_compose.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8936/changes#crates/diesel_models/src/payment_attempt.rs)  [crates/diesel\_models/src/payment\_attempt\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8936/changes#crates/diesel_models/src/payment_attempt.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8936/changes#crates/diesel_models/src/payment_attempt.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8936/changes#crates/hyperswitch_domain_models/src/router_response_types.rs)  [crates/hyperswitch\_domain\_models/src/router\_response\_types\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8936/changes#crates/hyperswitch_domain_models/src/router_response_types.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8936/changes#crates/hyperswitch_domain_models/src/router_response_types.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8936/changes#crates/router/src/services/api.rs)  [crates/router/src/services/api\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8936/changes#crates/router/src/services/api.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8936/changes#crates/router/src/services/api.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8936/changes#cypress-tests/cypress/e2e/configs/Payment/Barclaycard.js)  [cypress\-tests/cypress/e2e/configs/Payment/Barclaycard\.js](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8936/changes#cypress-tests/cypress/e2e/configs/Payment/Barclaycard.js) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8936/changes#cypress-tests/cypress/e2e/configs/Payment/Barclaycard.js)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8936/changes#cypress-tests/cypress/e2e/configs/Payment/Utils.js)  [cypress\-tests/cypress/e2e/configs/Payment/Utils\.js](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8936/changes#cypress-tests/cypress/e2e/configs/Payment/Utils.js) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8936/changes#cypress-tests/cypress/e2e/configs/Payment/Utils.js)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8936/changes#loadtest/config/development.toml)  [loadtest/config/development\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8936/changes#loadtest/config/development.toml) | Unsupported file format | + +
+- sahkal [crates/hyperswitch_connectors/src/connectors/barclaycard.rs:398]: is this commented code required? +- Vani-1107 [crates/hyperswitch_connectors/src/connectors/barclaycard.rs:398]: No, missed it. +Removed. + +=== COMMIT === +SUBJECT: feat(connector): [barclaycard] Implement 3DS flow for cards (#8936) +BODY: +Co-authored-by: Vani Gupta +Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> + +=== FILES === +Summary: 19 files changed, +2230 -96 +- config/config.example.toml (+1 -0) +- config/deployments/integration_test.toml (+1 -0) +- config/deployments/production.toml (+1 -0) +- config/deployments/sandbox.toml (+1 -0) +- config/development.toml (+1 -0) +- config/docker_compose.toml (+1 -0) +- crates/diesel_models/src/payment_attempt.rs (+9 -0) +- crates/hyperswitch_connectors/src/connectors/barclaycard.rs (+342 -51) +- crates/hyperswitch_connectors/src/connectors/barclaycard/transformers.rs (+1016 -39) +- crates/hyperswitch_connectors/src/default_implementations.rs (+0 -2) +- crates/hyperswitch_domain_models/src/router_response_types.rs (+41 -0) +- crates/payment_methods/src/configs/payment_connector_required_fields.rs (+1 -1) +- crates/router/src/core/payments.rs (+2 -1) +- crates/router/src/services/api.rs (+99 -0) +- crates/router/src/types/api/connector_mapping.rs (+1 -1) +- crates/router/tests/connectors/barclaycard.rs (+1 -1) +- cypress-tests/cypress/e2e/configs/Payment/Barclaycard.js (+709 -0) +- cypress-tests/cypress/e2e/configs/Payment/Utils.js (+2 -0) +- loadtest/config/development.toml (+1 -0) + +=== PATCH === +diff --git a/config/config.example.toml b/config/config.example.toml +index af9af674..ab7f0ebd 100644 +--- a/config/config.example.toml ++++ b/config/config.example.toml +@@ -491,6 +491,7 @@ adyen = "Star,Pulse,Accel,Nyce" # Debit networks su + stripe = { payment_method = "bank_transfer" } + nuvei = { payment_method = "card" } + shift4 = { payment_method = "card" } ++barclaycard = { payment_method = "card" } + bluesnap = { payment_method = "card" } + bankofamerica = { payment_method = "card" } + cybersource = { payment_method = "card" } +diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml +index 40efdcf0..e1d1b477 100644 +--- a/config/deployments/integration_test.toml ++++ b/config/deployments/integration_test.toml +@@ -778,6 +778,7 @@ shift4.payment_method = "card" + stripe.payment_method = "bank_transfer" + bankofamerica = { payment_method = "card" } + cybersource = { payment_method = "card" } ++barclaycard = { payment_method = "card" } + nmi.payment_method = "card" + payme.payment_method = "card" + deutschebank = { payment_method = "bank_debit" } +diff --git a/config/deployments/production.toml b/config/deployments/production.toml +index 85b8ebbb..595143f0 100644 +--- a/config/deployments/production.toml ++++ b/config/deployments/production.toml +@@ -788,6 +788,7 @@ shift4.payment_method = "card" + stripe.payment_method = "bank_transfer" + bankofamerica = { payment_method = "card" } + cybersource = { payment_method = "card" } ++barclaycard = { payment_method = "card" } + nmi.payment_method = "card" + payme.payment_method = "card" + deutschebank = { payment_method = "bank_debit" } +diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml +index bad07aa9..1e8005a6 100644 +--- a/config/deployments/sandbox.toml ++++ b/config/deployments/sandbox.toml +@@ -795,6 +795,7 @@ shift4.payment_method = "card" + stripe.payment_method = "bank_transfer" + bankofamerica = { payment_method = "card" } + cybersource = { payment_method = "card" } ++barclaycard = { payment_method = "card" } + nmi.payment_method = "card" + payme.payment_method = "card" + deutschebank = { payment_method = "bank_debit" } +diff --git a/config/development.toml b/config/development.toml +index c1533620..2dae99e6 100644 +--- a/config/development.toml ++++ b/config/development.toml +@@ -954,6 +954,7 @@ shift4 = { payment_method = "card" } + bluesnap = { payment_method = "card" } + bankofamerica = { payment_method = "card" } + cybersource = { payment_method = "card" } ++barclaycard = { payment_method = "card" } + nmi = { payment_method = "card" } + payme = { payment_method = "card" } + deutschebank = { payment_method = "bank_debit" } +diff --git a/config/docker_compose.toml b/config/docker_compose.toml +index cf0057d5..c8cb4632 100644 +--- a/config/docker_compose.toml ++++ b/config/docker_compose.toml +@@ -410,6 +410,7 @@ shift4 = { payment_method = "card" } + bluesnap = { payment_method = "card" } + bankofamerica = { payment_method = "card" } + cybersource = { payment_method = "card" } ++barclaycard = { payment_method = "card" } + nmi = { payment_method = "card" } + payme = { payment_method = "card" } + deutschebank = { payment_method = "bank_debit" } +diff --git a/crates/diesel_models/src/payment_attempt.rs b/crates/diesel_models/src/payment_attempt.rs +index 6c80160c..9c3b4a56 100644 +--- a/crates/diesel_models/src/payment_attempt.rs ++++ b/crates/diesel_models/src/payment_attempt.rs +@@ -3819,6 +3819,15 @@ pub enum RedirectForm { + Html { + html_data: String, + }, ++ BarclaycardAuthSetup { ++ access_token: String, ++ ddc_url: String, ++ reference_id: String, ++ }, ++ BarclaycardConsumerAuth { ++ access_token: String, ++ step_up_url: String, ++ }, + BlueSnap { + payment_fields_token: String, + }, +diff --git a/crates/hyperswitch_connectors/src/connectors/barclaycard.rs b/crates/hyperswitch_connectors/src/connectors/barclaycard.rs +index 86b862bc..9327f8ec 100644 +--- a/crates/hyperswitch_connectors/src/connectors/barclaycard.rs ++++ b/crates/hyperswitch_connectors/src/connectors/barclaycard.rs +@@ -8,19 +8,23 @@ use common_utils::{ + errors::CustomResult, + ext_traits::BytesExt, + request::{Method, Request, RequestBuilder, RequestContent}, ++ types::{AmountConvertor, MinorUnit, StringMajorUnit, StringMajorUnitForConnector}, + }; + use error_stack::{report, ResultExt}; + use hyperswitch_domain_models::{ + router_data::{AccessToken, ConnectorAuthType, ErrorResponse, RouterData}, + router_flow_types::{ + access_token_auth::AccessTokenAuth, +- payments::{Authorize, Capture, PSync, PaymentMethodToken, Session, SetupMandate, Void}, ++ payments::{ ++ Authorize, Capture, CompleteAuthorize, PSync, PaymentMethodToken, PreProcessing, ++ Session, SetupMandate, Void, ++ }, + refunds::{Execute, RSync}, + }, + router_request_types::{ +- AccessTokenRequestData, PaymentMethodTokenizationData, PaymentsAuthorizeData, +- PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData, +- RefundsData, SetupMandateRequestData, ++ AccessTokenRequestData, CompleteAuthorizeData, PaymentMethodTokenizationData, ++ PaymentsAuthorizeData, PaymentsCancelData, PaymentsCaptureData, PaymentsPreProcessingData, ++ PaymentsSessionData, PaymentsSyncData, RefundsData, SetupMandateRequestData, + }, + router_response_types::{ + ConnectorInfo, PaymentMethodDetails, PaymentsResponseData, RefundsResponseData, +@@ -28,6 +32,7 @@ use hyperswitch_domain_models::{ + }, + types::{ + PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData, ++ PaymentsCompleteAuthorizeRouterData, PaymentsPreProcessingRouterData, + PaymentsSyncRouterData, RefundSyncRouterData, RefundsRouterData, + }, + }; +@@ -51,14 +56,26 @@ use url::Url; + use crate::{ + constants::{self, headers}, + types::ResponseRouterData, +- utils::RefundsRequestData, ++ utils::{ ++ convert_amount, PaymentsAuthorizeRequestData, RefundsRequestData, ++ RouterData as OtherRouterData, ++ }, + }; + + pub const V_C_MERCHANT_ID: &str = "v-c-merchant-id"; + + #[derive(Clone)] +-pub struct Barclaycard; ++pub struct Barclaycard { ++ amount_converter: &'static (dyn AmountConvertor + Sync), ++} + ++impl Barclaycard { ++ pub fn new() -> &'static Self { ++ &Self { ++ amount_converter: &StringMajorUnitForConnector, ++ } ++ } ++} + impl Barclaycard { + pub fn generate_digest(&self, payload: &[u8]) -> String { + let payload_digest = digest::digest(&digest::SHA256, payload); +@@ -110,11 +127,13 @@ impl Barclaycard { + + impl api::Payment for Barclaycard {} + impl api::PaymentSession for Barclaycard {} ++impl api::PaymentsPreProcessing for Barclaycard {} + impl api::ConnectorAccessToken for Barclaycard {} + impl api::MandateSetup for Barclaycard {} + impl api::PaymentAuthorize for Barclaycard {} + impl api::PaymentSync for Barclaycard {} + impl api::PaymentCapture for Barclaycard {} ++impl api::PaymentsCompleteAuthorize for Barclaycard {} + impl api::PaymentVoid for Barclaycard {} + impl api::Refund for Barclaycard {} + impl api::RefundExecute for Barclaycard {} +@@ -325,10 +344,12 @@ impl ConnectorIntegration for Barclaycard { ++impl ConnectorIntegration ++ for Barclaycard ++{ + fn get_headers( + &self, +- req: &PaymentsAuthorizeRouterData, ++ req: &PaymentsPreProcessingRouterData, + connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { + self.build_headers(req, connectors) +@@ -340,47 +361,67 @@ impl ConnectorIntegration CustomResult { +- Ok(format!( +- "{}pts/v2/payments", +- ConnectorCommon::base_url(self, connectors) +- )) ++ let redirect_response = req.request.redirect_response.clone().ok_or( ++ errors::ConnectorError::MissingRequiredField { ++ field_name: "redirect_response", ++ }, ++ )?; ++ match redirect_response.params { ++ Some(param) if !param.clone().peek().is_empty() => Ok(format!( ++ "{}risk/v1/authentications", ++ self.base_url(connectors) ++ )), ++ Some(_) | None => Ok(format!( ++ "{}risk/v1/authentication-results", ++ self.base_url(connectors) ++ )), ++ } + } + + fn get_request_body( + &self, +- req: &PaymentsAuthorizeRouterData, ++ req: &PaymentsPreProcessingRouterData, + _connectors: &Connectors, + ) -> CustomResult { +- let connector_router_data = barclaycard::BarclaycardRouterData::try_from(( +- &self.get_currency_unit(), +- req.request.currency, +- req.request.amount, +- req, +- ))?; ++ let amount_in_minor_unit = MinorUnit::new(req.request.amount.ok_or( ++ errors::ConnectorError::MissingRequiredField { ++ field_name: "amount", ++ }, ++ )?); ++ let amount = convert_amount( ++ self.amount_converter, ++ amount_in_minor_unit, ++ req.request ++ .currency ++ .ok_or(errors::ConnectorError::MissingRequiredField { ++ field_name: "currency", ++ })?, ++ )?; ++ let connector_router_data = barclaycard::BarclaycardRouterData::try_from((amount, req))?; + let connector_req = +- barclaycard::BarclaycardPaymentsRequest::try_from(&connector_router_data)?; ++ barclaycard::BarclaycardPreProcessingRequest::try_from(&connector_router_data)?; + Ok(RequestContent::Json(Box::new(connector_req))) + } + + fn build_request( + &self, +- req: &PaymentsAuthorizeRouterData, ++ req: &PaymentsPreProcessingRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { + Ok(Some( + RequestBuilder::new() + .method(Method::Post) +- .url(&types::PaymentsAuthorizeType::get_url( ++ .url(&types::PaymentsPreProcessingType::get_url( + self, req, connectors, + )?) + .attach_default_headers() +- .headers(types::PaymentsAuthorizeType::get_headers( ++ .headers(types::PaymentsPreProcessingType::get_headers( + self, req, connectors, + )?) +- .set_body(types::PaymentsAuthorizeType::get_request_body( ++ .set_body(types::PaymentsPreProcessingType::get_request_body( + self, req, connectors, + )?) + .build(), +@@ -389,13 +430,13 @@ impl ConnectorIntegration, + res: Response, +- ) -> CustomResult { +- let response: barclaycard::BarclaycardPaymentsResponse = res ++ ) -> CustomResult { ++ let response: barclaycard::BarclaycardPreProcessingResponse = res + .response +- .parse_struct("Barclaycard PaymentsAuthorizeResponse") ++ .parse_struct("Barclaycard AuthEnrollmentResponse") + .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; + event_builder.map(|i| i.set_response_body(&response)); + router_env::logger::info!(connector_response=?response); +@@ -413,6 +454,125 @@ impl ConnectorIntegration CustomResult { + self.build_error_response(res, event_builder) + } ++} ++ ++impl ConnectorIntegration for Barclaycard { ++ fn get_headers( ++ &self, ++ req: &PaymentsAuthorizeRouterData, ++ connectors: &Connectors, ++ ) -> CustomResult)>, errors::ConnectorError> { ++ self.build_headers(req, connectors) ++ } ++ ++ fn get_content_type(&self) -> &'static str { ++ self.common_get_content_type() ++ } ++ ++ fn get_url( ++ &self, ++ req: &PaymentsAuthorizeRouterData, ++ connectors: &Connectors, ++ ) -> CustomResult { ++ if req.is_three_ds() && req.request.is_card() { ++ Ok(format!( ++ "{}risk/v1/authentication-setups", ++ ConnectorCommon::base_url(self, connectors) ++ )) ++ } else { ++ Ok(format!( ++ "{}pts/v2/payments/", ++ ConnectorCommon::base_url(self, connectors) ++ )) ++ } ++ } ++ ++ fn get_request_body( ++ &self, ++ req: &PaymentsAuthorizeRouterData, ++ _connectors: &Connectors, ++ ) -> CustomResult { ++ let amount_in_minor_unit = MinorUnit::new(req.request.amount); ++ let amount = convert_amount( ++ self.amount_converter, ++ amount_in_minor_unit, ++ req.request.currency, ++ )?; ++ let connector_router_data = barclaycard::BarclaycardRouterData::try_from((amount, req))?; ++ ++ if req.is_three_ds() && req.request.is_card() { ++ let connector_req = ++ barclaycard::BarclaycardAuthSetupRequest::try_from(&connector_router_data)?; ++ Ok(RequestContent::Json(Box::new(connector_req))) ++ } else { ++ let connector_req = ++ barclaycard::BarclaycardPaymentsRequest::try_from(&connector_router_data)?; ++ Ok(RequestContent::Json(Box::new(connector_req))) ++ } ++ } ++ ++ fn build_request( ++ &self, ++ req: &PaymentsAuthorizeRouterData, ++ connectors: &Connectors, ++ ) -> CustomResult, errors::ConnectorError> { ++ Ok(Some( ++ RequestBuilder::new() ++ .method(Method::Post) ++ .url(&types::PaymentsAuthorizeType::get_url( ++ self, req, connectors, ++ )?) ++ .attach_default_headers() ++ .headers(types::PaymentsAuthorizeType::get_headers( ++ self, req, connectors, ++ )?) ++ .set_body(types::PaymentsAuthorizeType::get_request_body( ++ self, req, connectors, ++ )?) ++ .build(), ++ )) ++ } ++ ++ fn handle_response( ++ &self, ++ data: &PaymentsAuthorizeRouterData, ++ event_builder: Option<&mut ConnectorEvent>, ++ res: Response, ++ ) -> CustomResult { ++ if data.is_three_ds() && data.request.is_card() { ++ let response: barclaycard::BarclaycardAuthSetupResponse = res ++ .response ++ .parse_struct("Barclaycard AuthSetupResponse") ++ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; ++ event_builder.map(|i| i.set_response_body(&response)); ++ router_env::logger::info!(connector_response=?response); ++ RouterData::try_from(ResponseRouterData { ++ response, ++ data: data.clone(), ++ http_code: res.status_code, ++ }) ++ } else { ++ let response: barclaycard::BarclaycardPaymentsResponse = res ++ .response ++ .parse_struct("Barclaycard PaymentsAuthorizeResponse") ++ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; ++ event_builder.map(|i| i.set_response_body(&response)); ++ router_env::logger::info!(connector_response=?response); ++ RouterData::try_from(ResponseRouterData { ++ response, ++ data: data.clone(), ++ http_code: res.status_code, ++ }) ++ } ++ } ++ ++ fn get_error_response( ++ &self, ++ res: Response, ++ event_builder: Option<&mut ConnectorEvent>, ++ ) -> CustomResult { ++ self.build_error_response(res, event_builder) ++ } + + fn get_5xx_error_response( + &self, +@@ -559,12 +719,13 @@ impl ConnectorIntegration fo + req: &PaymentsCaptureRouterData, + _connectors: &Connectors, + ) -> CustomResult { +- let connector_router_data = barclaycard::BarclaycardRouterData::try_from(( +- &self.get_currency_unit(), ++ let amount_in_minor_unit = MinorUnit::new(req.request.amount_to_capture); ++ let amount = convert_amount( ++ self.amount_converter, ++ amount_in_minor_unit, + req.request.currency, +- req.request.amount_to_capture, +- req, +- ))?; ++ )?; ++ let connector_router_data = barclaycard::BarclaycardRouterData::try_from((amount, req))?; + let connector_req = + barclaycard::BarclaycardCaptureRequest::try_from(&connector_router_data)?; + Ok(RequestContent::Json(Box::new(connector_req))) +@@ -679,20 +840,21 @@ impl ConnectorIntegration for Ba + req: &PaymentsCancelRouterData, + _connectors: &Connectors, + ) -> CustomResult { +- let connector_router_data = barclaycard::BarclaycardRouterData::try_from(( +- &self.get_currency_unit(), ++ let amount_in_minor_unit = MinorUnit::new(req.request.amount.ok_or( ++ errors::ConnectorError::MissingRequiredField { ++ field_name: "amount", ++ }, ++ )?); ++ let amount = convert_amount( ++ self.amount_converter, ++ amount_in_minor_unit, + req.request + .currency + .ok_or(errors::ConnectorError::MissingRequiredField { +- field_name: "Currency", ++ field_name: "currency", + })?, +- req.request +- .amount +- .ok_or(errors::ConnectorError::MissingRequiredField { +- field_name: "Amount", +- })?, +- req, +- ))?; ++ )?; ++ let connector_router_data = barclaycard::BarclaycardRouterData::try_from((amount, req))?; + let connector_req = barclaycard::BarclaycardVoidRequest::try_from(&connector_router_data)?; + + Ok(RequestContent::Json(Box::new(connector_req))) +@@ -803,12 +965,13 @@ impl ConnectorIntegration for Barclay + req: &RefundsRouterData, + _connectors: &Connectors, + ) -> CustomResult { +- let connector_router_data = barclaycard::BarclaycardRouterData::try_from(( +- &self.get_currency_unit(), ++ let amount_in_minor_unit = MinorUnit::new(req.request.refund_amount); ++ let amount = convert_amount( ++ self.amount_converter, ++ amount_in_minor_unit, + req.request.currency, +- req.request.refund_amount, +- req, +- ))?; ++ )?; ++ let connector_router_data = barclaycard::BarclaycardRouterData::try_from((amount, req))?; + let connector_req = + barclaycard::BarclaycardRefundRequest::try_from(&connector_router_data)?; + Ok(RequestContent::Json(Box::new(connector_req))) +@@ -936,6 +1099,134 @@ impl ConnectorIntegration for Barclayca + } + } + ++impl ConnectorIntegration ++ for Barclaycard ++{ ++ fn get_headers( ++ &self, ++ req: &PaymentsCompleteAuthorizeRouterData, ++ connectors: &Connectors, ++ ) -> CustomResult)>, errors::ConnectorError> { ++ self.build_headers(req, connectors) ++ } ++ fn get_content_type(&self) -> &'static str { ++ self.common_get_content_type() ++ } ++ fn get_url( ++ &self, ++ _req: &PaymentsCompleteAuthorizeRouterData, ++ connectors: &Connectors, ++ ) -> CustomResult { ++ Ok(format!( ++ "{}pts/v2/payments/", ++ ConnectorCommon::base_url(self, connectors) ++ )) ++ } ++ fn get_request_body( ++ &self, ++ req: &PaymentsCompleteAuthorizeRouterData, ++ _connectors: &Connectors, ++ ) -> CustomResult { ++ let amount_in_minor_unit = MinorUnit::new(req.request.amount); ++ let amount = convert_amount( ++ self.amount_converter, ++ amount_in_minor_unit, ++ req.request.currency, ++ )?; ++ let connector_router_data = barclaycard::BarclaycardRouterData::try_from((amount, req))?; ++ ++ let connector_req = ++ barclaycard::BarclaycardPaymentsRequest::try_from(&connector_router_data)?; ++ Ok(RequestContent::Json(Box::new(connector_req))) ++ } ++ fn build_request( ++ &self, ++ req: &PaymentsCompleteAuthorizeRouterData, ++ connectors: &Connectors, ++ ) -> CustomResult, errors::ConnectorError> { ++ Ok(Some( ++ RequestBuilder::new() ++ .method(Method::Post) ++ .url(&types::PaymentsCompleteAuthorizeType::get_url( ++ self, req, connectors, ++ )?) ++ .attach_default_headers() ++ .headers(types::PaymentsCompleteAuthorizeType::get_headers( ++ self, req, connectors, ++ )?) ++ .set_body(types::PaymentsCompleteAuthorizeType::get_request_body( ++ self, req, connectors, ++ )?) ++ .build(), ++ )) ++ } ++ ++ fn handle_response( ++ &self, ++ data: &PaymentsCompleteAuthorizeRouterData, ++ event_builder: Option<&mut ConnectorEvent>, ++ res: Response, ++ ) -> CustomResult { ++ let response: barclaycard::BarclaycardPaymentsResponse = res ++ .response ++ .parse_struct("Barclaycard PaymentResponse") ++ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; ++ event_builder.map(|i| i.set_response_body(&response)); ++ router_env::logger::info!(connector_response=?response); ++ RouterData::try_from(ResponseRouterData { ++ response, ++ data: data.clone(), ++ http_code: res.status_code, ++ }) ++ } ++ ++ fn get_error_response( ++ &self, ++ res: Response, ++ event_builder: Option<&mut ConnectorEvent>, ++ ) -> CustomResult { ++ self.build_error_response(res, event_builder) ++ } ++ ++ fn get_5xx_error_response( ++ &self, ++ res: Response, ++ event_builder: Option<&mut ConnectorEvent>, ++ ) -> CustomResult { ++ let response: barclaycard::BarclaycardServerErrorResponse = res ++ .response ++ .parse_struct("BarclaycardServerErrorResponse") ++ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; ++ ++ event_builder.map(|event| event.set_response_body(&response)); ++ router_env::logger::info!(error_response=?response); ++ ++ let attempt_status = match response.reason { ++ Some(reason) => match reason { ++ transformers::Reason::SystemError => Some(enums::AttemptStatus::Failure), ++ transformers::Reason::ServerTimeout | transformers::Reason::ServiceTimeout => None, ++ }, ++ None => None, ++ }; ++ Ok(ErrorResponse { ++ status_code: res.status_code, ++ reason: response.status.clone(), ++ code: response ++ .status ++ .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_CODE.to_string()), ++ message: response ++ .message ++ .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()), ++ attempt_status, ++ connector_transaction_id: None, ++ network_advice_code: None, ++ network_decline_code: None, ++ network_error_message: None, ++ connector_metadata: None, ++ }) ++ } ++} ++ + #[async_trait::async_trait] + impl webhooks::IncomingWebhook for Barclaycard { + fn get_webhook_object_reference_id( +@@ -993,7 +1284,7 @@ static BARCLAYCARD_SUPPORTED_PAYMENT_METHODS: LazyLock + specific_features: Some( + api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({ + api_models::feature_matrix::CardSpecificFeatures { +- three_ds: common_enums::FeatureStatus::NotSupported, ++ three_ds: common_enums::FeatureStatus::Supported, + no_three_ds: common_enums::FeatureStatus::Supported, + supported_card_networks: supported_card_network.clone(), + } +@@ -1012,7 +1303,7 @@ static BARCLAYCARD_SUPPORTED_PAYMENT_METHODS: LazyLock + specific_features: Some( + api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({ + api_models::feature_matrix::CardSpecificFeatures { +- three_ds: common_enums::FeatureStatus::NotSupported, ++ three_ds: common_enums::FeatureStatus::Supported, + no_three_ds: common_enums::FeatureStatus::Supported, + supported_card_networks: supported_card_network.clone(), + } +diff --git a/crates/hyperswitch_connectors/src/connectors/barclaycard/transformers.rs b/crates/hyperswitch_connectors/src/connectors/barclaycard/transformers.rs +index db963149..9d78d9de 100644 +--- a/crates/hyperswitch_connectors/src/connectors/barclaycard/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/barclaycard/transformers.rs +@@ -1,6 +1,11 @@ + use base64::Engine; + use common_enums::enums; +-use common_utils::{consts, pii}; ++use common_utils::{ ++ consts, date_time, ++ ext_traits::ValueExt, ++ pii, ++ types::{SemanticVersion, StringMajorUnit}, ++}; + use error_stack::ResultExt; + use hyperswitch_domain_models::{ + payment_method_data::{GooglePayWalletData, PaymentMethodData, WalletData}, +@@ -10,17 +15,18 @@ use hyperswitch_domain_models::{ + }, + router_flow_types::refunds::{Execute, RSync}, + router_request_types::{ +- PaymentsAuthorizeData, PaymentsCancelData, PaymentsCaptureData, PaymentsSyncData, ++ authentication::MessageExtensionAttribute, CompleteAuthorizeData, PaymentsAuthorizeData, ++ PaymentsCancelData, PaymentsCaptureData, PaymentsPreProcessingData, PaymentsSyncData, + ResponseId, + }, +- router_response_types::{PaymentsResponseData, RefundsResponseData}, ++ router_response_types::{PaymentsResponseData, RedirectForm, RefundsResponseData}, + types::{ + PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData, +- RefundsRouterData, ++ PaymentsCompleteAuthorizeRouterData, PaymentsPreProcessingRouterData, RefundsRouterData, + }, + }; +-use hyperswitch_interfaces::{api, errors}; +-use masking::{ExposeInterface, Secret}; ++use hyperswitch_interfaces::errors; ++use masking::{ExposeInterface, PeekInterface, Secret}; + use serde::{Deserialize, Serialize}; + use serde_json::Value; + +@@ -28,8 +34,9 @@ use crate::{ + constants, + types::{RefundsResponseRouterData, ResponseRouterData}, + utils::{ +- self, AddressDetailsData, CardData, PaymentsAuthorizeRequestData, PaymentsSyncRequestData, +- RouterData as OtherRouterData, ++ self, AddressDetailsData, CardData, PaymentsAuthorizeRequestData, ++ PaymentsCompleteAuthorizeRequestData, PaymentsPreProcessingRequestData, ++ PaymentsSyncRequestData, RouterData as OtherRouterData, + }, + }; + pub struct BarclaycardAuthType { +@@ -59,23 +66,13 @@ impl TryFrom<&ConnectorAuthType> for BarclaycardAuthType { + } + + pub struct BarclaycardRouterData { +- pub amount: String, ++ pub amount: StringMajorUnit, + pub router_data: T, + } + +-impl TryFrom<(&api::CurrencyUnit, api_models::enums::Currency, i64, T)> +- for BarclaycardRouterData +-{ ++impl TryFrom<(StringMajorUnit, T)> for BarclaycardRouterData { + type Error = error_stack::Report; +- fn try_from( +- (currency_unit, currency, amount, item): ( +- &api::CurrencyUnit, +- api_models::enums::Currency, +- i64, +- T, +- ), +- ) -> Result { +- let amount = utils::get_amount_as_string(currency_unit, amount, currency)?; ++ fn try_from((amount, item): (StringMajorUnit, T)) -> Result { + Ok(Self { + amount, + router_data: item, +@@ -102,6 +99,7 @@ pub struct ProcessingInformation { + commerce_indicator: String, + capture: Option, + payment_solution: Option, ++ cavv_algorithm: Option, + } + + #[derive(Debug, Serialize)] +@@ -111,15 +109,62 @@ pub struct MerchantDefinedInformation { + value: String, + } + ++#[derive(Debug, Serialize)] ++pub enum BarclaycardParesStatus { ++ #[serde(rename = "Y")] ++ AuthenticationSuccessful, ++ #[serde(rename = "A")] ++ AuthenticationAttempted, ++ #[serde(rename = "N")] ++ AuthenticationFailed, ++ #[serde(rename = "U")] ++ AuthenticationNotCompleted, ++} ++ + #[derive(Debug, Serialize)] + #[serde(rename_all = "camelCase")] + pub struct BarclaycardConsumerAuthInformation { + ucaf_collection_indicator: Option, +- cavv: Option, ++ cavv: Option>, + ucaf_authentication_data: Option>, + xid: Option, + directory_server_transaction_id: Option>, +- specification_version: Option, ++ specification_version: Option, ++ /// This field specifies the 3ds version ++ pa_specification_version: Option, ++ /// Verification response enrollment status. ++ /// ++ /// This field is supported only on Asia, Middle East, and Africa Gateway. ++ /// ++ /// For external authentication, this field will always be "Y" ++ veres_enrolled: Option, ++ /// Raw electronic commerce indicator (ECI) ++ eci_raw: Option, ++ /// This field is supported only on Asia, Middle East, and Africa Gateway ++ /// Also needed for Credit Mutuel-CIC in France and Mastercard Identity Check transactions ++ /// This field is only applicable for Mastercard and Visa Transactions ++ pares_status: Option, ++ //This field is used to send the authentication date in yyyyMMDDHHMMSS format ++ authentication_date: Option, ++ /// This field indicates the 3D Secure transaction flow. It is only supported for secure transactions in France. ++ /// The possible values are - CH (Challenge), FD (Frictionless with delegation), FR (Frictionless) ++ effective_authentication_type: Option, ++ /// This field indicates the authentication type or challenge presented to the cardholder at checkout. ++ challenge_code: Option, ++ /// This field indicates the reason for payer authentication response status. It is only supported for secure transactions in France. ++ pares_status_reason: Option, ++ /// This field indicates the reason why strong authentication was cancelled. It is only supported for secure transactions in France. ++ challenge_cancel_code: Option, ++ /// This field indicates the score calculated by the 3D Securing platform. It is only supported for secure transactions in France. ++ network_score: Option, ++ /// This is the transaction ID generated by the access control server. This field is supported only for secure transactions in France. ++ acs_transaction_id: Option, ++} ++ ++#[derive(Debug, Serialize)] ++pub enum EffectiveAuthenticationType { ++ CH, ++ FR, + } + + #[derive(Debug, Serialize)] +@@ -150,6 +195,7 @@ pub struct Card { + security_code: Secret, + #[serde(rename = "type")] + card_type: Option, ++ type_selection_indicator: Option, + } + + #[derive(Debug, Serialize)] +@@ -168,7 +214,7 @@ pub struct OrderInformationWithBill { + #[derive(Debug, Serialize)] + #[serde(rename_all = "camelCase")] + pub struct Amount { +- total_amount: String, ++ total_amount: StringMajorUnit, + currency: api_models::enums::Currency, + } + +@@ -268,7 +314,7 @@ impl + ) -> Self { + Self { + amount_details: Amount { +- total_amount: item.amount.to_owned(), ++ total_amount: item.amount.clone(), + currency: item.router_data.request.currency, + }, + bill_to, +@@ -293,7 +339,37 @@ impl + ), + ) -> Result { + let commerce_indicator = get_commerce_indicator(network); ++ let cavv_algorithm = Some("2".to_string()); ++ Ok(Self { ++ capture: Some(matches!( ++ item.router_data.request.capture_method, ++ Some(enums::CaptureMethod::Automatic) | None ++ )), ++ payment_solution: solution.map(String::from), ++ commerce_indicator, ++ cavv_algorithm, ++ }) ++ } ++} ++ ++impl ++ TryFrom<( ++ &BarclaycardRouterData<&PaymentsCompleteAuthorizeRouterData>, ++ Option, ++ Option, ++ )> for ProcessingInformation ++{ ++ type Error = error_stack::Report; + ++ fn try_from( ++ (item, solution, network): ( ++ &BarclaycardRouterData<&PaymentsCompleteAuthorizeRouterData>, ++ Option, ++ Option, ++ ), ++ ) -> Result { ++ let commerce_indicator = get_commerce_indicator(network); ++ let cavv_algorithm = Some("2".to_string()); + Ok(Self { + capture: Some(matches!( + item.router_data.request.capture_method, +@@ -301,10 +377,21 @@ impl + )), + payment_solution: solution.map(String::from), + commerce_indicator, ++ cavv_algorithm, + }) + } + } + ++impl From<&BarclaycardRouterData<&PaymentsCompleteAuthorizeRouterData>> ++ for ClientReferenceInformation ++{ ++ fn from(item: &BarclaycardRouterData<&PaymentsCompleteAuthorizeRouterData>) -> Self { ++ Self { ++ code: Some(item.router_data.connector_request_reference_id.clone()), ++ } ++ } ++} ++ + impl From<&BarclaycardRouterData<&PaymentsAuthorizeRouterData>> for ClientReferenceInformation { + fn from(item: &BarclaycardRouterData<&PaymentsAuthorizeRouterData>) -> Self { + Self { +@@ -313,6 +400,49 @@ impl From<&BarclaycardRouterData<&PaymentsAuthorizeRouterData>> for ClientRefere + } + } + ++impl ++ From<( ++ &BarclaycardRouterData<&PaymentsCompleteAuthorizeRouterData>, ++ BillTo, ++ )> for OrderInformationWithBill ++{ ++ fn from( ++ (item, bill_to): ( ++ &BarclaycardRouterData<&PaymentsCompleteAuthorizeRouterData>, ++ BillTo, ++ ), ++ ) -> Self { ++ Self { ++ amount_details: Amount { ++ total_amount: item.amount.clone(), ++ currency: item.router_data.request.currency, ++ }, ++ bill_to: Some(bill_to), ++ } ++ } ++} ++ ++impl From for enums::AttemptStatus { ++ fn from(item: BarclaycardAuthEnrollmentStatus) -> Self { ++ match item { ++ BarclaycardAuthEnrollmentStatus::PendingAuthentication => Self::AuthenticationPending, ++ BarclaycardAuthEnrollmentStatus::AuthenticationSuccessful => { ++ Self::AuthenticationSuccessful ++ } ++ BarclaycardAuthEnrollmentStatus::AuthenticationFailed => Self::AuthenticationFailed, ++ } ++ } ++} ++ ++impl From for EffectiveAuthenticationType { ++ fn from(auth_type: common_enums::DecoupledAuthenticationType) -> Self { ++ match auth_type { ++ common_enums::DecoupledAuthenticationType::Challenge => Self::CH, ++ common_enums::DecoupledAuthenticationType::Frictionless => Self::FR, ++ } ++ } ++} ++ + fn convert_metadata_to_merchant_defined_info(metadata: Value) -> Vec { + let hashmap: std::collections::BTreeMap = + serde_json::from_str(&metadata.to_string()).unwrap_or(std::collections::BTreeMap::new()); +@@ -437,6 +567,492 @@ pub struct Avs { + code_raw: Option, + } + ++#[derive(Debug, Deserialize, Serialize)] ++#[serde(rename_all = "camelCase")] ++pub struct BarclaycardConsumerAuthValidateResponse { ++ ucaf_collection_indicator: Option, ++ cavv: Option>, ++ ucaf_authentication_data: Option>, ++ xid: Option, ++ specification_version: Option, ++ directory_server_transaction_id: Option>, ++ indicator: Option, ++} ++ ++#[derive(Debug, Deserialize, Serialize)] ++pub struct BarclaycardThreeDSMetadata { ++ three_ds_data: BarclaycardConsumerAuthValidateResponse, ++} ++ ++#[derive(Debug, Deserialize, Serialize)] ++#[serde(rename_all = "camelCase")] ++pub struct BarclaycardConsumerAuthInformationEnrollmentResponse { ++ access_token: Option>, ++ step_up_url: Option, ++ //Added to segregate the three_ds_data in a separate struct ++ #[serde(flatten)] ++ validate_response: BarclaycardConsumerAuthValidateResponse, ++} ++ ++#[derive(Debug, Deserialize, Serialize)] ++#[serde(rename_all = "SCREAMING_SNAKE_CASE")] ++pub enum BarclaycardAuthEnrollmentStatus { ++ PendingAuthentication, ++ AuthenticationSuccessful, ++ AuthenticationFailed, ++} ++ ++#[derive(Debug, Deserialize, Serialize)] ++#[serde(rename_all = "camelCase")] ++pub struct ClientAuthCheckInfoResponse { ++ id: String, ++ client_reference_information: ClientReferenceInformation, ++ consumer_authentication_information: BarclaycardConsumerAuthInformationEnrollmentResponse, ++ status: BarclaycardAuthEnrollmentStatus, ++ error_information: Option, ++} ++ ++#[derive(Debug, Serialize)] ++#[serde(rename_all = "camelCase")] ++pub struct BarclaycardConsumerAuthInformationValidateRequest { ++ authentication_transaction_id: String, ++} ++ ++#[derive(Debug, Deserialize, Serialize)] ++#[serde(untagged)] ++pub enum BarclaycardPreProcessingResponse { ++ ClientAuthCheckInfo(Box), ++ ErrorInformation(Box), ++} ++ ++#[derive(Debug, Serialize)] ++#[serde(rename_all = "camelCase")] ++pub struct BarclaycardAuthSetupRequest { ++ payment_information: PaymentInformation, ++ client_reference_information: ClientReferenceInformation, ++} ++ ++#[derive(Debug, Serialize)] ++#[serde(rename_all = "camelCase")] ++pub struct BarclaycardAuthValidateRequest { ++ payment_information: PaymentInformation, ++ client_reference_information: ClientReferenceInformation, ++ consumer_authentication_information: BarclaycardConsumerAuthInformationValidateRequest, ++ order_information: OrderInformation, ++} ++ ++#[derive(Debug, Serialize)] ++#[serde(rename_all = "camelCase")] ++pub struct BarclaycardAuthEnrollmentRequest { ++ payment_information: PaymentInformation, ++ client_reference_information: ClientReferenceInformation, ++ consumer_authentication_information: BarclaycardConsumerAuthInformationRequest, ++ order_information: OrderInformationWithBill, ++} ++ ++#[derive(Debug, Deserialize)] ++#[serde(rename_all = "PascalCase")] ++pub struct BarclaycardRedirectionAuthResponse { ++ pub transaction_id: String, ++} ++ ++#[derive(Debug, Serialize)] ++#[serde(rename_all = "camelCase")] ++pub struct BarclaycardConsumerAuthInformationRequest { ++ return_url: String, ++ reference_id: String, ++} ++ ++#[derive(Debug, Serialize)] ++#[serde(untagged)] ++pub enum BarclaycardPreProcessingRequest { ++ AuthEnrollment(Box), ++ AuthValidate(Box), ++} ++ ++#[derive(Debug, Deserialize, Serialize)] ++#[serde(rename_all = "camelCase")] ++pub struct BarclaycardConsumerAuthInformationResponse { ++ access_token: String, ++ device_data_collection_url: String, ++ reference_id: String, ++} ++ ++#[derive(Debug, Deserialize, Serialize)] ++#[serde(rename_all = "camelCase")] ++pub struct ClientAuthSetupInfoResponse { ++ id: String, ++ client_reference_information: ClientReferenceInformation, ++ consumer_authentication_information: BarclaycardConsumerAuthInformationResponse, ++} ++ ++#[derive(Debug, Deserialize, Serialize)] ++#[serde(untagged)] ++pub enum BarclaycardAuthSetupResponse { ++ ClientAuthSetupInfo(Box), ++ ErrorInformation(Box), ++} ++ ++impl TryFrom<&BarclaycardRouterData<&PaymentsPreProcessingRouterData>> ++ for BarclaycardPreProcessingRequest ++{ ++ type Error = error_stack::Report; ++ fn try_from( ++ item: &BarclaycardRouterData<&PaymentsPreProcessingRouterData>, ++ ) -> Result { ++ let client_reference_information = ClientReferenceInformation { ++ code: Some(item.router_data.connector_request_reference_id.clone()), ++ }; ++ let payment_method_data = item.router_data.request.payment_method_data.clone().ok_or( ++ errors::ConnectorError::MissingConnectorRedirectionPayload { ++ field_name: "payment_method_data", ++ }, ++ )?; ++ let payment_information = match payment_method_data { ++ PaymentMethodData::Card(ccard) => { ++ let card_type = match ccard ++ .card_network ++ .clone() ++ .and_then(get_barclaycard_card_type) ++ { ++ Some(card_network) => Some(card_network.to_string()), ++ None => ccard.get_card_issuer().ok().map(String::from), ++ }; ++ ++ Ok(PaymentInformation::Cards(Box::new( ++ CardPaymentInformation { ++ card: Card { ++ number: ccard.card_number, ++ expiration_month: ccard.card_exp_month, ++ expiration_year: ccard.card_exp_year, ++ security_code: ccard.card_cvc, ++ card_type, ++ type_selection_indicator: Some("1".to_owned()), ++ }, ++ }, ++ ))) ++ } ++ PaymentMethodData::Wallet(_) ++ | PaymentMethodData::CardRedirect(_) ++ | PaymentMethodData::PayLater(_) ++ | PaymentMethodData::BankRedirect(_) ++ | PaymentMethodData::BankDebit(_) ++ | PaymentMethodData::BankTransfer(_) ++ | PaymentMethodData::Crypto(_) ++ | PaymentMethodData::MandatePayment ++ | PaymentMethodData::Reward ++ | PaymentMethodData::RealTimePayment(_) ++ | PaymentMethodData::MobilePayment(_) ++ | PaymentMethodData::Upi(_) ++ | PaymentMethodData::Voucher(_) ++ | PaymentMethodData::GiftCard(_) ++ | PaymentMethodData::OpenBanking(_) ++ | PaymentMethodData::CardToken(_) ++ | PaymentMethodData::NetworkToken(_) ++ | PaymentMethodData::CardDetailsForNetworkTransactionId(_) => { ++ Err(errors::ConnectorError::NotImplemented( ++ utils::get_unimplemented_payment_method_error_message("Barclaycard"), ++ )) ++ } ++ }?; ++ ++ let redirect_response = item.router_data.request.redirect_response.clone().ok_or( ++ errors::ConnectorError::MissingRequiredField { ++ field_name: "redirect_response", ++ }, ++ )?; ++ ++ let amount_details = Amount { ++ total_amount: item.amount.clone(), ++ currency: item.router_data.request.currency.ok_or( ++ errors::ConnectorError::MissingRequiredField { ++ field_name: "currency", ++ }, ++ )?, ++ }; ++ ++ match redirect_response.params { ++ Some(param) if !param.clone().peek().is_empty() => { ++ let reference_id = param ++ .clone() ++ .peek() ++ .split_once('=') ++ .ok_or(errors::ConnectorError::MissingConnectorRedirectionPayload { ++ field_name: "request.redirect_response.params.reference_id", ++ })? ++ .1 ++ .to_string(); ++ let email = item ++ .router_data ++ .get_billing_email() ++ .or(item.router_data.request.get_email())?; ++ let bill_to = build_bill_to(item.router_data.get_billing_address()?, email)?; ++ let order_information = OrderInformationWithBill { ++ amount_details, ++ bill_to: Some(bill_to), ++ }; ++ Ok(Self::AuthEnrollment(Box::new( ++ BarclaycardAuthEnrollmentRequest { ++ payment_information, ++ client_reference_information, ++ consumer_authentication_information: ++ BarclaycardConsumerAuthInformationRequest { ++ return_url: item ++ .router_data ++ .request ++ .get_complete_authorize_url()?, ++ reference_id, ++ }, ++ order_information, ++ }, ++ ))) ++ } ++ Some(_) | None => { ++ let redirect_payload: BarclaycardRedirectionAuthResponse = redirect_response ++ .payload ++ .ok_or(errors::ConnectorError::MissingConnectorRedirectionPayload { ++ field_name: "request.redirect_response.payload", ++ })? ++ .peek() ++ .clone() ++ .parse_value("BarclaycardRedirectionAuthResponse") ++ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; ++ let order_information = OrderInformation { amount_details }; ++ Ok(Self::AuthValidate(Box::new( ++ BarclaycardAuthValidateRequest { ++ payment_information, ++ client_reference_information, ++ consumer_authentication_information: ++ BarclaycardConsumerAuthInformationValidateRequest { ++ authentication_transaction_id: redirect_payload.transaction_id, ++ }, ++ order_information, ++ }, ++ ))) ++ } ++ } ++ } ++} ++ ++impl ++ TryFrom< ++ ResponseRouterData< ++ F, ++ BarclaycardPreProcessingResponse, ++ PaymentsPreProcessingData, ++ PaymentsResponseData, ++ >, ++ > for RouterData ++{ ++ type Error = error_stack::Report; ++ fn try_from( ++ item: ResponseRouterData< ++ F, ++ BarclaycardPreProcessingResponse, ++ PaymentsPreProcessingData, ++ PaymentsResponseData, ++ >, ++ ) -> Result { ++ match item.response { ++ BarclaycardPreProcessingResponse::ClientAuthCheckInfo(info_response) => { ++ let status = enums::AttemptStatus::from(info_response.status); ++ let risk_info: Option = None; ++ if utils::is_payment_failure(status) { ++ let response = Err(get_error_response( ++ &info_response.error_information, ++ &None, ++ &risk_info, ++ Some(status), ++ item.http_code, ++ info_response.id.clone(), ++ )); ++ ++ Ok(Self { ++ status, ++ response, ++ ..item.data ++ }) ++ } else { ++ let connector_response_reference_id = Some( ++ info_response ++ .client_reference_information ++ .code ++ .unwrap_or(info_response.id.clone()), ++ ); ++ ++ let redirection_data = match ( ++ info_response ++ .consumer_authentication_information ++ .access_token, ++ info_response ++ .consumer_authentication_information ++ .step_up_url, ++ ) { ++ (Some(token), Some(step_up_url)) => { ++ Some(RedirectForm::BarclaycardConsumerAuth { ++ access_token: token.expose(), ++ step_up_url, ++ }) ++ } ++ _ => None, ++ }; ++ let three_ds_data = serde_json::to_value( ++ info_response ++ .consumer_authentication_information ++ .validate_response, ++ ) ++ .change_context(errors::ConnectorError::ResponseHandlingFailed)?; ++ Ok(Self { ++ status, ++ response: Ok(PaymentsResponseData::TransactionResponse { ++ resource_id: ResponseId::NoResponseId, ++ redirection_data: Box::new(redirection_data), ++ mandate_reference: Box::new(None), ++ connector_metadata: Some(serde_json::json!({ ++ "three_ds_data": three_ds_data ++ })), ++ network_txn_id: None, ++ connector_response_reference_id, ++ incremental_authorization_allowed: None, ++ charges: None, ++ }), ++ ..item.data ++ }) ++ } ++ } ++ BarclaycardPreProcessingResponse::ErrorInformation(error_response) => { ++ let detailed_error_info = ++ error_response ++ .error_information ++ .details ++ .to_owned() ++ .map(|details| { ++ details ++ .iter() ++ .map(|details| format!("{} : {}", details.field, details.reason)) ++ .collect::>() ++ .join(", ") ++ }); ++ ++ let reason = get_error_reason( ++ error_response.error_information.message, ++ detailed_error_info, ++ None, ++ ); ++ let error_message = error_response.error_information.reason.to_owned(); ++ let response = Err(ErrorResponse { ++ code: error_message ++ .clone() ++ .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_CODE.to_string()), ++ message: error_message ++ .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()), ++ reason, ++ status_code: item.http_code, ++ attempt_status: None, ++ connector_transaction_id: Some(error_response.id.clone()), ++ network_advice_code: None, ++ network_decline_code: None, ++ network_error_message: None, ++ connector_metadata: None, ++ }); ++ Ok(Self { ++ response, ++ status: enums::AttemptStatus::AuthenticationFailed, ++ ..item.data ++ }) ++ } ++ } ++ } ++} ++ ++fn extract_score_id(message_extensions: &[MessageExtensionAttribute]) -> Option { ++ message_extensions.iter().find_map(|attr| { ++ attr.id ++ .ends_with("CB-SCORE") ++ .then(|| { ++ attr.id ++ .split('_') ++ .next() ++ .and_then(|p| p.strip_prefix('A')) ++ .and_then(|s| { ++ s.parse::().map(Some).unwrap_or_else(|err| { ++ router_env::logger::error!( ++ "Failed to parse score_id from '{}': {}", ++ s, ++ err ++ ); ++ None ++ }) ++ }) ++ .or_else(|| { ++ router_env::logger::error!("Unexpected prefix format in id: {}", attr.id); ++ None ++ }) ++ }) ++ .flatten() ++ }) ++} ++ ++impl TryFrom<&BarclaycardRouterData<&PaymentsAuthorizeRouterData>> for BarclaycardAuthSetupRequest { ++ type Error = error_stack::Report; ++ fn try_from( ++ item: &BarclaycardRouterData<&PaymentsAuthorizeRouterData>, ++ ) -> Result { ++ match item.router_data.request.payment_method_data.clone() { ++ PaymentMethodData::Card(ccard) => { ++ let card_type = match ccard ++ .card_network ++ .clone() ++ .and_then(get_barclaycard_card_type) ++ { ++ Some(card_network) => Some(card_network.to_string()), ++ None => ccard.get_card_issuer().ok().map(String::from), ++ }; ++ ++ let payment_information = ++ PaymentInformation::Cards(Box::new(CardPaymentInformation { ++ card: Card { ++ number: ccard.card_number, ++ expiration_month: ccard.card_exp_month, ++ expiration_year: ccard.card_exp_year, ++ security_code: ccard.card_cvc, ++ card_type, ++ type_selection_indicator: Some("1".to_owned()), ++ }, ++ })); ++ let client_reference_information = ClientReferenceInformation::from(item); ++ Ok(Self { ++ payment_information, ++ client_reference_information, ++ }) ++ } ++ PaymentMethodData::Wallet(_) ++ | PaymentMethodData::CardRedirect(_) ++ | PaymentMethodData::PayLater(_) ++ | PaymentMethodData::BankRedirect(_) ++ | PaymentMethodData::BankDebit(_) ++ | PaymentMethodData::BankTransfer(_) ++ | PaymentMethodData::Crypto(_) ++ | PaymentMethodData::MandatePayment ++ | PaymentMethodData::Reward ++ | PaymentMethodData::RealTimePayment(_) ++ | PaymentMethodData::MobilePayment(_) ++ | PaymentMethodData::Upi(_) ++ | PaymentMethodData::Voucher(_) ++ | PaymentMethodData::GiftCard(_) ++ | PaymentMethodData::OpenBanking(_) ++ | PaymentMethodData::CardToken(_) ++ | PaymentMethodData::NetworkToken(_) ++ | PaymentMethodData::CardDetailsForNetworkTransactionId(_) => { ++ Err(errors::ConnectorError::NotImplemented( ++ utils::get_unimplemented_payment_method_error_message("Barclaycard"), ++ ) ++ .into()) ++ } ++ } ++ } ++} ++ + impl + TryFrom<( + &BarclaycardRouterData<&PaymentsAuthorizeRouterData>, +@@ -450,14 +1066,10 @@ impl + hyperswitch_domain_models::payment_method_data::Card, + ), + ) -> Result { +- if item.router_data.is_three_ds() { +- Err(errors::ConnectorError::NotSupported { +- message: "Card 3DS".to_string(), +- connector: "Barclaycard", +- })? +- }; +- +- let email = item.router_data.request.get_email()?; ++ let email = item ++ .router_data ++ .get_billing_email() ++ .or(item.router_data.request.get_email())?; + let bill_to = build_bill_to(item.router_data.get_billing_address()?, email)?; + let order_information = OrderInformationWithBill::from((item, Some(bill_to))); + let payment_information = PaymentInformation::try_from(&ccard)?; +@@ -470,13 +1082,157 @@ impl + .clone() + .map(convert_metadata_to_merchant_defined_info); + ++ let pares_status = Some(BarclaycardParesStatus::AuthenticationSuccessful); ++ ++ let consumer_authentication_information = item ++ .router_data ++ .request ++ .authentication_data ++ .as_ref() ++ .map(|authn_data| { ++ let (ucaf_authentication_data, cavv, ucaf_collection_indicator) = ++ if ccard.card_network == Some(common_enums::CardNetwork::Mastercard) { ++ (Some(authn_data.cavv.clone()), None, Some("2".to_string())) ++ } else { ++ (None, Some(authn_data.cavv.clone()), None) ++ }; ++ let authentication_date = date_time::format_date( ++ authn_data.created_at, ++ date_time::DateFormat::YYYYMMDDHHmmss, ++ ) ++ .ok(); ++ let effective_authentication_type = authn_data.authentication_type.map(Into::into); ++ let network_score: Option = ++ if ccard.card_network == Some(common_enums::CardNetwork::CartesBancaires) { ++ match authn_data.message_extension.as_ref() { ++ Some(secret) => { ++ let exposed_value = secret.clone().expose(); ++ match serde_json::from_value::>( ++ exposed_value, ++ ) { ++ Ok(exts) => extract_score_id(&exts), ++ Err(err) => { ++ router_env::logger::error!( ++ "Failed to deserialize message_extension: {:?}", ++ err ++ ); ++ None ++ } ++ } ++ } ++ None => None, ++ } ++ } else { ++ None ++ }; ++ BarclaycardConsumerAuthInformation { ++ pares_status, ++ ucaf_collection_indicator, ++ cavv, ++ ucaf_authentication_data, ++ xid: None, ++ directory_server_transaction_id: authn_data ++ .ds_trans_id ++ .clone() ++ .map(Secret::new), ++ specification_version: authn_data.message_version.clone(), ++ pa_specification_version: authn_data.message_version.clone(), ++ veres_enrolled: Some("Y".to_string()), ++ eci_raw: authn_data.eci.clone(), ++ authentication_date, ++ effective_authentication_type, ++ challenge_code: authn_data.challenge_code.clone(), ++ pares_status_reason: authn_data.challenge_code_reason.clone(), ++ challenge_cancel_code: authn_data.challenge_cancel.clone(), ++ network_score, ++ acs_transaction_id: authn_data.acs_trans_id.clone(), ++ } ++ }); ++ + Ok(Self { + processing_information, + payment_information, + order_information, + client_reference_information, + merchant_defined_information, +- consumer_authentication_information: None, ++ consumer_authentication_information, ++ }) ++ } ++} ++ ++impl ++ TryFrom<( ++ &BarclaycardRouterData<&PaymentsCompleteAuthorizeRouterData>, ++ hyperswitch_domain_models::payment_method_data::Card, ++ )> for BarclaycardPaymentsRequest ++{ ++ type Error = error_stack::Report; ++ fn try_from( ++ (item, ccard): ( ++ &BarclaycardRouterData<&PaymentsCompleteAuthorizeRouterData>, ++ hyperswitch_domain_models::payment_method_data::Card, ++ ), ++ ) -> Result { ++ let email = item ++ .router_data ++ .get_billing_email() ++ .or(item.router_data.request.get_email())?; ++ let bill_to = build_bill_to(item.router_data.get_billing_address()?, email)?; ++ let order_information = OrderInformationWithBill::from((item, bill_to)); ++ let payment_information = PaymentInformation::try_from(&ccard)?; ++ let processing_information = ProcessingInformation::try_from((item, None, None))?; ++ let client_reference_information = ClientReferenceInformation::from(item); ++ let merchant_defined_information = item ++ .router_data ++ .request ++ .metadata ++ .clone() ++ .map(convert_metadata_to_merchant_defined_info); ++ ++ let pares_status = Some(BarclaycardParesStatus::AuthenticationSuccessful); ++ ++ let three_ds_info: BarclaycardThreeDSMetadata = item ++ .router_data ++ .request ++ .connector_meta ++ .clone() ++ .ok_or(errors::ConnectorError::MissingRequiredField { ++ field_name: "connector_meta", ++ })? ++ .parse_value("BarclaycardThreeDSMetadata") ++ .change_context(errors::ConnectorError::InvalidConnectorConfig { ++ config: "metadata", ++ })?; ++ ++ let consumer_authentication_information = Some(BarclaycardConsumerAuthInformation { ++ pares_status, ++ ucaf_collection_indicator: three_ds_info.three_ds_data.ucaf_collection_indicator, ++ cavv: three_ds_info.three_ds_data.cavv, ++ ucaf_authentication_data: three_ds_info.three_ds_data.ucaf_authentication_data, ++ xid: three_ds_info.three_ds_data.xid, ++ directory_server_transaction_id: three_ds_info ++ .three_ds_data ++ .directory_server_transaction_id, ++ specification_version: three_ds_info.three_ds_data.specification_version.clone(), ++ pa_specification_version: three_ds_info.three_ds_data.specification_version.clone(), ++ veres_enrolled: None, ++ eci_raw: None, ++ authentication_date: None, ++ effective_authentication_type: None, ++ challenge_code: None, ++ pares_status_reason: None, ++ challenge_cancel_code: None, ++ network_score: None, ++ acs_transaction_id: None, ++ }); ++ ++ Ok(Self { ++ processing_information, ++ payment_information, ++ order_information, ++ client_reference_information, ++ merchant_defined_information, ++ consumer_authentication_information, + }) + } + } +@@ -494,7 +1250,10 @@ impl + GooglePayWalletData, + ), + ) -> Result { +- let email = item.router_data.request.get_email()?; ++ let email = item ++ .router_data ++ .get_billing_email() ++ .or(item.router_data.request.get_email())?; + let bill_to = build_bill_to(item.router_data.get_billing_address()?, email)?; + let order_information = OrderInformationWithBill::from((item, Some(bill_to))); + let payment_information = PaymentInformation::try_from(&google_pay_data)?; +@@ -590,6 +1349,141 @@ impl TryFrom<&BarclaycardRouterData<&PaymentsAuthorizeRouterData>> for Barclayca + } + } + ++impl ++ TryFrom< ++ ResponseRouterData< ++ F, ++ BarclaycardAuthSetupResponse, ++ PaymentsAuthorizeData, ++ PaymentsResponseData, ++ >, ++ > for RouterData ++{ ++ type Error = error_stack::Report; ++ fn try_from( ++ item: ResponseRouterData< ++ F, ++ BarclaycardAuthSetupResponse, ++ PaymentsAuthorizeData, ++ PaymentsResponseData, ++ >, ++ ) -> Result { ++ match item.response { ++ BarclaycardAuthSetupResponse::ClientAuthSetupInfo(info_response) => Ok(Self { ++ status: enums::AttemptStatus::AuthenticationPending, ++ response: Ok(PaymentsResponseData::TransactionResponse { ++ resource_id: ResponseId::NoResponseId, ++ redirection_data: Box::new(Some(RedirectForm::BarclaycardAuthSetup { ++ access_token: info_response ++ .consumer_authentication_information ++ .access_token, ++ ddc_url: info_response ++ .consumer_authentication_information ++ .device_data_collection_url, ++ reference_id: info_response ++ .consumer_authentication_information ++ .reference_id, ++ })), ++ mandate_reference: Box::new(None), ++ connector_metadata: None, ++ network_txn_id: None, ++ connector_response_reference_id: Some( ++ info_response ++ .client_reference_information ++ .code ++ .unwrap_or(info_response.id.clone()), ++ ), ++ incremental_authorization_allowed: None, ++ charges: None, ++ }), ++ ..item.data ++ }), ++ BarclaycardAuthSetupResponse::ErrorInformation(error_response) => { ++ let detailed_error_info = ++ error_response ++ .error_information ++ .details ++ .to_owned() ++ .map(|details| { ++ details ++ .iter() ++ .map(|details| format!("{} : {}", details.field, details.reason)) ++ .collect::>() ++ .join(", ") ++ }); ++ ++ let reason = get_error_reason( ++ error_response.error_information.message, ++ detailed_error_info, ++ None, ++ ); ++ let error_message = error_response.error_information.reason; ++ Ok(Self { ++ response: Err(ErrorResponse { ++ code: error_message ++ .clone() ++ .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_CODE.to_string()), ++ message: error_message.unwrap_or( ++ hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string(), ++ ), ++ reason, ++ status_code: item.http_code, ++ attempt_status: None, ++ connector_transaction_id: Some(error_response.id.clone()), ++ network_advice_code: None, ++ network_decline_code: None, ++ network_error_message: None, ++ connector_metadata: None, ++ }), ++ status: enums::AttemptStatus::AuthenticationFailed, ++ ..item.data ++ }) ++ } ++ } ++ } ++} ++ ++impl TryFrom<&BarclaycardRouterData<&PaymentsCompleteAuthorizeRouterData>> ++ for BarclaycardPaymentsRequest ++{ ++ type Error = error_stack::Report; ++ fn try_from( ++ item: &BarclaycardRouterData<&PaymentsCompleteAuthorizeRouterData>, ++ ) -> Result { ++ let payment_method_data = item.router_data.request.payment_method_data.clone().ok_or( ++ errors::ConnectorError::MissingRequiredField { ++ field_name: "payment_method_data", ++ }, ++ )?; ++ match payment_method_data { ++ PaymentMethodData::Card(ccard) => Self::try_from((item, ccard)), ++ PaymentMethodData::Wallet(_) ++ | PaymentMethodData::CardRedirect(_) ++ | PaymentMethodData::PayLater(_) ++ | PaymentMethodData::BankRedirect(_) ++ | PaymentMethodData::BankDebit(_) ++ | PaymentMethodData::BankTransfer(_) ++ | PaymentMethodData::Crypto(_) ++ | PaymentMethodData::MandatePayment ++ | PaymentMethodData::Reward ++ | PaymentMethodData::RealTimePayment(_) ++ | PaymentMethodData::MobilePayment(_) ++ | PaymentMethodData::Upi(_) ++ | PaymentMethodData::Voucher(_) ++ | PaymentMethodData::GiftCard(_) ++ | PaymentMethodData::OpenBanking(_) ++ | PaymentMethodData::CardToken(_) ++ | PaymentMethodData::NetworkToken(_) ++ | PaymentMethodData::CardDetailsForNetworkTransactionId(_) => { ++ Err(errors::ConnectorError::NotImplemented( ++ utils::get_unimplemented_payment_method_error_message("Barclaycard"), ++ ) ++ .into()) ++ } ++ } ++ } ++} ++ + #[derive(Clone, Debug, Deserialize, Serialize)] + #[serde(rename_all = "SCREAMING_SNAKE_CASE")] + pub enum BarclaycardPaymentStatus { +@@ -611,6 +1505,7 @@ pub enum BarclaycardPaymentStatus { + PendingReview, + Accepted, + Cancelled, ++ StatusNotReceived, + //PartialAuthorized, not being consumed yet. + } + +@@ -650,6 +1545,7 @@ fn map_barclaycard_attempt_status( + enums::AttemptStatus::AuthenticationPending + } + BarclaycardPaymentStatus::PendingReview ++ | BarclaycardPaymentStatus::StatusNotReceived + | BarclaycardPaymentStatus::Challenge + | BarclaycardPaymentStatus::Accepted => enums::AttemptStatus::Pending, + } +@@ -666,7 +1562,7 @@ pub enum BarclaycardPaymentsResponse { + #[serde(rename_all = "camelCase")] + pub struct BarclaycardClientReferenceResponse { + id: String, +- status: BarclaycardPaymentStatus, ++ status: Option, + client_reference_information: ClientReferenceInformation, + processor_information: Option, + processing_information: Option, +@@ -929,7 +1825,10 @@ impl + match item.response { + BarclaycardPaymentsResponse::ClientReferenceInformation(info_response) => { + let status = map_barclaycard_attempt_status(( +- info_response.status.clone(), ++ info_response ++ .status ++ .clone() ++ .unwrap_or(BarclaycardPaymentStatus::StatusNotReceived), + item.data.request.is_auto_capture()?, + )); + let response = get_payment_response((&info_response, status, item.http_code)) +@@ -1033,7 +1932,13 @@ impl + ) -> Result { + match item.response { + BarclaycardPaymentsResponse::ClientReferenceInformation(info_response) => { +- let status = map_barclaycard_attempt_status((info_response.status.clone(), true)); ++ let status = map_barclaycard_attempt_status(( ++ info_response ++ .status ++ .clone() ++ .unwrap_or(BarclaycardPaymentStatus::StatusNotReceived), ++ true, ++ )); + let response = get_payment_response((&info_response, status, item.http_code)) + .map_err(|err| *err); + Ok(Self { +@@ -1070,7 +1975,13 @@ impl + ) -> Result { + match item.response { + BarclaycardPaymentsResponse::ClientReferenceInformation(info_response) => { +- let status = map_barclaycard_attempt_status((info_response.status.clone(), false)); ++ let status = map_barclaycard_attempt_status(( ++ info_response ++ .status ++ .clone() ++ .unwrap_or(BarclaycardPaymentStatus::StatusNotReceived), ++ false, ++ )); + let response = get_payment_response((&info_response, status, item.http_code)) + .map_err(|err| *err); + Ok(Self { +@@ -1231,6 +2142,71 @@ impl + } + } + ++impl ++ TryFrom< ++ ResponseRouterData< ++ F, ++ BarclaycardPaymentsResponse, ++ CompleteAuthorizeData, ++ PaymentsResponseData, ++ >, ++ > for RouterData ++{ ++ type Error = error_stack::Report; ++ fn try_from( ++ item: ResponseRouterData< ++ F, ++ BarclaycardPaymentsResponse, ++ CompleteAuthorizeData, ++ PaymentsResponseData, ++ >, ++ ) -> Result { ++ match item.response { ++ BarclaycardPaymentsResponse::ClientReferenceInformation(info_response) => { ++ let status = map_barclaycard_attempt_status(( ++ info_response ++ .status ++ .clone() ++ .unwrap_or(BarclaycardPaymentStatus::StatusNotReceived), ++ item.data.request.is_auto_capture()?, ++ )); ++ let response = get_payment_response((&info_response, status, item.http_code)) ++ .map_err(|err| *err); ++ let connector_response = info_response ++ .processor_information ++ .as_ref() ++ .map(AdditionalPaymentMethodConnectorResponse::from) ++ .map(ConnectorResponseData::with_additional_payment_method_data); ++ ++ Ok(Self { ++ status, ++ response, ++ connector_response, ++ ..item.data ++ }) ++ } ++ BarclaycardPaymentsResponse::ErrorInformation(ref error_response) => { ++ Ok(map_error_response(&error_response.clone(), item, None)) ++ } ++ } ++ } ++} ++ ++impl From<&ClientProcessorInformation> for AdditionalPaymentMethodConnectorResponse { ++ fn from(processor_information: &ClientProcessorInformation) -> Self { ++ let payment_checks = Some( ++ serde_json::json!({"avs_response": processor_information.avs, "card_verification": processor_information.card_verification}), ++ ); ++ ++ Self::Card { ++ authentication_data: None, ++ payment_checks, ++ card_network: None, ++ domestic_network: None, ++ } ++ } ++} ++ + #[derive(Debug, Serialize)] + #[serde(rename_all = "camelCase")] + pub struct OrderInformation { +@@ -1673,6 +2649,7 @@ impl TryFrom<&hyperswitch_domain_models::payment_method_data::Card> for PaymentI + expiration_year: ccard.card_exp_year.clone(), + security_code: ccard.card_cvc.clone(), + card_type, ++ type_selection_indicator: Some("1".to_owned()), + }, + }))) + } +diff --git a/crates/hyperswitch_connectors/src/default_implementations.rs b/crates/hyperswitch_connectors/src/default_implementations.rs +index b88d7ef5..7d746072 100644 +--- a/crates/hyperswitch_connectors/src/default_implementations.rs ++++ b/crates/hyperswitch_connectors/src/default_implementations.rs +@@ -1149,7 +1149,6 @@ default_imp_for_complete_authorize!( + connectors::Authipay, + connectors::Bamboraapac, + connectors::Bankofamerica, +- connectors::Barclaycard, + connectors::Billwerk, + connectors::Bitpay, + connectors::Blackhawknetwork, +@@ -1668,7 +1667,6 @@ default_imp_for_pre_processing_steps!( + connectors::Bambora, + connectors::Bamboraapac, + connectors::Bankofamerica, +- connectors::Barclaycard, + connectors::Billwerk, + connectors::Bitpay, + connectors::Blackhawknetwork, +diff --git a/crates/hyperswitch_domain_models/src/router_response_types.rs b/crates/hyperswitch_domain_models/src/router_response_types.rs +index f4b40e23..aacbfbf1 100644 +--- a/crates/hyperswitch_domain_models/src/router_response_types.rs ++++ b/crates/hyperswitch_domain_models/src/router_response_types.rs +@@ -259,6 +259,15 @@ pub enum RedirectForm { + Html { + html_data: String, + }, ++ BarclaycardAuthSetup { ++ access_token: String, ++ ddc_url: String, ++ reference_id: String, ++ }, ++ BarclaycardConsumerAuth { ++ access_token: String, ++ step_up_url: String, ++ }, + BlueSnap { + payment_fields_token: String, // payment-field-token + }, +@@ -332,6 +341,22 @@ impl From for diesel_models::payment_attempt::RedirectForm { + form_fields, + }, + RedirectForm::Html { html_data } => Self::Html { html_data }, ++ RedirectForm::BarclaycardAuthSetup { ++ access_token, ++ ddc_url, ++ reference_id, ++ } => Self::BarclaycardAuthSetup { ++ access_token, ++ ddc_url, ++ reference_id, ++ }, ++ RedirectForm::BarclaycardConsumerAuth { ++ access_token, ++ step_up_url, ++ } => Self::BarclaycardConsumerAuth { ++ access_token, ++ step_up_url, ++ }, + RedirectForm::BlueSnap { + payment_fields_token, + } => Self::BlueSnap { +@@ -416,6 +441,22 @@ impl From for RedirectForm { + diesel_models::payment_attempt::RedirectForm::Html { html_data } => { + Self::Html { html_data } + } ++ diesel_models::payment_attempt::RedirectForm::BarclaycardAuthSetup { ++ access_token, ++ ddc_url, ++ reference_id, ++ } => Self::BarclaycardAuthSetup { ++ access_token, ++ ddc_url, ++ reference_id, ++ }, ++ diesel_models::payment_attempt::RedirectForm::BarclaycardConsumerAuth { ++ access_token, ++ step_up_url, ++ } => Self::BarclaycardConsumerAuth { ++ access_token, ++ step_up_url, ++ }, + diesel_models::payment_attempt::RedirectForm::BlueSnap { + payment_fields_token, + } => Self::BlueSnap { +diff --git a/crates/payment_methods/src/configs/payment_connector_required_fields.rs b/crates/payment_methods/src/configs/payment_connector_required_fields.rs +index 15a4ef90..732b1889 100644 +--- a/crates/payment_methods/src/configs/payment_connector_required_fields.rs ++++ b/crates/payment_methods/src/configs/payment_connector_required_fields.rs +@@ -1291,7 +1291,7 @@ fn get_cards_required_fields() -> HashMap { + fields( + vec![], + vec![], +- [card_basic(), full_name(), billing_address()].concat(), ++ [card_basic(), email(), full_name(), billing_address()].concat(), + ), + ), + (Connector::Billwerk, fields(vec![], vec![], card_basic())), +diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs +index d1d7c33d..5008b3a6 100644 +--- a/crates/router/src/core/payments.rs ++++ b/crates/router/src/core/payments.rs +@@ -6513,7 +6513,8 @@ where + router_data = router_data.preprocessing_steps(state, connector).await?; + + (router_data, false) +- } else if connector.connector_name == router_types::Connector::Cybersource ++ } else if (connector.connector_name == router_types::Connector::Cybersource ++ || connector.connector_name == router_types::Connector::Barclaycard) + && is_operation_complete_authorize(&operation) + && router_data.auth_type == storage_enums::AuthenticationType::ThreeDs + { +diff --git a/crates/router/src/services/api.rs b/crates/router/src/services/api.rs +index 6b25eb45..6ec0ff9f 100644 +--- a/crates/router/src/services/api.rs ++++ b/crates/router/src/services/api.rs +@@ -1288,6 +1288,105 @@ pub fn build_redirection_form( + RedirectForm::Html { html_data } => { + PreEscaped(format!("{html_data} ")) + } ++ RedirectForm::BarclaycardAuthSetup { ++ access_token, ++ ddc_url, ++ reference_id, ++ } => { ++ maud::html! { ++ (maud::DOCTYPE) ++ html { ++ head { ++ meta name="viewport" content="width=device-width, initial-scale=1"; ++ } ++ body style="background-color: #ffffff; padding: 20px; font-family: Arial, Helvetica, Sans-Serif;" { ++ ++ div id="loader1" class="lottie" style="height: 150px; display: block; position: relative; margin-top: 150px; margin-left: auto; margin-right: auto;" { "" } ++ ++ (PreEscaped(r#""#)) ++ ++ (PreEscaped(r#" ++ ++ "#)) ++ ++ h3 style="text-align: center;" { "Please wait while we process your payment..." } ++ } ++ ++ (PreEscaped(r#""#)) ++ (PreEscaped(format!("
++ ++
"))) ++ (PreEscaped(r#""#)) ++ (PreEscaped(format!(" ++ "))) ++ }} ++ } ++ RedirectForm::BarclaycardConsumerAuth { ++ access_token, ++ step_up_url, ++ } => { ++ maud::html! { ++ (maud::DOCTYPE) ++ html { ++ head { ++ meta name="viewport" content="width=device-width, initial-scale=1"; ++ } ++ body style="background-color: #ffffff; padding: 20px; font-family: Arial, Helvetica, Sans-Serif;" { ++ ++ div id="loader1" class="lottie" style="height: 150px; display: block; position: relative; margin-top: 150px; margin-left: auto; margin-right: auto;" { "" } ++ ++ (PreEscaped(r#""#)) ++ ++ (PreEscaped(r#" ++ ++ "#)) ++ ++ h3 style="text-align: center;" { "Please wait while we process your payment..." } ++ } ++ ++ // This is the iframe recommended by cybersource but the redirection happens inside this iframe once otp ++ // is received and we lose control of the redirection on user client browser, so to avoid that we have removed this iframe and directly consumed it. ++ // (PreEscaped(r#""#)) ++ (PreEscaped(format!("
++ ++
"))) ++ (PreEscaped(format!(""))) ++ }} ++ } + RedirectForm::BlueSnap { + payment_fields_token, + } => { +diff --git a/crates/router/src/types/api/connector_mapping.rs b/crates/router/src/types/api/connector_mapping.rs +index 384a430d..c184c9db 100644 +--- a/crates/router/src/types/api/connector_mapping.rs ++++ b/crates/router/src/types/api/connector_mapping.rs +@@ -136,7 +136,7 @@ impl ConnectorData { + Ok(ConnectorEnum::Old(Box::new(&connector::Bankofamerica))) + } + enums::Connector::Barclaycard => { +- Ok(ConnectorEnum::Old(Box::new(&connector::Barclaycard))) ++ Ok(ConnectorEnum::Old(Box::new(connector::Barclaycard::new()))) + } + enums::Connector::Billwerk => { + Ok(ConnectorEnum::Old(Box::new(connector::Billwerk::new()))) +diff --git a/crates/router/tests/connectors/barclaycard.rs b/crates/router/tests/connectors/barclaycard.rs +index c2c21bbc..2087131c 100644 +--- a/crates/router/tests/connectors/barclaycard.rs ++++ b/crates/router/tests/connectors/barclaycard.rs +@@ -11,7 +11,7 @@ impl utils::Connector for BarclaycardTest { + fn get_data(&self) -> api::ConnectorData { + use router::connector::Barclaycard; + utils::construct_connector_data_old( +- Box::new(&Barclaycard), ++ Box::new(Barclaycard::new()), + types::Connector::DummyConnector1, + api::GetToken::Connector, + None, +diff --git a/cypress-tests/cypress/e2e/configs/Payment/Barclaycard.js b/cypress-tests/cypress/e2e/configs/Payment/Barclaycard.js +new file mode 100644 +index 00000000..594d56e2 +--- /dev/null ++++ b/cypress-tests/cypress/e2e/configs/Payment/Barclaycard.js +@@ -0,0 +1,709 @@ ++import { customerAcceptance } from "./Commons"; ++ ++const successfulNo3DSCardDetails = { ++ card_number: "4000000000001091", ++ card_exp_month: "01", ++ card_exp_year: "27", ++ card_holder_name: "joseph Doe", ++ card_cvc: "100", ++}; ++ ++const successfulThreeDSTestCardDetails = { ++ card_number: "4000000000002701", ++ card_exp_month: "01", ++ card_exp_year: "50", ++ card_holder_name: "joseph Doe", ++ card_cvc: "123", ++}; ++ ++// Mandate data for test cases (skipped for Barclaycard) ++const singleUseMandateData = { ++ customer_acceptance: customerAcceptance, ++ mandate_type: { ++ single_use: { ++ amount: 6544, ++ currency: "USD", ++ }, ++ }, ++}; ++ ++const multiUseMandateData = { ++ customer_acceptance: customerAcceptance, ++ mandate_type: { ++ multi_use: { ++ amount: 6544, ++ currency: "USD", ++ }, ++ }, ++}; ++ ++const payment_method_data_3ds = { ++ card: { ++ last4: "2701", ++ card_type: "CREDIT", ++ card_network: "Visa", ++ card_issuer: "INTL HDQTRS-CENTER OWNED", ++ card_issuing_country: "UNITEDSTATES", ++ card_isin: "400000", ++ card_extended_bin: null, ++ card_exp_month: "01", ++ card_exp_year: "50", ++ card_holder_name: "joseph Doe", ++ payment_checks: null, ++ authentication_data: null, ++ }, ++ billing: null, ++}; ++ ++const billing_with_newline = { ++ address: { ++ line1: "1467", ++ line2: "Harrison Street\nApt 101", ++ line3: "Harrison Street\nApt 101", ++ city: "San Fransico\n city", ++ state: "California", ++ zip: "94122", ++ country: "NL", ++ first_name: "joseph", ++ last_name: "Doe", ++ }, ++ phone: { ++ number: "9123456789", ++ country_code: "+91", ++ }, ++}; ++ ++export const connectorDetails = { ++ card_pm: { ++ PaymentIntent: { ++ Request: { ++ currency: "USD", ++ amount: 6544, ++ customer_acceptance: null, ++ setup_future_usage: "on_session", ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "requires_payment_method", ++ setup_future_usage: "on_session", ++ }, ++ }, ++ }, ++ PaymentIntentOffSession: { ++ Configs: { ++ TRIGGER_SKIP: true, ++ }, ++ Request: { ++ currency: "USD", ++ customer_acceptance: null, ++ amount: 6544, ++ authentication_type: "no_three_ds", ++ setup_future_usage: "off_session", ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "requires_payment_method", ++ setup_future_usage: "off_session", ++ }, ++ }, ++ }, ++ PaymentIntentWithShippingCost: { ++ Request: { ++ currency: "USD", ++ shipping_cost: 50, ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "requires_payment_method", ++ shipping_cost: 50, ++ amount: 6544, ++ }, ++ }, ++ }, ++ PaymentConfirmWithShippingCost: { ++ Request: { ++ payment_method: "card", ++ payment_method_data: { ++ card: successfulNo3DSCardDetails, ++ }, ++ customer_acceptance: null, ++ setup_future_usage: "on_session", ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "succeeded", ++ shipping_cost: 50, ++ amount_received: 6594, ++ amount: 6544, ++ net_amount: 6594, ++ }, ++ }, ++ }, ++ "3DSManualCapture": { ++ Request: { ++ payment_method: "card", ++ payment_method_data: { ++ card: successfulThreeDSTestCardDetails, ++ }, ++ currency: "USD", ++ amount: 6544, ++ customer_acceptance: null, ++ setup_future_usage: "on_session", ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "requires_customer_action", ++ setup_future_usage: "on_session", ++ payment_method_data: payment_method_data_3ds, ++ }, ++ }, ++ }, ++ "3DSAutoCapture": { ++ Request: { ++ payment_method: "card", ++ payment_method_data: { ++ card: successfulThreeDSTestCardDetails, ++ }, ++ currency: "USD", ++ amount: 6544, ++ customer_acceptance: null, ++ setup_future_usage: "on_session", ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "requires_customer_action", ++ setup_future_usage: "on_session", ++ payment_method_data: payment_method_data_3ds, ++ }, ++ }, ++ }, ++ No3DSManualCapture: { ++ Request: { ++ payment_method: "card", ++ payment_method_data: { ++ card: successfulNo3DSCardDetails, ++ }, ++ currency: "USD", ++ amount: 6544, ++ customer_acceptance: null, ++ setup_future_usage: "on_session", ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "requires_capture", ++ payment_method: "card", ++ attempt_count: 1, ++ }, ++ }, ++ }, ++ Capture: { ++ Request: { ++ amount_to_capture: 6544, ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "succeeded", ++ amount: 6544, ++ amount_capturable: 0, ++ amount_received: 6544, ++ }, ++ }, ++ }, ++ PartialCapture: { ++ Configs: { ++ CONNECTOR_CREDENTIAL: { ++ value: "connector_1", ++ }, ++ }, ++ Request: { ++ amount_to_capture: 1000, ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "partially_captured", ++ amount: 6544, ++ amount_capturable: 0, ++ amount_received: 1000, ++ }, ++ }, ++ }, ++ Refund: { ++ Request: { ++ amount: 6544, ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "pending", ++ }, ++ }, ++ }, ++ SyncRefund: { ++ Response: { ++ status: 200, ++ body: { ++ status: "pending", ++ }, ++ }, ++ }, ++ PartialRefund: { ++ Request: { ++ amount: 1000, ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "pending", ++ amount: 1000, ++ }, ++ }, ++ }, ++ manualPaymentRefund: { ++ Request: { ++ amount: 6544, ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "pending", ++ amount: 6544, ++ }, ++ }, ++ }, ++ manualPaymentPartialRefund: { ++ Request: { ++ amount: 1000, ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "pending", ++ }, ++ }, ++ }, ++ MandateSingleUseNo3DSAutoCapture: { ++ Configs: { ++ TRIGGER_SKIP: true, ++ }, ++ Request: { ++ payment_method: "card", ++ payment_method_data: { ++ card: successfulNo3DSCardDetails, ++ }, ++ currency: "USD", ++ amount: 6544, ++ mandate_data: singleUseMandateData, ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "failed", ++ }, ++ }, ++ }, ++ MandateMultiUseNo3DSAutoCapture: { ++ Configs: { ++ TRIGGER_SKIP: true, ++ }, ++ Request: { ++ payment_method: "card", ++ payment_method_data: { ++ card: successfulNo3DSCardDetails, ++ }, ++ currency: "USD", ++ amount: 6544, ++ mandate_data: multiUseMandateData, ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "failed", ++ }, ++ }, ++ }, ++ No3DSAutoCapture: { ++ Request: { ++ payment_method: "card", ++ payment_method_data: { ++ card: successfulNo3DSCardDetails, ++ }, ++ currency: "USD", ++ amount: 6544, ++ customer_acceptance: null, ++ setup_future_usage: "on_session", ++ billing: billing_with_newline, ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "succeeded", ++ payment_method: "card", ++ attempt_count: 1, ++ }, ++ }, ++ }, ++ Void: { ++ Request: {}, ++ Response: { ++ status: 200, ++ body: { ++ status: "cancelled", ++ }, ++ }, ++ }, ++ MandateSingleUseNo3DSManualCapture: { ++ Configs: { ++ TRIGGER_SKIP: true, ++ }, ++ Request: { ++ payment_method: "card", ++ payment_method_data: { ++ card: successfulNo3DSCardDetails, ++ }, ++ currency: "USD", ++ mandate_data: singleUseMandateData, ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "failed", ++ }, ++ }, ++ }, ++ MandateMultiUseNo3DSManualCapture: { ++ Configs: { ++ TRIGGER_SKIP: true, ++ }, ++ Request: { ++ payment_method: "card", ++ payment_method_data: { ++ card: successfulNo3DSCardDetails, ++ }, ++ currency: "USD", ++ amount: 6544, ++ mandate_data: multiUseMandateData, ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "failed", ++ }, ++ }, ++ }, ++ MandateMultiUse3DSAutoCapture: { ++ Configs: { ++ TRIGGER_SKIP: true, ++ }, ++ Request: { ++ payment_method: "card", ++ payment_method_data: { ++ card: successfulThreeDSTestCardDetails, ++ }, ++ currency: "USD", ++ mandate_data: multiUseMandateData, ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "failed", ++ }, ++ }, ++ }, ++ MandateMultiUse3DSManualCapture: { ++ Configs: { ++ TRIGGER_SKIP: true, ++ }, ++ Request: { ++ payment_method: "card", ++ payment_method_data: { ++ card: successfulThreeDSTestCardDetails, ++ }, ++ currency: "USD", ++ mandate_data: multiUseMandateData, ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "failed", ++ }, ++ }, ++ }, ++ PaymentMethodIdMandateNo3DSAutoCapture: { ++ Configs: { ++ TRIGGER_SKIP: true, ++ }, ++ Request: { ++ payment_method: "card", ++ payment_method_data: { ++ card: successfulNo3DSCardDetails, ++ }, ++ currency: "USD", ++ mandate_data: null, ++ customer_acceptance: customerAcceptance, ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "failed", ++ }, ++ }, ++ }, ++ SaveCardUseNo3DSAutoCaptureOffSession: { ++ Configs: { ++ TRIGGER_SKIP: true, ++ }, ++ Request: { ++ payment_method: "card", ++ payment_method_type: "debit", ++ payment_method_data: { ++ card: successfulNo3DSCardDetails, ++ }, ++ amount: 6544, ++ setup_future_usage: "off_session", ++ customer_acceptance: customerAcceptance, ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "succeeded", ++ }, ++ }, ++ }, ++ SaveCardUseNo3DSAutoCapture: { ++ Configs: { ++ TRIGGER_SKIP: true, ++ }, ++ Request: { ++ payment_method: "card", ++ payment_method_data: { ++ card: successfulNo3DSCardDetails, ++ }, ++ amount: 6544, ++ currency: "USD", ++ setup_future_usage: "on_session", ++ customer_acceptance: customerAcceptance, ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "succeeded", ++ }, ++ }, ++ }, ++ SaveCardUse3DSAutoCaptureOffSession: { ++ Configs: { ++ TRIGGER_SKIP: true, ++ }, ++ Request: { ++ payment_method: "card", ++ payment_method_type: "debit", ++ payment_method_data: { ++ card: successfulThreeDSTestCardDetails, ++ }, ++ setup_future_usage: "off_session", ++ customer_acceptance: customerAcceptance, ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "requires_customer_action", ++ }, ++ }, ++ }, ++ SaveCardUseNo3DSManualCaptureOffSession: { ++ Configs: { ++ TRIGGER_SKIP: true, ++ }, ++ Request: { ++ payment_method: "card", ++ payment_method_data: { ++ card: successfulNo3DSCardDetails, ++ }, ++ setup_future_usage: "off_session", ++ customer_acceptance: customerAcceptance, ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "requires_capture", ++ }, ++ }, ++ }, ++ SaveCardConfirmAutoCaptureOffSession: { ++ Configs: { ++ TRIGGER_SKIP: true, ++ }, ++ Request: { ++ setup_future_usage: "off_session", ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "succeeded", ++ connector_mandate_id: "mock_barclaycard_mandate_id", ++ }, ++ }, ++ }, ++ SaveCardConfirmManualCaptureOffSession: { ++ Configs: { ++ TRIGGER_SKIP: true, ++ }, ++ Request: { ++ setup_future_usage: "off_session", ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "requires_capture", ++ connector_mandate_id: "mock_barclaycard_mandate_id", ++ }, ++ }, ++ }, ++ SaveCardConfirmAutoCaptureOffSessionWithoutBilling: { ++ Configs: { ++ TRIGGER_SKIP: true, ++ }, ++ Request: { ++ setup_future_usage: "off_session", ++ billing: null, ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "succeeded", ++ connector_mandate_id: "mock_barclaycard_mandate_id", ++ }, ++ }, ++ }, ++ PaymentMethodIdMandateNo3DSManualCapture: { ++ Configs: { ++ TRIGGER_SKIP: true, ++ }, ++ Request: { ++ payment_method: "card", ++ payment_method_data: { ++ card: successfulNo3DSCardDetails, ++ }, ++ currency: "USD", ++ mandate_data: null, ++ customer_acceptance: customerAcceptance, ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "failed", ++ }, ++ }, ++ }, ++ PaymentMethodIdMandate3DSAutoCapture: { ++ Configs: { ++ TRIGGER_SKIP: true, ++ }, ++ Request: { ++ payment_method: "card", ++ payment_method_data: { ++ card: successfulThreeDSTestCardDetails, ++ }, ++ currency: "USD", ++ mandate_data: null, ++ authentication_type: "three_ds", ++ customer_acceptance: customerAcceptance, ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "requires_customer_action", ++ }, ++ }, ++ }, ++ PaymentMethodIdMandate3DSManualCapture: { ++ Configs: { ++ TRIGGER_SKIP: true, ++ }, ++ Request: { ++ payment_method: "card", ++ payment_method_data: { ++ card: successfulThreeDSTestCardDetails, ++ }, ++ mandate_data: null, ++ authentication_type: "three_ds", ++ customer_acceptance: customerAcceptance, ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "requires_customer_action", ++ }, ++ }, ++ }, ++ MITAutoCapture: { ++ Configs: { ++ TRIGGER_SKIP: true, ++ }, ++ Request: {}, ++ Response: { ++ status: 200, ++ body: { ++ status: "succeeded", ++ }, ++ }, ++ }, ++ MITManualCapture: { ++ Configs: { ++ TRIGGER_SKIP: true, ++ }, ++ Request: {}, ++ Response: { ++ status: 200, ++ body: { ++ status: "failed", ++ }, ++ }, ++ }, ++ ZeroAuthMandate: { ++ Configs: { ++ TRIGGER_SKIP: true, ++ }, ++ Request: { ++ payment_method: "card", ++ payment_method_data: { ++ card: successfulNo3DSCardDetails, ++ }, ++ currency: "USD", ++ mandate_data: singleUseMandateData, ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "processing", ++ }, ++ }, ++ }, ++ ZeroAuthPaymentIntent: { ++ Configs: { ++ TRIGGER_SKIP: true, ++ }, ++ Request: { ++ amount: 0, ++ setup_future_usage: "off_session", ++ currency: "USD", ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "requires_payment_method", ++ setup_future_usage: "off_session", ++ }, ++ }, ++ }, ++ }, ++}; +diff --git a/cypress-tests/cypress/e2e/configs/Payment/Utils.js b/cypress-tests/cypress/e2e/configs/Payment/Utils.js +index 689a6eed..fcd4f6e4 100644 +--- a/cypress-tests/cypress/e2e/configs/Payment/Utils.js ++++ b/cypress-tests/cypress/e2e/configs/Payment/Utils.js +@@ -10,6 +10,7 @@ import { connectorDetails as authipayConnectorDetails } from "./Authipay.js"; + import { connectorDetails as authorizedotnetConnectorDetails } from "./Authorizedotnet.js"; + import { connectorDetails as bamboraConnectorDetails } from "./Bambora.js"; + import { connectorDetails as bamboraapacConnectorDetails } from "./Bamboraapac.js"; ++import { connectorDetails as barclaycardConnectorDetails } from "./Barclaycard.js"; + import { connectorDetails as bankOfAmericaConnectorDetails } from "./BankOfAmerica.js"; + import { connectorDetails as billwerkConnectorDetails } from "./Billwerk.js"; + import { connectorDetails as bluesnapConnectorDetails } from "./Bluesnap.js"; +@@ -69,6 +70,7 @@ const connectorDetails = { + authorizedotnet: authorizedotnetConnectorDetails, + bambora: bamboraConnectorDetails, + bamboraapac: bamboraapacConnectorDetails, ++ barclaycard: barclaycardConnectorDetails, + bankofamerica: bankOfAmericaConnectorDetails, + billwerk: billwerkConnectorDetails, + bluesnap: bluesnapConnectorDetails, +diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml +index 8dc043b5..9b81a63e 100644 +--- a/loadtest/config/development.toml ++++ b/loadtest/config/development.toml +@@ -773,6 +773,7 @@ sts_role_session_name = "" + [temp_locker_enable_config] + paybox = { payment_method = "card" } + redsys = { payment_method = "card" } ++barclaycard = { payment_method = "card" } + + [billing_connectors_payment_sync] + billing_connectors_which_require_payment_sync = "stripebilling, recurly" + +----- END CHUNK ----- \ No newline at end of file diff --git a/raw/1f/1ff2ed9477a691b23fd2882e2e53dd20078199d4.txt b/raw/1f/1ff2ed9477a691b23fd2882e2e53dd20078199d4.txt new file mode 100644 index 0000000000000000000000000000000000000000..6888e211c4d1d99c7c30545ddeae08090a0fcf92 --- /dev/null +++ b/raw/1f/1ff2ed9477a691b23fd2882e2e53dd20078199d4.txt @@ -0,0 +1,173 @@ +ROUTE: juspay/hyperswitch@1ff2ed9477a691b23fd2882e2e53dd20078199d4 +REPO: https://github.com/juspay/hyperswitch +COMMIT: 1ff2ed9477a691b23fd2882e2e53dd20078199d4 +AUTHOR: Anurag Thakur +DATE: 2025-08-28T02:31:13 + +=== ISSUE_AND_PR === +[PR #9068] fix(connector): Use SignatureKey for VGS auth_type +URL: https://github.com/juspay/hyperswitch/pull/9068 +BODY: +## Type of Change + + +- [x] Bugfix +- [ ] New feature +- [ ] Enhancement +- [ ] Refactoring +- [ ] Dependency updates +- [ ] Documentation +- [ ] CI/CD + +## Description + +- Change VGS auth type from BodyKey to SignatureKey + +### Additional Changes + +- [] This PR modifies the API contract +- [ ] This PR modifies the database schema +- [ ] This PR modifies application configuration/environment variables + + + + +## Motivation and Context + +Closes #9067 + +## How did you test it? + + +Request: + +``` +curl --location 'http://localhost:8080/v2/connector-accounts' \ +--header 'Content-Type: application/json' \ +--header 'Accept: application/json' \ +--header 'x-merchant-id: cloth_seller_v2_WmQmWko8QabakxqCypsz' \ +--header 'x-profile-id: pro_vnTuyThRZPNGRWjIHrIt' \ +--header 'Authorization: admin-api-key=test_admin' \ +--header 'api-key: test_admin' \ +--data '{ + "connector_type": "vault_processor", + "connector_name": "vgs", + "connector_account_details": { + "auth_type": "SignatureKey", + "api_key": "[REDACTED]", + "key1": "[REDACTED]", + "api_secret": "[REDACTED]" + }, + "frm_configs": null, + "connector_webhook_details": { + "merchant_secret": "" + }, + "profile_id": "pro_vnTuyThRZPNGRWjIHrIt" +}' + + +Response: + +```json +{ + "connector_type": "vault_processor", + "connector_name": "vgs", + "connector_label": "vgs_businesss", + "id": "mca_VsS4aBqNwMcPptFn4ZPL", + "profile_id": "pro_vnTuyThRZPNGRWjIHrIt", + "connector_account_details": { + "auth_type": "SignatureKey", + "api_key": "US********************q4", + "key1": "ca********************************07", + "api_secret": "st*ff" + }, + "payment_methods_enabled": null, + "connector_webhook_details": { + "merchant_secret": "", + "additional_secret": null + }, + "metadata": null, + "disabled": false, + "frm_configs": null, + "applepay_verified_domains": null, + "pm_auth_config": null, + "status": "active", + "additional_merchant_data": null, + "connector_wallets_details": null, + "feature_metadata": null +} +``` +## Checklist + + +- [x] I formatted the code `cargo +nightly fmt --all` +- [x] I addressed lints thrown by `cargo clippy` +- [x] I reviewed the submitted code +- [ ] I added unit tests for my changes where possible +COMMENTS: +- semanticdiff-com[bot]: Review changes with  SemanticDiff +
+Changed Files +
+ +| File | Status | +| :--- | :--- | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9068/changes#crates/hyperswitch_connectors/src/connectors/vgs/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/vgs/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9068/changes#crates/hyperswitch_connectors/src/connectors/vgs/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9068/changes#crates/hyperswitch_connectors/src/connectors/vgs/transformers.rs)  52% smaller | + +
+ +=== COMMIT === +SUBJECT: fix(connector): Use SignatureKey for VGS auth_type (#9068) + +=== FILES === +Summary: 1 files changed, +8 -1 +- crates/hyperswitch_connectors/src/connectors/vgs/transformers.rs (+8 -1) + +=== PATCH === +diff --git a/crates/hyperswitch_connectors/src/connectors/vgs/transformers.rs b/crates/hyperswitch_connectors/src/connectors/vgs/transformers.rs +index 4915e2da..4f996c2f 100644 +--- a/crates/hyperswitch_connectors/src/connectors/vgs/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/vgs/transformers.rs +@@ -74,15 +74,22 @@ impl TryFrom<&VaultRouterData> for VgsInsertRequest { + pub struct VgsAuthType { + pub(super) username: Secret, + pub(super) password: Secret, ++ // vault_id is used in sessions API ++ pub(super) _vault_id: Secret, + } + + impl TryFrom<&ConnectorAuthType> for VgsAuthType { + type Error = error_stack::Report; + fn try_from(auth_type: &ConnectorAuthType) -> Result { + match auth_type { +- ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self { ++ ConnectorAuthType::SignatureKey { ++ api_key, ++ key1, ++ api_secret, ++ } => Ok(Self { + username: api_key.to_owned(), + password: key1.to_owned(), ++ _vault_id: api_secret.to_owned(), + }), + _ => Err(errors::ConnectorError::FailedToObtainAuthType.into()), + } + +----- END CHUNK ----- \ No newline at end of file diff --git a/raw/26/26930a47e905baf647f218328e81529951d4f563.txt b/raw/26/26930a47e905baf647f218328e81529951d4f563.txt new file mode 100644 index 0000000000000000000000000000000000000000..4fe8d7f0f71be13a985e44819ac272685c199d58 --- /dev/null +++ b/raw/26/26930a47e905baf647f218328e81529951d4f563.txt @@ -0,0 +1,336 @@ +ROUTE: juspay/hyperswitch@26930a47e905baf647f218328e81529951d4f563 +REPO: https://github.com/juspay/hyperswitch +COMMIT: 26930a47e905baf647f218328e81529951d4f563 +AUTHOR: Anurag Thakur +DATE: 2025-08-28T06:09:37 + +=== ISSUE_AND_PR === +[PR #9066] feat(router): Add payment_type to Get Intent response (v2) +URL: https://github.com/juspay/hyperswitch/pull/9066 +BODY: +## Type of Change + + +- [ ] Bugfix +- [ ] New feature +- [x] Enhancement +- [ ] Refactoring +- [ ] Dependency updates +- [ ] Documentation +- [ ] CI/CD + +## Description + +- Add `payment_type` to Payments Get Intent response + +### Additional Changes + +- [x] This PR modifies the API contract +- [ ] This PR modifies the database schema +- [ ] This PR modifies application configuration/environment variables + + + + +## Motivation and Context + +Closes #9065 + +## How did you test it? + + +Request: +``` +curl --location 'http://localhost:8080/v2/payments/create-intent' \ +--header 'api-key: dev_5DkqRwXafcKhIFXyzwGtSjrnqsQuFWELuWJsepMgoRrjY1AxF7lhtNGeeja9BEHt' \ +--header 'Content-Type: application/json' \ +--header 'x-profile-id: pro_RAH6QGkLhuQfmi97QhPZ' \ +--header 'Authorization: api-key=dev_5DkqRwXafcKhIFXyzwGtSjrnqsQuFWELuWJsepMgoRrjY1AxF7lhtNGeeja9BEHt' \ +--data-raw '{ + "amount_details": { + "order_amount": 1000, + "currency": "USD" + }, + "capture_method": "automatic", + "authentication_type": "three_ds", + "order_details": [ + { + "product_name": "Apple iphone 15", + "quantity": 1, + "amount": 1000 + } + ], + "billing": { + "address": { + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "city": "San Fransico", + "state": "California", + "zip": "94122", + "country": "US", + "first_name": "joseph", + "last_name": "Doe" + }, + "phone": { + "number": "123456789", + "country_code": "+1" + }, + "email": "user@gmail.com" + }, + "shipping": { + "address": { + "first_name": "John", + "last_name": "Dough", + "city": "Karwar", + "zip": "571201", + "state": "California", + "country": "US" + }, + "email": "example@example.com", + "phone": { + "number": "123456789", + "country_code": "+1" + } + }, + + "customer_id": "12345_cus_0198e5ff10ea7622abbf89f383110c99" +}' +``` + +Response: + +```json +{ + "id": "12345_pay_0198e5ff18b77a63ab0e91be36d6f9b7", + "status": "requires_payment_method", + "amount_details": { + "order_amount": 1000, + "currency": "USD", + "shipping_cost": null, + "order_tax_amount": null, + "external_tax_calculation": "skip", + "surcharge_calculation": "skip", + "surcharge_amount": null, + "tax_on_surcharge": null + }, + "client_secret": "cs_0198e5ff18c57d729ec8fbbb03141331", + "profile_id": "pro_RAH6QGkLhuQfmi97QhPZ", + "merchant_reference_id": null, + "routing_algorithm_id": null, + "capture_method": "automatic", + "authentication_type": "three_ds", + "billing": { + "address": { + "city": "San Fransico", + "country": "US", + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "zip": "94122", + "state": "California", + "first_name": "joseph", + "last_name": "Doe", + "origin_zip": null + }, + "phone": { + "number": "123456789", + "country_code": "+1" + }, + "email": "user@gmail.com" + }, + "shipping": { + "address": { + "city": "Karwar", + "country": "US", + "line1": null, + "line2": null, + "line3": null, + "zip": "571201", + "state": "California", + "first_name": "John", + "last_name": "Dough", + "origin_zip": null + }, + "phone": { + "number": "123456789", + "country_code": "+1" + }, + "email": "example@example.com" + }, + "customer_id": "12345_cus_0198e5ff10ea7622abbf89f383110c99", + "customer_present": "present", + "description": null, + "return_url": null, + "setup_future_usage": "on_session", + "apply_mit_exemption": "Skip", + "statement_descriptor": null, + "order_details": [ + { + "product_name": "Apple iphone 15", + "quantity": 1, + "amount": 1000, + "tax_rate": null, + "total_tax_amount": null, + "requires_shipping": null, + "product_img_link": null, + "product_id": null, + "category": null, + "sub_category": null, + "brand": null, + "product_type": null, + "product_tax_code": null, + "description": null, + "sku": null, + "upc": null, + "commodity_code": null, + "unit_of_measure": null, + "total_amount": null, + "unit_discount_amount": null + } + ], + "allowed_payment_method_types": null, + "metadata": null, + "connector_metadata": null, + "feature_metadata": null, + "payment_link_enabled": "Skip", + "payment_link_config": null, + "request_incremental_authorization": "false", + "expires_on": "2025-08-26T11:04:17.247Z", + "frm_metadata": null, + "request_external_three_ds_authentication": "Skip", + "payment_type": "normal" +} +``` + +## Checklist + + +- [x] I formatted the code `cargo +nightly fmt --all` +- [x] I addressed lints thrown by `cargo clippy` +- [x] I reviewed the submitted code +- [ ] I added unit tests for my changes where possible +COMMENTS: +- semanticdiff-com[bot]: Review changes with  SemanticDiff +
+Changed Files +
+ +| File | Status | +| :--- | :--- | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9066/changes#api-reference/v2/openapi_spec_v2.json)  [api\-reference/v2/openapi\_spec\_v2\.json](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9066/changes#api-reference/v2/openapi_spec_v2.json) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9066/changes#api-reference/v2/openapi_spec_v2.json)  34% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9066/changes#crates/api_models/src/payments.rs)  [crates/api\_models/src/payments\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9066/changes#crates/api_models/src/payments.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9066/changes#crates/api_models/src/payments.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9066/changes#crates/router/src/core/payments/transformers.rs)  [crates/router/src/core/payments/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9066/changes#crates/router/src/core/payments/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9066/changes#crates/router/src/core/payments/transformers.rs)  0% smaller | + +
+- hrithikesh026 [crates/router/src/core/payments/transformers.rs:2151]: ```suggestion + let is_cit_transaction = payment_intent.setup_future_usage.is_off_session() +``` + +=== COMMIT === +SUBJECT: feat(router): Add payment_type to Get Intent response (v2) (#9066) +BODY: +Co-authored-by: Hrithikesh <61539176+hrithikesh026@users.noreply.github.com> + +=== FILES === +Summary: 3 files changed, +28 -1 +- api-reference/v2/openapi_spec_v2.json (+5 -1) +- crates/api_models/src/payments.rs (+4 -0) +- crates/router/src/core/payments/transformers.rs (+19 -0) + +=== PATCH === +diff --git a/api-reference/v2/openapi_spec_v2.json b/api-reference/v2/openapi_spec_v2.json +index 2d9164f8..bfa65cdd 100644 +--- a/api-reference/v2/openapi_spec_v2.json ++++ b/api-reference/v2/openapi_spec_v2.json +@@ -19157,7 +19157,8 @@ + "payment_link_enabled", + "request_incremental_authorization", + "expires_on", +- "request_external_three_ds_authentication" ++ "request_external_three_ds_authentication", ++ "payment_type" + ], + "properties": { + "id": { +@@ -19318,6 +19319,9 @@ + }, + "request_external_three_ds_authentication": { + "$ref": "#/components/schemas/External3dsAuthenticationRequest" ++ }, ++ "payment_type": { ++ "$ref": "#/components/schemas/PaymentType" + } + }, + "additionalProperties": false +diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs +index 5660819c..fefbbed0 100644 +--- a/crates/api_models/src/payments.rs ++++ b/crates/api_models/src/payments.rs +@@ -654,6 +654,10 @@ pub struct PaymentsIntentResponse { + /// Whether to perform external authentication (if applicable) + #[schema(value_type = External3dsAuthenticationRequest)] + pub request_external_three_ds_authentication: common_enums::External3dsAuthenticationRequest, ++ ++ /// The type of the payment that differentiates between normal and various types of mandate payments ++ #[schema(value_type = PaymentType)] ++ pub payment_type: api_enums::PaymentType, + } + + #[cfg(feature = "v2")] +diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs +index 22fa8e4c..574a4a77 100644 +--- a/crates/router/src/core/payments/transformers.rs ++++ b/crates/router/src/core/payments/transformers.rs +@@ -2148,6 +2148,24 @@ where + ) -> RouterResponse { + let payment_intent = payment_data.get_payment_intent(); + let client_secret = payment_data.get_client_secret(); ++ ++ let is_cit_transaction = payment_intent.setup_future_usage.is_off_session(); ++ ++ let mandate_type = if payment_intent.customer_present ++ == common_enums::PresenceOfCustomerDuringPayment::Absent ++ { ++ Some(api::MandateTransactionType::RecurringMandateTransaction) ++ } else if is_cit_transaction { ++ Some(api::MandateTransactionType::NewMandateTransaction) ++ } else { ++ None ++ }; ++ ++ let payment_type = helpers::infer_payment_type( ++ payment_intent.amount_details.order_amount.into(), ++ mandate_type.as_ref(), ++ ); ++ + Ok(services::ApplicationResponse::JsonWithHeaders(( + Self { + id: payment_intent.id.clone(), +@@ -2201,6 +2219,7 @@ where + frm_metadata: payment_intent.frm_metadata.clone(), + request_external_three_ds_authentication: payment_intent + .request_external_three_ds_authentication, ++ payment_type, + }, + vec![], + ))) + +----- END CHUNK ----- \ No newline at end of file diff --git a/raw/2d/2da681a265ef85e90f5282acda3140e78aa847d5.txt b/raw/2d/2da681a265ef85e90f5282acda3140e78aa847d5.txt new file mode 100644 index 0000000000000000000000000000000000000000..2ccb7e720f298b26674cb23c6b8a3fcac483c0a6 --- /dev/null +++ b/raw/2d/2da681a265ef85e90f5282acda3140e78aa847d5.txt @@ -0,0 +1,161 @@ +ROUTE: juspay/hyperswitch@2da681a265ef85e90f5282acda3140e78aa847d5 +REPO: https://github.com/juspay/hyperswitch +COMMIT: 2da681a265ef85e90f5282acda3140e78aa847d5 +AUTHOR: Anurag +DATE: 2025-08-25T13:11:02 + +=== ISSUE_AND_PR === +[PR #9035] fix(connector): Add Support for CUSTOMERREQUEST Refund Reason in Adyen +URL: https://github.com/juspay/hyperswitch/pull/9035 +BODY: +## Type of Change + + +- [x] Bugfix +- [ ] New feature +- [ ] Enhancement +- [ ] Refactoring +- [ ] Dependency updates +- [ ] Documentation +- [ ] CI/CD + +Closes this [issue](https://github.com/juspay/hyperswitch/issues/9034) + +## Description + + +Added Support for CUSTOMERREQUEST Refund Reason in Adyen + +### Additional Changes + +- [ ] This PR modifies the API contract +- [ ] This PR modifies the database schema +- [ ] This PR modifies application configuration/environment variables + + + + +## Motivation and Context + + + +## How did you test it? + + +Postman Test: + +Refunds: + +Request: + +``` +curl --location 'http://localhost:8080/refunds' \ +--header 'Content-Type: application/json' \ +--header 'Accept: application/json' \ +--header 'api-key: dev_KYKqKi3f1IgAl2wzfLwajdyMApB5XvTmX7SjYWpAcuLRnYxXToxXjDDuMoKPJ5h2' \ +--data '{ + "payment_id": "pay_rcvdW42PBSd2ik1tYEpA", + "amount": 1000, + "reason": "CustomerRequest", + "refund_type": "instant", + "metadata": { + "udf1": "value1", + "new_customer": "true", + "login_date": "2019-09-10T10:11:12Z" + } +}' +``` + +Response: + +``` +{ + "refund_id": "ref_3UOUCY4WziTz0iWhRGjT", + "payment_id": "pay_rcvdW42PBSd2ik1tYEpA", + "amount": 1000, + "currency": "USD", + "status": "pending", + "reason": "CUSTOMER REQUEST", + "metadata": { + "udf1": "value1", + "new_customer": "true", + "login_date": "2019-09-10T10:11:12Z" + }, + "error_message": null, + "error_code": null, + "unified_code": null, + "unified_message": null, + "created_at": "2025-08-06T04:02:37.782Z", + "updated_at": "2025-08-06T04:02:39.280Z", + "connector": "adyen", + "profile_id": "pro_H4NAjXx3vY9NI4nQbXom", + "merchant_connector_id": "mca_EC2PLdAi5hhl8zAKbt0G", + "split_refunds": null, + "issuer_error_code": null, + "issuer_error_message": null +} +``` + + +## Checklist + + +- [x] I formatted the code `cargo +nightly fmt --all` +- [x] I addressed lints thrown by `cargo clippy` +- [x] I reviewed the submitted code +- [ ] I added unit tests for my changes where possible +COMMENTS: +- semanticdiff-com[bot]: Review changes with  SemanticDiff +
+Changed Files +
+ +| File | Status | +| :--- | :--- | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9035/changes#crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/adyen/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9035/changes#crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9035/changes#crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs)  6% smaller | + +
+ +=== COMMIT === +SUBJECT: fix(connector): Add Support for CUSTOMERREQUEST Refund Reason in Adyen (#9035) +BODY: +Co-authored-by: Anurag Singh +Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> + +=== FILES === +Summary: 1 files changed, +1 -1 +- crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs (+1 -1) + +=== PATCH === +diff --git a/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs b/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs +index 76a13085..db585199 100644 +--- a/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs +@@ -1415,7 +1415,7 @@ impl FromStr for AdyenRefundRequestReason { + fn from_str(s: &str) -> Result { + match s.to_uppercase().as_str() { + "FRAUD" => Ok(Self::FRAUD), +- "CUSTOMER REQUEST" => Ok(Self::CUSTOMERREQUEST), ++ "CUSTOMER REQUEST" | "CUSTOMERREQUEST" => Ok(Self::CUSTOMERREQUEST), + "RETURN" => Ok(Self::RETURN), + "DUPLICATE" => Ok(Self::DUPLICATE), + "OTHER" => Ok(Self::OTHER), + +----- END CHUNK ----- \ No newline at end of file diff --git a/raw/30/30925ca5dd51be93e33ac4492b85c2322263b3fc.txt b/raw/30/30925ca5dd51be93e33ac4492b85c2322263b3fc.txt new file mode 100644 index 0000000000000000000000000000000000000000..1d98a9067b0fbaef9c7de1d3623779df20770ff4 --- /dev/null +++ b/raw/30/30925ca5dd51be93e33ac4492b85c2322263b3fc.txt @@ -0,0 +1,1173 @@ +ROUTE: juspay/hyperswitch@30925ca5dd51be93e33ac4492b85c2322263b3fc +REPO: https://github.com/juspay/hyperswitch +COMMIT: 30925ca5dd51be93e33ac4492b85c2322263b3fc +AUTHOR: Pa1NarK <69745008+pixincreate@users.noreply.github.com> +DATE: 2025-08-26T07:05:51 + +=== ISSUE_AND_PR === +[PR #8878] refactor(connector): implement amount converter framework for authorizedotnet, bankofamerica +URL: https://github.com/juspay/hyperswitch/pull/8878 +BODY: +## Type of Change + + +- [ ] Bugfix +- [ ] New feature +- [ ] Enhancement +- [x] Refactoring +- [ ] Dependency updates +- [ ] Documentation +- [ ] CI/CD + +## Description + + +the existing amount conversion framework for certain connector is outdated. we need to migrate those connector to using the latest and greatest amount converter framework. + +base - float/string major unit +minor - minor unit / string minor unit + +### Additional Changes + +- [ ] This PR modifies the API contract +- [ ] This PR modifies the database schema +- [ ] This PR modifies application configuration/environment variables + + + + +## Motivation and Context + + +get_currency_unit is outdated. use `convert_amount` instead. + +closes https://github.com/juspay/hyperswitch/issues/8877 + +## How did you test it? + + +Make a payment through the below given connectors: + +
+ +AuthorizeDotNet + +```curl +curl --location 'http://localhost:8080/payments' \ +--header 'Content-Type: application/json' \ +--header 'Accept: application/json' \ +--header 'api-key: dev_GPAm65scUWcFztLSboWLXKFGeTVEHb3gnvFU5hBUCDITplwIhCvZTIJtoEJXHm4f' \ +--data-raw '{ + "amount": 91571, + "currency": "USD", + "confirm": true, + "capture_method": "automatic", + "capture_on": "2022-09-10T10:11:12Z", + "amount_to_capture": 91571, + "customer_id": "abcd", + "email": "guest@example.com", + "name": "John Doe", + "phone": "999999999", + "phone_country_code": "+65", + "description": "Its my first payment request", + "authentication_type": "no_three_ds", + "return_url": "https://duck.com", + "payment_method": "card", + "payment_method_type": "credit", + "payment_method_data": { + "card": { + "card_number": "370000000000002", + "card_exp_month": "10", + "card_exp_year": "25", + "card_holder_name": "joseph Doe", + "card_cvc": "900" + } + }, + "billing": { + "address": { + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "city": "San Fransico", + "state": "California", + "zip": "94122", + "country": "IN", + "first_name": "PiX" + } + }, + "shipping": { + "address": { + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "city": "San Fransico", + "state": "California", + "zip": "94122", + "country": "IN", + "first_name": "PiX" + } + }, + "statement_descriptor_name": "joseph", + "statement_descriptor_suffix": "JS", + "metadata": { + "udf1": "value1", + "new_customer": "true", + "login_date": "2019-09-10T10:11:12Z" + } +}' +``` +```json +{ + "payment_id": "pay_6X2FhljlpXZElDX4S6w4", + "merchant_id": "postman_merchant_GHAction_1754653643", + "status": "succeeded", + "amount": 91571, + "net_amount": 91571, + "shipping_cost": null, + "amount_capturable": 0, + "amount_received": 91571, + "connector": "authorizedotnet", + "client_secret": "pay_6X2FhljlpXZElDX4S6w4_secret_wzBJ9hkLmMcvSi0TeOEO", + "created": "2025-08-08T11:47:35.240Z", + "currency": "USD", + "customer_id": "abcd", + "customer": { + "id": "abcd", + "name": "John Doe", + "email": "guest@example.com", + "phone": "999999999", + "phone_country_code": "+65" + }, + "description": "Its my first payment request", + "refunds": null, + "disputes": null, + "mandate_id": null, + "mandate_data": null, + "setup_future_usage": null, + "off_session": null, + "capture_on": null, + "capture_method": "automatic", + "payment_method": "card", + "payment_method_data": { + "card": { + "last4": "0002", + "card_type": null, + "card_network": null, + "card_issuer": null, + "card_issuing_country": null, + "card_isin": "370000", + "card_extended_bin": null, + "card_exp_month": "10", + "card_exp_year": "25", + "card_holder_name": "joseph Doe", + "payment_checks": { + "description": "The street address and postal code matched.", + "avs_result_code": "Y" + }, + "authentication_data": null + }, + "billing": null + }, + "payment_token": null, + "shipping": { + "address": { + "city": "San Fransico", + "country": "IN", + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "zip": "94122", + "state": "California", + "first_name": "PiX", + "last_name": null, + "origin_zip": null + }, + "phone": null, + "email": null + }, + "billing": { + "address": { + "city": "San Fransico", + "country": "IN", + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "zip": "94122", + "state": "California", + "first_name": "PiX", + "last_name": null, + "origin_zip": null + }, + "phone": null, + "email": null + }, + "order_details": null, + "email": "guest@example.com", + "name": "John Doe", + "phone": "999999999", + "return_url": "https://duck.com/", + "authentication_type": "no_three_ds", + "statement_descriptor_name": "joseph", + "statement_descriptor_suffix": "JS", + "next_action": null, + "cancellation_reason": null, + "error_code": null, + "error_message": null, + "unified_code": null, + "unified_message": null, + "payment_experience": null, + "payment_method_type": "credit", + "connector_label": null, + "business_country": null, + "business_label": "default", + "business_sub_label": null, + "allowed_payment_method_types": null, + "ephemeral_key": { + "customer_id": "abcd", + "created_at": 1754653655, + "expires": 1754657255, + "secret": "epk_ea6ff7c1100c41d1bba3b9da469d973c" + }, + "manual_retry_allowed": false, + "connector_transaction_id": "120068658794", + "frm_message": null, + "metadata": { + "udf1": "value1", + "login_date": "2019-09-10T10:11:12Z", + "new_customer": "true" + }, + "connector_metadata": null, + "feature_metadata": null, + "reference_id": "120068658794", + "payment_link": null, + "profile_id": "pro_NKH5miAdwTzhqZnuLPi0", + "surcharge_details": null, + "attempt_count": 1, + "merchant_decision": null, + "merchant_connector_id": "mca_bPe6GSr5FuXF6Rt5G61B", + "incremental_authorization_allowed": null, + "authorization_count": null, + "incremental_authorizations": null, + "external_authentication_details": null, + "external_3ds_authentication_attempted": false, + "expires_on": "2025-08-08T12:02:35.240Z", + "fingerprint": null, + "browser_info": null, + "payment_channel": null, + "payment_method_id": null, + "network_transaction_id": null, + "payment_method_status": null, + "updated": "2025-08-08T11:47:36.237Z", + "split_payments": null, + "frm_metadata": null, + "extended_authorization_applied": null, + "capture_before": null, + "merchant_order_reference_id": null, + "order_tax_amount": null, + "connector_mandate_id": null, + "card_discovery": "manual", + "force_3ds_challenge": false, + "force_3ds_challenge_trigger": false, + "issuer_error_code": null, + "issuer_error_message": null, + "is_iframe_redirection_enabled": null, + "whole_connector_response": null, + "enable_partial_authorization": null +} +``` + +image + +
+ +
+ +BankOfAmerica + +```curl +curl --location 'http://localhost:8080/payments' \ +--header 'Content-Type: application/json' \ +--header 'Accept: application/json' \ +--header 'api-key: dev_HVl6AlLdFHw0br1H7IymoIgOV4rO4SMCHUl1ZUKtXO3qQy3s1wlEEA5IVRUqPTxn' \ +--data-raw '{ + "amount": 6540, + "currency": "USD", + "confirm": true, + "capture_method": "automatic", + "capture_on": "2022-09-10T10:11:12Z", + "amount_to_capture": 6540, + "customer_id": "StripeCustomer", + "email": "guest@example.com", + "name": "John Doe", + "phone": "999999999", + "phone_country_code": "+1", + "description": "Its my first payment request", + "authentication_type": "no_three_ds", + "return_url": "https://duck.com", + "payment_method": "card", + "setup_future_usage": "on_session", + "payment_method_type": "credit", + "payment_method_data": { + "card": { + "card_number": "4111111111111111", + "card_exp_month": "12", + "card_exp_year": "30", + "card_holder_name": "joseph Doe", + "card_cvc": "123" + } + }, + "billing": { + "address": { + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "city": "San Fransico", + "state": "California", + "zip": "94122", + "country": "US", + "first_name": "joseph", + "last_name": "Doe" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + }, + "shipping": { + "address": { + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "city": "San Fransico", + "state": "California", + "zip": "94122", + "country": "US", + "first_name": "joseph", + "last_name": "Doe" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + }, + "statement_descriptor_name": "joseph", + "statement_descriptor_suffix": "JS", + "metadata": { + "udf1": "value1", + "new_customer": "true", + "login_date": "2019-09-10T10:11:12Z" + } +}' +``` +```json +{ + "payment_id": "pay_25C27lo5euAv5R8VDQQg", + "merchant_id": "postman_merchant_GHAction_9700a943-a6a8-4bed-b484-3e2f24f5344a", + "status": "succeeded", + "amount": 6540, + "net_amount": 6540, + "shipping_cost": null, + "amount_capturable": 0, + "amount_received": 6540, + "connector": "bankofamerica", + "client_secret": "pay_25C27lo5euAv5R8VDQQg_secret_OEIaAxPmEZgTswpAE59V", + "created": "2025-08-08T12:24:05.622Z", + "currency": "USD", + "customer_id": "StripeCustomer", + "customer": { + "id": "StripeCustomer", + "name": "John Doe", + "email": "guest@example.com", + "phone": "999999999", + "phone_country_code": "+1" + }, + "description": "Its my first payment request", + "refunds": null, + "disputes": null, + "mandate_id": null, + "mandate_data": null, + "setup_future_usage": "on_session", + "off_session": null, + "capture_on": null, + "capture_method": "automatic", + "payment_method": "card", + "payment_method_data": { + "card": { + "last4": "1111", + "card_type": "CREDIT", + "card_network": "Visa", + "card_issuer": "JP Morgan", + "card_issuing_country": "INDIA", + "card_isin": "411111", + "card_extended_bin": null, + "card_exp_month": "12", + "card_exp_year": "30", + "card_holder_name": "joseph Doe", + "payment_checks": { + "eci": null, + "cavv": null, + "eci_raw": null, + "avs_response": { + "code": "Y", + "codeRaw": "Y" + }, + "approval_code": "831000", + "card_verification": null, + "consumer_authentication_response": null + }, + "authentication_data": { + "acs_transaction_id": null, + "system_trace_audit_number": null, + "retrieval_reference_number": null + } + }, + "billing": null + }, + "payment_token": "token_KTsWPzXqxSUFnBg64dG9", + "shipping": { + "address": { + "city": "San Fransico", + "country": "US", + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "zip": "94122", + "state": "California", + "first_name": "joseph", + "last_name": "Doe", + "origin_zip": null + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + }, + "email": null + }, + "billing": { + "address": { + "city": "San Fransico", + "country": "US", + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "zip": "94122", + "state": "California", + "first_name": "joseph", + "last_name": "Doe", + "origin_zip": null + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + }, + "email": null + }, + "order_details": null, + "email": "guest@example.com", + "name": "John Doe", + "phone": "999999999", + "return_url": "https://duck.com/", + "authentication_type": "no_three_ds", + "statement_descriptor_name": "joseph", + "statement_descriptor_suffix": "JS", + "next_action": null, + "cancellation_reason": null, + "error_code": null, + "error_message": null, + "unified_code": null, + "unified_message": null, + "payment_experience": null, + "payment_method_type": "credit", + "connector_label": null, + "business_country": null, + "business_label": "default", + "business_sub_label": null, + "allowed_payment_method_types": null, + "ephemeral_key": { + "customer_id": "StripeCustomer", + "created_at": 1754655845, + "expires": 1754659445, + "secret": "epk_dbaa2f9dc5ca4740a7ee13edb03af456" + }, + "manual_retry_allowed": false, + "connector_transaction_id": "7546558471516585304807", + "frm_message": null, + "metadata": { + "udf1": "value1", + "login_date": "2019-09-10T10:11:12Z", + "new_customer": "true" + }, + "connector_metadata": null, + "feature_metadata": null, + "reference_id": "pay_25C27lo5euAv5R8VDQQg_1", + "payment_link": null, + "profile_id": "pro_7ehsLWIksrpK2lU2ZorM", + "surcharge_details": null, + "attempt_count": 1, + "merchant_decision": null, + "merchant_connector_id": "mca_QXI5zECI8F4KGJwceq1a", + "incremental_authorization_allowed": null, + "authorization_count": null, + "incremental_authorizations": null, + "external_authentication_details": null, + "external_3ds_authentication_attempted": false, + "expires_on": "2025-08-08T12:39:05.622Z", + "fingerprint": null, + "browser_info": null, + "payment_channel": null, + "payment_method_id": null, + "network_transaction_id": null, + "payment_method_status": null, + "updated": "2025-08-08T12:24:07.638Z", + "split_payments": null, + "frm_metadata": null, + "extended_authorization_applied": null, + "capture_before": null, + "merchant_order_reference_id": null, + "order_tax_amount": null, + "connector_mandate_id": null, + "card_discovery": "manual", + "force_3ds_challenge": false, + "force_3ds_challenge_trigger": false, + "issuer_error_code": null, + "issuer_error_message": null, + "is_iframe_redirection_enabled": null, + "whole_connector_response": null, + "enable_partial_authorization": null +} +``` + +image + +
+ +
+ +Refunds should work too + +```curl +curl --location 'http://localhost:8080/refunds' \ +--header 'Content-Type: application/json' \ +--header 'Accept: application/json' \ +--header 'api-key: dev_ecAzD6wCRTJ9vle4P8dSItXfE8hyWMx5ZInf03wYUoDE9YuOnbOU4ppvw24R12HP' \ +--data '{ + "payment_id": "pay_fFRCa0avK5F1mMiNIRDo", + "amount": 600, + "reason": "Customer returned product", + "refund_type": "instant", + "metadata": { + "udf1": "value1", + "new_customer": "true", + "login_date": "2019-09-10T10:11:12Z" + } +}' +``` +```json +{ + "refund_id": "ref_yiG83sVnRamfqs9wZui4", + "payment_id": "pay_fFRCa0avK5F1mMiNIRDo", + "amount": 600, + "currency": "USD", + "status": "pending", + "reason": "Customer returned product", + "metadata": { + "udf1": "value1", + "new_customer": "true", + "login_date": "2019-09-10T10:11:12Z" + }, + "error_message": null, + "error_code": null, + "unified_code": null, + "unified_message": null, + "created_at": "2025-08-08T12:39:37.424Z", + "updated_at": "2025-08-08T12:39:39.187Z", + "connector": "barclaycard", + "profile_id": "pro_zdyJ6MbtU1anAIfbiSim", + "merchant_connector_id": "mca_P2TahMotR8ucEv5vaKDr", + "split_refunds": null, + "issuer_error_code": null, + "issuer_error_message": null +} +``` + +image + +
+ +## Checklist + + +- [x] I formatted the code `cargo +nightly fmt --all` +- [x] I addressed lints thrown by `just clippy && just clippy_v2` +- [x] I reviewed the submitted code +- [ ] I added unit tests for my changes where possible +COMMENTS: +- semanticdiff-com[bot]: Review changes with  SemanticDiff +
+Changed Files +
+ +| File | Status | +| :--- | :--- | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8878/changes#crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/authorizedotnet/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8878/changes#crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8878/changes#crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers.rs)  36% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8878/changes#crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/bankofamerica/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8878/changes#crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8878/changes#crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs)  34% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8878/changes#crates/hyperswitch_connectors/src/connectors/bankofamerica.rs)  [crates/hyperswitch\_connectors/src/connectors/bankofamerica\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8878/changes#crates/hyperswitch_connectors/src/connectors/bankofamerica.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8878/changes#crates/hyperswitch_connectors/src/connectors/bankofamerica.rs)  11% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8878/changes#crates/hyperswitch_connectors/src/connectors/authorizedotnet.rs)  [crates/hyperswitch\_connectors/src/connectors/authorizedotnet\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8878/changes#crates/hyperswitch_connectors/src/connectors/authorizedotnet.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8878/changes#crates/hyperswitch_connectors/src/connectors/authorizedotnet.rs)  11% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8878/changes#crates/router/src/types/api/connector_mapping.rs)  [crates/router/src/types/api/connector\_mapping\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8878/changes#crates/router/src/types/api/connector_mapping.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8878/changes#crates/router/src/types/api/connector_mapping.rs)  5% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8878/changes#crates/router/src/types/api/feature_matrix.rs)  [crates/router/src/types/api/feature\_matrix\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8878/changes#crates/router/src/types/api/feature_matrix.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8878/changes#crates/router/src/types/api/feature_matrix.rs)  5% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8878/changes#crates/router/tests/connectors/authorizedotnet.rs)  [crates/router/tests/connectors/authorizedotnet\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8878/changes#crates/router/tests/connectors/authorizedotnet.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8878/changes#crates/router/tests/connectors/authorizedotnet.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8878/changes#crates/router/tests/connectors/bankofamerica.rs)  [crates/router/tests/connectors/bankofamerica\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8878/changes#crates/router/tests/connectors/bankofamerica.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8878/changes#crates/router/tests/connectors/bankofamerica.rs)  0% smaller | + +
+ +=== COMMIT === +SUBJECT: refactor(connector): implement amount converter framework for authorizedotnet, bankofamerica (#8878) + +=== FILES === +Summary: 8 files changed, +125 -100 +- crates/hyperswitch_connectors/src/connectors/authorizedotnet.rs (+48 -29) +- crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers.rs (+8 -10) +- crates/hyperswitch_connectors/src/connectors/bankofamerica.rs (+48 -30) +- crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs (+7 -17) +- crates/router/src/types/api/connector_mapping.rs (+6 -6) +- crates/router/src/types/api/feature_matrix.rs (+6 -6) +- crates/router/tests/connectors/authorizedotnet.rs (+1 -1) +- crates/router/tests/connectors/bankofamerica.rs (+1 -1) + +=== PATCH === +diff --git a/crates/hyperswitch_connectors/src/connectors/authorizedotnet.rs b/crates/hyperswitch_connectors/src/connectors/authorizedotnet.rs +index 536a2d2a..7105bf0b 100644 +--- a/crates/hyperswitch_connectors/src/connectors/authorizedotnet.rs ++++ b/crates/hyperswitch_connectors/src/connectors/authorizedotnet.rs +@@ -1,5 +1,5 @@ + pub mod transformers; +-use std::{fmt::Debug, sync::LazyLock}; ++use std::sync::LazyLock; + + use common_enums::{enums, PaymentAction}; + use common_utils::{ +@@ -7,6 +7,7 @@ use common_utils::{ + errors::CustomResult, + ext_traits::ByteSliceExt, + request::{Method, Request, RequestBuilder, RequestContent}, ++ types::{AmountConvertor, FloatMajorUnit, FloatMajorUnitForConnector}, + }; + use error_stack::ResultExt; + use hyperswitch_domain_models::{ +@@ -53,16 +54,27 @@ use masking::Maskable; + use transformers as authorizedotnet; + + use crate::{ ++ connectors::authorizedotnet::transformers::AuthorizedotnetRouterData, + constants::headers, + types::ResponseRouterData, + utils::{ +- self as connector_utils, ForeignTryFrom, PaymentMethodDataType, ++ self as connector_utils, convert_amount, ForeignTryFrom, PaymentMethodDataType, + PaymentsAuthorizeRequestData, PaymentsCompleteAuthorizeRequestData, + }, + }; + +-#[derive(Debug, Clone)] +-pub struct Authorizedotnet; ++#[derive(Clone)] ++pub struct Authorizedotnet { ++ amount_convertor: &'static (dyn AmountConvertor + Sync), ++} ++ ++impl Authorizedotnet { ++ pub fn new() -> &'static Self { ++ &Self { ++ amount_convertor: &FloatMajorUnitForConnector, ++ } ++ } ++} + + impl ConnectorCommonExt for Authorizedotnet + where +@@ -369,12 +381,13 @@ impl ConnectorIntegration fo + req: &PaymentsCaptureRouterData, + _connectors: &Connectors, + ) -> CustomResult { +- let connector_router_data = authorizedotnet::AuthorizedotnetRouterData::try_from(( +- &self.get_currency_unit(), ++ let amount = convert_amount( ++ self.amount_convertor, ++ req.request.minor_amount_to_capture, + req.request.currency, +- req.request.amount_to_capture, +- req, +- ))?; ++ )?; ++ ++ let connector_router_data = AuthorizedotnetRouterData::try_from((amount, req))?; + let connector_req = + authorizedotnet::CancelOrCaptureTransactionRequest::try_from(&connector_router_data)?; + +@@ -550,14 +563,16 @@ impl ConnectorIntegration CustomResult { +- let connector_router_data = authorizedotnet::AuthorizedotnetRouterData::try_from(( +- &self.get_currency_unit(), ++ let amount = convert_amount( ++ self.amount_convertor, ++ req.request.minor_amount, + req.request.currency, +- req.request.amount, +- req, +- ))?; ++ )?; ++ ++ let connector_router_data = AuthorizedotnetRouterData::try_from((amount, req))?; + let connector_req = + authorizedotnet::CreateTransactionRequest::try_from(&connector_router_data)?; ++ + Ok(RequestContent::Json(Box::new(connector_req))) + } + +@@ -731,12 +746,13 @@ impl ConnectorIntegration for Authori + req: &RefundsRouterData, + _connectors: &Connectors, + ) -> CustomResult { +- let connector_router_data = authorizedotnet::AuthorizedotnetRouterData::try_from(( +- &self.get_currency_unit(), ++ let amount = convert_amount( ++ self.amount_convertor, ++ req.request.minor_refund_amount, + req.request.currency, +- req.request.refund_amount, +- req, +- ))?; ++ )?; ++ ++ let connector_router_data = AuthorizedotnetRouterData::try_from((amount, req))?; + let connector_req = authorizedotnet::CreateRefundRequest::try_from(&connector_router_data)?; + + Ok(RequestContent::Json(Box::new(connector_req))) +@@ -819,12 +835,13 @@ impl ConnectorIntegration for Authorize + req: &RefundsRouterData, + _connectors: &Connectors, + ) -> CustomResult { +- let connector_router_data = authorizedotnet::AuthorizedotnetRouterData::try_from(( +- &self.get_currency_unit(), ++ let amount = convert_amount( ++ self.amount_convertor, ++ req.request.minor_refund_amount, + req.request.currency, +- req.request.refund_amount, +- req, +- ))?; ++ )?; ++ ++ let connector_router_data = AuthorizedotnetRouterData::try_from((amount, req))?; + let connector_req = + authorizedotnet::AuthorizedotnetCreateSyncRequest::try_from(&connector_router_data)?; + +@@ -910,12 +927,14 @@ impl ConnectorIntegration CustomResult { +- let connector_router_data = authorizedotnet::AuthorizedotnetRouterData::try_from(( +- &self.get_currency_unit(), ++ let amount = convert_amount( ++ self.amount_convertor, ++ req.request.minor_amount, + req.request.currency, +- req.request.amount, +- req, +- ))?; ++ )?; ++ ++ let connector_router_data = AuthorizedotnetRouterData::try_from((amount, req))?; ++ + let connector_req = + authorizedotnet::PaypalConfirmRequest::try_from(&connector_router_data)?; + +diff --git a/crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers.rs b/crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers.rs +index b887fe6f..b820e30a 100644 +--- a/crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers.rs +@@ -8,6 +8,7 @@ use common_utils::{ + id_type::CustomerId, + pii::Email, + request::Method, ++ types::FloatMajorUnit, + }; + use error_stack::ResultExt; + use hyperswitch_domain_models::{ +@@ -27,7 +28,7 @@ use hyperswitch_domain_models::{ + RefundsRouterData, SetupMandateRouterData, + }, + }; +-use hyperswitch_interfaces::{api, errors}; ++use hyperswitch_interfaces::errors; + use masking::{ExposeInterface, PeekInterface, Secret, StrongSecret}; + use rand::distributions::{Alphanumeric, DistString}; + use serde::{Deserialize, Serialize}; +@@ -67,16 +68,13 @@ pub enum TransactionType { + + #[derive(Debug, Serialize)] + pub struct AuthorizedotnetRouterData { +- pub amount: f64, ++ pub amount: FloatMajorUnit, + pub router_data: T, + } + +-impl TryFrom<(&api::CurrencyUnit, enums::Currency, i64, T)> for AuthorizedotnetRouterData { ++impl TryFrom<(FloatMajorUnit, T)> for AuthorizedotnetRouterData { + type Error = error_stack::Report; +- fn try_from( +- (currency_unit, currency, amount, item): (&api::CurrencyUnit, enums::Currency, i64, T), +- ) -> Result { +- let amount = utils::get_amount_as_f64(currency_unit, amount, currency)?; ++ fn try_from((amount, item): (FloatMajorUnit, T)) -> Result { + Ok(Self { + amount, + router_data: item, +@@ -155,7 +153,7 @@ pub enum WalletMethod { + #[serde(rename_all = "camelCase")] + struct TransactionRequest { + transaction_type: TransactionType, +- amount: f64, ++ amount: FloatMajorUnit, + currency_code: common_enums::Currency, + #[serde(skip_serializing_if = "Option::is_none")] + payment: Option, +@@ -276,7 +274,7 @@ struct AuthorizationIndicator { + struct TransactionVoidOrCaptureRequest { + transaction_type: TransactionType, + #[serde(skip_serializing_if = "Option::is_none")] +- amount: Option, ++ amount: Option, + ref_trans_id: String, + } + +@@ -1635,7 +1633,7 @@ impl TryFrom + Sync), ++} ++ ++impl Bankofamerica { ++ pub fn new() -> &'static Self { ++ &Self { ++ amount_convertor: &StringMajorUnitForConnector, ++ } ++ } ++} + + impl api::Payment for Bankofamerica {} + impl api::PaymentSession for Bankofamerica {} +@@ -481,14 +491,16 @@ impl ConnectorIntegration CustomResult { +- let connector_router_data = bankofamerica::BankOfAmericaRouterData::try_from(( +- &self.get_currency_unit(), ++ let amount = convert_amount( ++ self.amount_convertor, ++ req.request.minor_amount, + req.request.currency, +- req.request.amount, +- req, +- ))?; ++ )?; ++ ++ let connector_router_data = BankOfAmericaRouterData::try_from((amount, req))?; + let connector_req = + bankofamerica::BankOfAmericaPaymentsRequest::try_from(&connector_router_data)?; ++ + Ok(RequestContent::Json(Box::new(connector_req))) + } + +@@ -682,14 +694,16 @@ impl ConnectorIntegration fo + req: &PaymentsCaptureRouterData, + _connectors: &Connectors, + ) -> CustomResult { +- let connector_router_data = bankofamerica::BankOfAmericaRouterData::try_from(( +- &self.get_currency_unit(), ++ let amount = convert_amount( ++ self.amount_convertor, ++ req.request.minor_amount_to_capture, + req.request.currency, +- req.request.amount_to_capture, +- req, +- ))?; ++ )?; ++ ++ let connector_router_data = BankOfAmericaRouterData::try_from((amount, req))?; + let connector_req = + bankofamerica::BankOfAmericaCaptureRequest::try_from(&connector_router_data)?; ++ + Ok(RequestContent::Json(Box::new(connector_req))) + } + +@@ -800,20 +814,22 @@ impl ConnectorIntegration for Ba + req: &PaymentsCancelRouterData, + _connectors: &Connectors, + ) -> CustomResult { +- let connector_router_data = bankofamerica::BankOfAmericaRouterData::try_from(( +- &self.get_currency_unit(), ++ let minor_amount = + req.request +- .currency ++ .minor_amount + .ok_or(errors::ConnectorError::MissingRequiredField { +- field_name: "Currency", +- })?, ++ field_name: "Amount", ++ })?; ++ let currency = + req.request +- .amount ++ .currency + .ok_or(errors::ConnectorError::MissingRequiredField { +- field_name: "Amount", +- })?, +- req, +- ))?; ++ field_name: "Currency", ++ })?; ++ ++ let amount = convert_amount(self.amount_convertor, minor_amount, currency)?; ++ ++ let connector_router_data = BankOfAmericaRouterData::try_from((amount, req))?; + let connector_req = + bankofamerica::BankOfAmericaVoidRequest::try_from(&connector_router_data)?; + +@@ -925,14 +941,16 @@ impl ConnectorIntegration for Bankofa + req: &RefundsRouterData, + _connectors: &Connectors, + ) -> CustomResult { +- let connector_router_data = bankofamerica::BankOfAmericaRouterData::try_from(( +- &self.get_currency_unit(), ++ let amount = convert_amount( ++ self.amount_convertor, ++ req.request.minor_refund_amount, + req.request.currency, +- req.request.refund_amount, +- req, +- ))?; ++ )?; ++ ++ let connector_router_data = BankOfAmericaRouterData::try_from((amount, req))?; + let connector_req = + bankofamerica::BankOfAmericaRefundRequest::try_from(&connector_router_data)?; ++ + Ok(RequestContent::Json(Box::new(connector_req))) + } + +diff --git a/crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs b/crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs +index 07f0a961..2f8f942a 100644 +--- a/crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs +@@ -1,7 +1,7 @@ + use base64::Engine; + use common_enums::{enums, FutureUsage}; + use common_types::payments::ApplePayPredecryptData; +-use common_utils::{consts, ext_traits::OptionExt, pii}; ++use common_utils::{consts, ext_traits::OptionExt, pii, types::StringMajorUnit}; + use hyperswitch_domain_models::{ + payment_method_data::{ + ApplePayWalletData, GooglePayWalletData, PaymentMethodData, SamsungPayWalletData, +@@ -64,23 +64,13 @@ impl TryFrom<&ConnectorAuthType> for BankOfAmericaAuthType { + } + + pub struct BankOfAmericaRouterData { +- pub amount: String, ++ pub amount: StringMajorUnit, + pub router_data: T, + } + +-impl TryFrom<(&api::CurrencyUnit, api_models::enums::Currency, i64, T)> +- for BankOfAmericaRouterData +-{ ++impl TryFrom<(StringMajorUnit, T)> for BankOfAmericaRouterData { + type Error = error_stack::Report; +- fn try_from( +- (currency_unit, currency, amount, item): ( +- &api::CurrencyUnit, +- api_models::enums::Currency, +- i64, +- T, +- ), +- ) -> Result { +- let amount = utils::get_amount_as_string(currency_unit, amount, currency)?; ++ fn try_from((amount, item): (StringMajorUnit, T)) -> Result { + Ok(Self { + amount, + router_data: item, +@@ -275,7 +265,7 @@ pub struct OrderInformationWithBill { + #[derive(Debug, Serialize)] + #[serde(rename_all = "camelCase")] + pub struct Amount { +- total_amount: String, ++ total_amount: StringMajorUnit, + currency: api_models::enums::Currency, + } + +@@ -1502,7 +1492,7 @@ pub struct Initiator { + pub struct MerchantInitiatedTransactionResponse { + agreement_id: Option, + previous_transaction_id: Option, +- original_authorized_amount: Option, ++ original_authorized_amount: Option, + reason: Option, + } + +@@ -2573,7 +2563,7 @@ impl TryFrom<&SetupMandateRouterData> for OrderInformationWithBill { + + Ok(Self { + amount_details: Amount { +- total_amount: "0".to_string(), ++ total_amount: StringMajorUnit::zero(), + currency: item.request.currency, + }, + bill_to: Some(bill_to), +diff --git a/crates/router/src/types/api/connector_mapping.rs b/crates/router/src/types/api/connector_mapping.rs +index 5611df58..2d8ae49d 100644 +--- a/crates/router/src/types/api/connector_mapping.rs ++++ b/crates/router/src/types/api/connector_mapping.rs +@@ -126,18 +126,18 @@ impl ConnectorData { + enums::Connector::Authipay => { + Ok(ConnectorEnum::Old(Box::new(connector::Authipay::new()))) + } +- enums::Connector::Authorizedotnet => { +- Ok(ConnectorEnum::Old(Box::new(&connector::Authorizedotnet))) +- } ++ enums::Connector::Authorizedotnet => Ok(ConnectorEnum::Old(Box::new( ++ connector::Authorizedotnet::new(), ++ ))), + enums::Connector::Bambora => { + Ok(ConnectorEnum::Old(Box::new(connector::Bambora::new()))) + } + enums::Connector::Bamboraapac => { + Ok(ConnectorEnum::Old(Box::new(connector::Bamboraapac::new()))) + } +- enums::Connector::Bankofamerica => { +- Ok(ConnectorEnum::Old(Box::new(&connector::Bankofamerica))) +- } ++ enums::Connector::Bankofamerica => Ok(ConnectorEnum::Old(Box::new( ++ connector::Bankofamerica::new(), ++ ))), + enums::Connector::Barclaycard => { + Ok(ConnectorEnum::Old(Box::new(connector::Barclaycard::new()))) + } +diff --git a/crates/router/src/types/api/feature_matrix.rs b/crates/router/src/types/api/feature_matrix.rs +index 5896e926..6388442b 100644 +--- a/crates/router/src/types/api/feature_matrix.rs ++++ b/crates/router/src/types/api/feature_matrix.rs +@@ -40,18 +40,18 @@ impl FeatureMatrixConnectorData { + enums::Connector::Authipay => { + Ok(ConnectorEnum::Old(Box::new(connector::Authipay::new()))) + } +- enums::Connector::Authorizedotnet => { +- Ok(ConnectorEnum::Old(Box::new(&connector::Authorizedotnet))) +- } ++ enums::Connector::Authorizedotnet => Ok(ConnectorEnum::Old(Box::new( ++ connector::Authorizedotnet::new(), ++ ))), + enums::Connector::Bambora => { + Ok(ConnectorEnum::Old(Box::new(connector::Bambora::new()))) + } + enums::Connector::Bamboraapac => { + Ok(ConnectorEnum::Old(Box::new(connector::Bamboraapac::new()))) + } +- enums::Connector::Bankofamerica => { +- Ok(ConnectorEnum::Old(Box::new(&connector::Bankofamerica))) +- } ++ enums::Connector::Bankofamerica => Ok(ConnectorEnum::Old(Box::new( ++ connector::Bankofamerica::new(), ++ ))), + enums::Connector::Barclaycard => { + Ok(ConnectorEnum::Old(Box::new(connector::Barclaycard::new()))) + } +diff --git a/crates/router/tests/connectors/authorizedotnet.rs b/crates/router/tests/connectors/authorizedotnet.rs +index f09b75c6..e7519136 100644 +--- a/crates/router/tests/connectors/authorizedotnet.rs ++++ b/crates/router/tests/connectors/authorizedotnet.rs +@@ -15,7 +15,7 @@ impl utils::Connector for AuthorizedotnetTest { + fn get_data(&self) -> types::api::ConnectorData { + use router::connector::Authorizedotnet; + utils::construct_connector_data_old( +- Box::new(&Authorizedotnet), ++ Box::new(Authorizedotnet::new()), + types::Connector::Authorizedotnet, + types::api::GetToken::Connector, + None, +diff --git a/crates/router/tests/connectors/bankofamerica.rs b/crates/router/tests/connectors/bankofamerica.rs +index 29133fcd..cea3c2d6 100644 +--- a/crates/router/tests/connectors/bankofamerica.rs ++++ b/crates/router/tests/connectors/bankofamerica.rs +@@ -11,7 +11,7 @@ impl utils::Connector for BankofamericaTest { + fn get_data(&self) -> types::api::ConnectorData { + use router::connector::Bankofamerica; + utils::construct_connector_data_old( +- Box::new(&Bankofamerica), ++ Box::new(Bankofamerica::new()), + // Remove `dummy_connector` feature gate from module in `main.rs` when updating this to use actual connector variant + types::Connector::DummyConnector1, + types::api::GetToken::Connector, + +----- END CHUNK ----- \ No newline at end of file diff --git a/raw/47/47ae9908e1b3adc6d889e13742959e466e878c79.txt b/raw/47/47ae9908e1b3adc6d889e13742959e466e878c79.txt new file mode 100644 index 0000000000000000000000000000000000000000..aabe0016a16be532a4ca55ee260db62f73ea4a08 --- /dev/null +++ b/raw/47/47ae9908e1b3adc6d889e13742959e466e878c79.txt @@ -0,0 +1,1402 @@ +ROUTE: juspay/hyperswitch@47ae9908e1b3adc6d889e13742959e466e878c79 +REPO: https://github.com/juspay/hyperswitch +COMMIT: 47ae9908e1b3adc6d889e13742959e466e878c79 +AUTHOR: Ayush Anand <114248859+ayush22667@users.noreply.github.com> +DATE: 2025-08-21T13:50:59 + +=== ISSUE_AND_PR === +[PR #8794] feat(payments): add PaymentListFilterConstraints and payments_list_by_filter endpoint for v2 +URL: https://github.com/juspay/hyperswitch/pull/8794 +BODY: +## Type of Change + + +- [ ] Bugfix +- [X] New feature +- [ ] Enhancement +- [ ] Refactoring +- [ ] Dependency updates +- [ ] Documentation +- [ ] CI/CD + +## Description + +**Enhanced Payment Listing API with Multi-Value Filtering** + +This feature adds support for retrieving a filtered list of payments via a `GET /v2/payments/list` endpoint where multiple values can be provided for a single filter key (e.g. `status`, `currency`, `connector`, etc.). + + +### Additional Changes + +- [X] This PR modifies the API contract +- [ ] This PR modifies the database schema +- [ ] This PR modifies application configuration/environment variables + + + + +## Motivation and Context + + + +## How did you test it? + +GetRequest: +``` +curl --location 'http://localhost:8080/v2/payments/list' \ +--header 'api-key: dev_tP1IAK95c65hjO7NvF3dRliuiMuSIFhIeFjXBb1du3NZ1Ui6Av0XKyL3ONtB7tpy' \ +--header 'Content-Type: application/json' \ +--header 'x-profile-id: pro_G9buhoAY3Mpu9cFIeWoZ' \ +--header 'Authorization: api-key=dev_tP1IAK95c65hjO7NvF3dRliuiMuSIFhIeFjXBb1du3NZ1Ui6Av0XKyL3ONtB7tpy' \ +--data '' +``` +GetResponse: +``` +{ + "count": 4, + "total_count": 4, + "data": [ + { + "id": "12345_pay_01987e212eac7b23986ab9afee1d4f3f", + "merchant_id": "cloth_seller_qNqGZXs31yvrAlmFG1Jj", + "profile_id": "pro_G9buhoAY3Mpu9cFIeWoZ", + "customer_id": null, + "payment_method_id": null, + "status": "requires_payment_method", + "amount": { + "order_amount": 100, + "currency": "USD", + "shipping_cost": null, + "order_tax_amount": null, + "external_tax_calculation": "skip", + "surcharge_calculation": "skip", + "surcharge_amount": null, + "tax_on_surcharge": null, + "net_amount": 100, + "amount_to_capture": null, + "amount_capturable": 0, + "amount_captured": null + }, + "created": "2025-08-06T06:46:00.627Z", + "payment_method_type": null, + "payment_method_subtype": null, + "connector": null, + "merchant_connector_id": null, + "customer": null, + "merchant_reference_id": null, + "connector_payment_id": null, + "connector_response_reference_id": null, + "metadata": null, + "description": null, + "authentication_type": "no_three_ds", + "capture_method": "manual", + "setup_future_usage": "on_session", + "attempt_count": 0, + "error": null, + "cancellation_reason": null, + "order_details": null, + "return_url": null, + "statement_descriptor": null, + "allowed_payment_method_types": null, + "authorization_count": 0, + "modified_at": null + }, + { + "id": "12345_pay_01987e212d6f7af18f54d484b9afad2f", + "merchant_id": "cloth_seller_qNqGZXs31yvrAlmFG1Jj", + "profile_id": "pro_G9buhoAY3Mpu9cFIeWoZ", + "customer_id": null, + "payment_method_id": null, + "status": "requires_payment_method", + "amount": { + "order_amount": 100, + "currency": "USD", + "shipping_cost": null, + "order_tax_amount": null, + "external_tax_calculation": "skip", + "surcharge_calculation": "skip", + "surcharge_amount": null, + "tax_on_surcharge": null, + "net_amount": 100, + "amount_to_capture": null, + "amount_capturable": 0, + "amount_captured": null + }, + "created": "2025-08-06T06:46:00.316Z", + "payment_method_type": null, + "payment_method_subtype": null, + "connector": null, + "merchant_connector_id": null, + "customer": null, + "merchant_reference_id": null, + "connector_payment_id": null, + "connector_response_reference_id": null, + "metadata": null, + "description": null, + "authentication_type": "no_three_ds", + "capture_method": "manual", + "setup_future_usage": "on_session", + "attempt_count": 0, + "error": null, + "cancellation_reason": null, + "order_details": null, + "return_url": null, + "statement_descriptor": null, + "allowed_payment_method_types": null, + "authorization_count": 0, + "modified_at": null + }, + { + "id": "12345_pay_01987e212b497a7394a404b857f156bf", + "merchant_id": "cloth_seller_qNqGZXs31yvrAlmFG1Jj", + "profile_id": "pro_G9buhoAY3Mpu9cFIeWoZ", + "customer_id": null, + "payment_method_id": null, + "status": "requires_payment_method", + "amount": { + "order_amount": 100, + "currency": "USD", + "shipping_cost": null, + "order_tax_amount": null, + "external_tax_calculation": "skip", + "surcharge_calculation": "skip", + "surcharge_amount": null, + "tax_on_surcharge": null, + "net_amount": 100, + "amount_to_capture": null, + "amount_capturable": 0, + "amount_captured": null + }, + "created": "2025-08-06T06:45:59.767Z", + "payment_method_type": null, + "payment_method_subtype": null, + "connector": null, + "merchant_connector_id": null, + "customer": null, + "merchant_reference_id": null, + "connector_payment_id": null, + "connector_response_reference_id": null, + "metadata": null, + "description": null, + "authentication_type": "no_three_ds", + "capture_method": "manual", + "setup_future_usage": "on_session", + "attempt_count": 0, + "error": null, + "cancellation_reason": null, + "order_details": null, + "return_url": null, + "statement_descriptor": null, + "allowed_payment_method_types": null, + "authorization_count": 0, + "modified_at": null + }, + { + "id": "12345_pay_01987e1fa70c7bb18fea2a1667c32e5e", + "merchant_id": "cloth_seller_qNqGZXs31yvrAlmFG1Jj", + "profile_id": "pro_G9buhoAY3Mpu9cFIeWoZ", + "customer_id": null, + "payment_method_id": null, + "status": "requires_payment_method", + "amount": { + "order_amount": 100, + "currency": "USD", + "shipping_cost": null, + "order_tax_amount": null, + "external_tax_calculation": "skip", + "surcharge_calculation": "skip", + "surcharge_amount": null, + "tax_on_surcharge": null, + "net_amount": 100, + "amount_to_capture": null, + "amount_capturable": 0, + "amount_captured": null + }, + "created": "2025-08-06T06:44:20.386Z", + "payment_method_type": null, + "payment_method_subtype": null, + "connector": null, + "merchant_connector_id": null, + "customer": null, + "merchant_reference_id": null, + "connector_payment_id": null, + "connector_response_reference_id": null, + "metadata": null, + "description": null, + "authentication_type": "no_three_ds", + "capture_method": "manual", + "setup_future_usage": "on_session", + "attempt_count": 0, + "error": null, + "cancellation_reason": null, + "order_details": null, + "return_url": null, + "statement_descriptor": null, + "allowed_payment_method_types": null, + "authorization_count": 0, + "modified_at": null + } + ] +} +``` + +GETRequestWithMultipleFilters: +``` +curl --location 'http://localhost:8080/v2/payments/list?status=requires_payment_method%2Crequires_capture%2Csucceeded¤cy=USD' \ +--header 'api-key: dev_0M1HsoPENAKVcLprxBkqXvtLLA8myjdVHFUDvvknNykT1jlEdww31C8VNcj3emYL' \ +--header 'Content-Type: application/json' \ +--header 'x-profile-id: pro_qBIx1HzjxmvyeDgJmZLd' \ +--header 'Authorization: api-key=dev_0M1HsoPENAKVcLprxBkqXvtLLA8myjdVHFUDvvknNykT1jlEdww31C8VNcj3emYL' \ +--data '' +``` +PostResponse: +``` +{ + "count": 6, + "total_count": 6, + "data": [ + { + "id": "12345_pay_019897db488f74b2ace8d4f34a1afd2e", + "merchant_id": "cloth_seller_EWd2xVEKmKewu5gHgXMY", + "profile_id": "pro_qBIx1HzjxmvyeDgJmZLd", + "customer_id": null, + "payment_method_id": null, + "status": "succeeded", + "amount": { + "order_amount": 100, + "currency": "USD", + "shipping_cost": null, + "order_tax_amount": null, + "external_tax_calculation": "skip", + "surcharge_calculation": "skip", + "surcharge_amount": null, + "tax_on_surcharge": null, + "net_amount": 100, + "amount_to_capture": null, + "amount_capturable": 0, + "amount_captured": 100 + }, + "created": "2025-08-11T06:39:47.356Z", + "payment_method_type": "card", + "payment_method_subtype": "credit", + "connector": "authorizedotnet", + "merchant_connector_id": "mca_t6Qa8RtV3MHmRAHlu1Zi", + "customer": null, + "merchant_reference_id": null, + "connector_payment_id": "80043331424", + "connector_response_reference_id": "80043331424", + "metadata": null, + "description": null, + "authentication_type": "no_three_ds", + "capture_method": "automatic", + "setup_future_usage": "on_session", + "attempt_count": 0, + "error": null, + "cancellation_reason": null, + "order_details": null, + "return_url": null, + "statement_descriptor": null, + "allowed_payment_method_types": null, + "authorization_count": 0, + "modified_at": "2025-08-11T06:39:50.721Z" + }, + { + "id": "12345_pay_019897db458a7650b52dc95d1d2cedc5", + "merchant_id": "cloth_seller_EWd2xVEKmKewu5gHgXMY", + "profile_id": "pro_qBIx1HzjxmvyeDgJmZLd", + "customer_id": null, + "payment_method_id": null, + "status": "requires_payment_method", + "amount": { + "order_amount": 100, + "currency": "USD", + "shipping_cost": null, + "order_tax_amount": null, + "external_tax_calculation": "skip", + "surcharge_calculation": "skip", + "surcharge_amount": null, + "tax_on_surcharge": null, + "net_amount": 100, + "amount_to_capture": null, + "amount_capturable": 0, + "amount_captured": null + }, + "created": "2025-08-11T06:39:46.589Z", + "payment_method_type": null, + "payment_method_subtype": null, + "connector": null, + "merchant_connector_id": null, + "customer": null, + "merchant_reference_id": null, + "connector_payment_id": null, + "connector_response_reference_id": null, + "metadata": null, + "description": null, + "authentication_type": "no_three_ds", + "capture_method": "automatic", + "setup_future_usage": "on_session", + "attempt_count": 0, + "error": null, + "cancellation_reason": null, + "order_details": null, + "return_url": null, + "statement_descriptor": null, + "allowed_payment_method_types": null, + "authorization_count": 0, + "modified_at": null + }, + { + "id": "12345_pay_019897db02ff7e10b129a3df71b09aaf", + "merchant_id": "cloth_seller_EWd2xVEKmKewu5gHgXMY", + "profile_id": "pro_qBIx1HzjxmvyeDgJmZLd", + "customer_id": null, + "payment_method_id": null, + "status": "requires_payment_method", + "amount": { + "order_amount": 100, + "currency": "USD", + "shipping_cost": null, + "order_tax_amount": null, + "external_tax_calculation": "skip", + "surcharge_calculation": "skip", + "surcharge_amount": null, + "tax_on_surcharge": null, + "net_amount": 100, + "amount_to_capture": null, + "amount_capturable": 0, + "amount_captured": null + }, + "created": "2025-08-11T06:39:29.562Z", + "payment_method_type": null, + "payment_method_subtype": null, + "connector": null, + "merchant_connector_id": null, + "customer": null, + "merchant_reference_id": null, + "connector_payment_id": null, + "connector_response_reference_id": null, + "metadata": null, + "description": null, + "authentication_type": "no_three_ds", + "capture_method": "automatic", + "setup_future_usage": "on_session", + "attempt_count": 0, + "error": null, + "cancellation_reason": null, + "order_details": null, + "return_url": null, + "statement_descriptor": null, + "allowed_payment_method_types": null, + "authorization_count": 0, + "modified_at": null + }, + { + "id": "12345_pay_019897db003876b1b5f57f8d4c27072d", + "merchant_id": "cloth_seller_EWd2xVEKmKewu5gHgXMY", + "profile_id": "pro_qBIx1HzjxmvyeDgJmZLd", + "customer_id": null, + "payment_method_id": null, + "status": "requires_payment_method", + "amount": { + "order_amount": 100, + "currency": "USD", + "shipping_cost": null, + "order_tax_amount": null, + "external_tax_calculation": "skip", + "surcharge_calculation": "skip", + "surcharge_amount": null, + "tax_on_surcharge": null, + "net_amount": 100, + "amount_to_capture": null, + "amount_capturable": 0, + "amount_captured": null + }, + "created": "2025-08-11T06:39:28.839Z", + "payment_method_type": null, + "payment_method_subtype": null, + "connector": null, + "merchant_connector_id": null, + "customer": null, + "merchant_reference_id": null, + "connector_payment_id": null, + "connector_response_reference_id": null, + "metadata": null, + "description": null, + "authentication_type": "no_three_ds", + "capture_method": "automatic", + "setup_future_usage": "on_session", + "attempt_count": 0, + "error": null, + "cancellation_reason": null, + "order_details": null, + "return_url": null, + "statement_descriptor": null, + "allowed_payment_method_types": null, + "authorization_count": 0, + "modified_at": null + }, + { + "id": "12345_pay_019897dafd2070c1956d1af439088873", + "merchant_id": "cloth_seller_EWd2xVEKmKewu5gHgXMY", + "profile_id": "pro_qBIx1HzjxmvyeDgJmZLd", + "customer_id": null, + "payment_method_id": null, + "status": "requires_payment_method", + "amount": { + "order_amount": 100, + "currency": "USD", + "shipping_cost": null, + "order_tax_amount": null, + "external_tax_calculation": "skip", + "surcharge_calculation": "skip", + "surcharge_amount": null, + "tax_on_surcharge": null, + "net_amount": 100, + "amount_to_capture": null, + "amount_capturable": 0, + "amount_captured": null + }, + "created": "2025-08-11T06:39:28.045Z", + "payment_method_type": null, + "payment_method_subtype": null, + "connector": null, + "merchant_connector_id": null, + "customer": null, + "merchant_reference_id": null, + "connector_payment_id": null, + "connector_response_reference_id": null, + "metadata": null, + "description": null, + "authentication_type": "no_three_ds", + "capture_method": "automatic", + "setup_future_usage": "on_session", + "attempt_count": 0, + "error": null, + "cancellation_reason": null, + "order_details": null, + "return_url": null, + "statement_descriptor": null, + "allowed_payment_method_types": null, + "authorization_count": 0, + "modified_at": null + }, + { + "id": "12345_pay_019897dae26871f2be542d43fc570b13", + "merchant_id": "cloth_seller_EWd2xVEKmKewu5gHgXMY", + "profile_id": "pro_qBIx1HzjxmvyeDgJmZLd", + "customer_id": null, + "payment_method_id": null, + "status": "succeeded", + "amount": { + "order_amount": 100, + "currency": "USD", + "shipping_cost": null, + "order_tax_amount": null, + "external_tax_calculation": "skip", + "surcharge_calculation": "skip", + "surcharge_amount": null, + "tax_on_surcharge": null, + "net_amount": 100, + "amount_to_capture": null, + "amount_capturable": 0, + "amount_captured": 100 + }, + "created": "2025-08-11T06:39:21.215Z", + "payment_method_type": "card", + "payment_method_subtype": "credit", + "connector": "authorizedotnet", + "merchant_connector_id": "mca_t6Qa8RtV3MHmRAHlu1Zi", + "customer": null, + "merchant_reference_id": null, + "connector_payment_id": "80043331420", + "connector_response_reference_id": "80043331420", + "metadata": null, + "description": null, + "authentication_type": "no_three_ds", + "capture_method": "automatic", + "setup_future_usage": "on_session", + "attempt_count": 0, + "error": null, + "cancellation_reason": null, + "order_details": null, + "return_url": null, + "statement_descriptor": null, + "allowed_payment_method_types": null, + "authorization_count": 0, + "modified_at": "2025-08-11T06:39:26.628Z" + } + ] +} +``` +GetRequestWithTimeDuration: +``` +curl --location 'http://localhost:8080/v2/payments/list?status=requires_payment_method%2Crequires_capture%2Csucceeded¤cy=USD&created.gte=2025-08-01T00%3A00%3A00Z&created.lte=2025-08-09T23%3A59%3A59Z' \ +--header 'api-key: dev_SfzD1JfNBMBwIxi6S55ku8kCXpt665huoFrJv1hnIFERGXNIUWldBQaOMJiHE0de' \ +--header 'Content-Type: application/json' \ +--header 'x-profile-id: pro_E7U8C0vjFGXvuaVEGH4M' \ +--header 'Authorization: api-key=dev_SfzD1JfNBMBwIxi6S55ku8kCXpt665huoFrJv1hnIFERGXNIUWldBQaOMJiHE0de' \ +--data '' +``` +Response: +``` +{ + "count": 0, + "total_count": 0, + "data": [] +} +``` +GetRequestWithTimeDuration: +``` +curl --location 'http://localhost:8080/v2/payments/list?status=failed¤cy=USD&created.gte=2025-08-01T00%3A00%3A00Z&created.lte=2025-08-31T23%3A59%3A59Z' \ +--header 'api-key: dev_SfzD1JfNBMBwIxi6S55ku8kCXpt665huoFrJv1hnIFERGXNIUWldBQaOMJiHE0de' \ +--header 'Content-Type: application/json' \ +--header 'x-profile-id: pro_E7U8C0vjFGXvuaVEGH4M' \ +--header 'Authorization: api-key=dev_SfzD1JfNBMBwIxi6S55ku8kCXpt665huoFrJv1hnIFERGXNIUWldBQaOMJiHE0de' \ +--data '' +``` +Response: +``` +{ + "count": 1, + "total_count": 1, + "data": [ + { + "id": "12345_pay_01989e70b0fc7e219eb6352105ccd06f", + "merchant_id": "cloth_seller_bdCHKB6LXsvpWlKKcios", + "profile_id": "pro_E7U8C0vjFGXvuaVEGH4M", + "customer_id": "12345_cus_01989e7025b471c0ace0c31e46b83360", + "payment_method_id": null, + "status": "failed", + "amount": { + "order_amount": 10000, + "currency": "USD", + "shipping_cost": null, + "order_tax_amount": null, + "external_tax_calculation": "skip", + "surcharge_calculation": "skip", + "surcharge_amount": null, + "tax_on_surcharge": null, + "net_amount": 10000, + "amount_to_capture": null, + "amount_capturable": 0, + "amount_captured": null + }, + "created": "2025-08-12T13:20:42.244Z", + "payment_method_type": "card", + "payment_method_subtype": "credit", + "connector": "trustpay", + "merchant_connector_id": "mca_Z9a58zhABpHduskbCsf9", + "customer": null, + "merchant_reference_id": null, + "connector_payment_id": null, + "connector_response_reference_id": null, + "metadata": null, + "description": null, + "authentication_type": "no_three_ds", + "capture_method": "automatic", + "setup_future_usage": "on_session", + "attempt_count": 0, + "error": { + "code": "4", + "message": "4", + "unified_code": null, + "unified_message": null, + "network_advice_code": null, + "network_decline_code": null, + "network_error_message": null + }, + "cancellation_reason": null, + "order_details": null, + "return_url": null, + "statement_descriptor": null, + "allowed_payment_method_types": null, + "authorization_count": 0, + "modified_at": "2025-08-12T13:20:47.624Z" + } + ] +} +``` + + +Closes #8792 + + +## Checklist + + +- [X] I formatted the code `cargo +nightly fmt --all` +- [X] I addressed lints thrown by `cargo clippy` +- [X] I reviewed the submitted code +- [ ] I added unit tests for my changes where possible +COMMENTS: +- semanticdiff-com[bot]: Review changes with  SemanticDiff +
+Changed Files +
+ +| File | Status | +| :--- | :--- | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8794/changes#crates/hyperswitch_domain_models/src/payments/payment_intent.rs)  [crates/hyperswitch\_domain\_models/src/payments/payment\_intent\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8794/changes#crates/hyperswitch_domain_models/src/payments/payment_intent.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8794/changes#crates/hyperswitch_domain_models/src/payments/payment_intent.rs)  83% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8794/changes#crates/storage_impl/src/mock_db/payment_attempt.rs)  [crates/storage\_impl/src/mock\_db/payment\_attempt\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8794/changes#crates/storage_impl/src/mock_db/payment_attempt.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8794/changes#crates/storage_impl/src/mock_db/payment_attempt.rs)  57% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8794/changes#crates/storage_impl/src/payments/payment_attempt.rs)  [crates/storage\_impl/src/payments/payment\_attempt\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8794/changes#crates/storage_impl/src/payments/payment_attempt.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8794/changes#crates/storage_impl/src/payments/payment_attempt.rs)  50% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8794/changes#crates/storage_impl/src/payments/payment_intent.rs)  [crates/storage\_impl/src/payments/payment\_intent\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8794/changes#crates/storage_impl/src/payments/payment_intent.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8794/changes#crates/storage_impl/src/payments/payment_intent.rs)  48% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8794/changes#crates/api_models/src/payments.rs)  [crates/api\_models/src/payments\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8794/changes#crates/api_models/src/payments.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8794/changes#crates/api_models/src/payments.rs)  43% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8794/changes#api-reference/v2/openapi_spec_v2.json)  [api\-reference/v2/openapi\_spec\_v2\.json](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8794/changes#api-reference/v2/openapi_spec_v2.json) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8794/changes#api-reference/v2/openapi_spec_v2.json)  38% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8794/changes#crates/common_utils/src/id_type/merchant_connector_account.rs)  [crates/common\_utils/src/id\_type/merchant\_connector\_account\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8794/changes#crates/common_utils/src/id_type/merchant_connector_account.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8794/changes#crates/common_utils/src/id_type/merchant_connector_account.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8794/changes#crates/diesel_models/src/query/payment_attempt.rs)  [crates/diesel\_models/src/query/payment\_attempt\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8794/changes#crates/diesel_models/src/query/payment_attempt.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8794/changes#crates/diesel_models/src/query/payment_attempt.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8794/changes#crates/hyperswitch_domain_models/src/payments/payment_attempt.rs)  [crates/hyperswitch\_domain\_models/src/payments/payment\_attempt\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8794/changes#crates/hyperswitch_domain_models/src/payments/payment_attempt.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8794/changes#crates/hyperswitch_domain_models/src/payments/payment_attempt.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8794/changes#crates/router/src/db/kafka_store.rs)  [crates/router/src/db/kafka\_store\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8794/changes#crates/router/src/db/kafka_store.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8794/changes#crates/router/src/db/kafka_store.rs)  0% smaller | + +
+- AnuthaDev [crates/diesel_models/src/query/payment_attempt.rs:473]: Add this logger entry back +- AnuthaDev [crates/storage_impl/src/payments/payment_intent.rs:1023]: these two need to be added back +- AnuthaDev [crates/common_utils/src/id_type/merchant_connector_account.rs:27]: This seems to be unused? Please remove +- ayush22667 [crates/common_utils/src/id_type/merchant_connector_account.rs:27]: if we dont implement FromStr for MerchantConnectorAccountId then we need to make a separate deserializer for it + +=== COMMIT === +SUBJECT: feat(payments): add PaymentListFilterConstraints and payments_list_by_filter endpoint for v2 (#8794) +BODY: +Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> + +=== FILES === +Summary: 10 files changed, +218 -178 +- api-reference/v2/openapi_spec_v2.json (+32 -36) +- crates/api_models/src/payments.rs (+59 -21) +- crates/common_utils/src/id_type/merchant_connector_account.rs (+10 -0) +- crates/diesel_models/src/query/payment_attempt.rs (+18 -18) +- crates/hyperswitch_domain_models/src/payments/payment_attempt.rs (+6 -6) +- crates/hyperswitch_domain_models/src/payments/payment_intent.rs (+41 -49) +- crates/router/src/db/kafka_store.rs (+6 -6) +- crates/storage_impl/src/mock_db/payment_attempt.rs (+6 -6) +- crates/storage_impl/src/payments/payment_attempt.rs (+15 -13) +- crates/storage_impl/src/payments/payment_intent.rs (+25 -23) + +=== PATCH === +diff --git a/api-reference/v2/openapi_spec_v2.json b/api-reference/v2/openapi_spec_v2.json +index 00d83f79..5d302db6 100644 +--- a/api-reference/v2/openapi_spec_v2.json ++++ b/api-reference/v2/openapi_spec_v2.json +@@ -2441,11 +2441,10 @@ + "description": "The connector to filter payments list", + "required": true, + "schema": { +- "allOf": [ +- { +- "$ref": "#/components/schemas/Connector" +- } +- ], ++ "type": "array", ++ "items": { ++ "$ref": "#/components/schemas/Connector" ++ }, + "nullable": true + } + }, +@@ -2455,11 +2454,10 @@ + "description": "The currency to filter payments list", + "required": true, + "schema": { +- "allOf": [ +- { +- "$ref": "#/components/schemas/Currency" +- } +- ], ++ "type": "array", ++ "items": { ++ "$ref": "#/components/schemas/Currency" ++ }, + "nullable": true + } + }, +@@ -2469,11 +2467,10 @@ + "description": "The payment status to filter payments list", + "required": true, + "schema": { +- "allOf": [ +- { +- "$ref": "#/components/schemas/IntentStatus" +- } +- ], ++ "type": "array", ++ "items": { ++ "$ref": "#/components/schemas/IntentStatus" ++ }, + "nullable": true + } + }, +@@ -2483,11 +2480,10 @@ + "description": "The payment method type to filter payments list", + "required": true, + "schema": { +- "allOf": [ +- { +- "$ref": "#/components/schemas/PaymentMethod" +- } +- ], ++ "type": "array", ++ "items": { ++ "$ref": "#/components/schemas/PaymentMethod" ++ }, + "nullable": true + } + }, +@@ -2497,11 +2493,10 @@ + "description": "The payment method subtype to filter payments list", + "required": true, + "schema": { +- "allOf": [ +- { +- "$ref": "#/components/schemas/PaymentMethodType" +- } +- ], ++ "type": "array", ++ "items": { ++ "$ref": "#/components/schemas/PaymentMethodType" ++ }, + "nullable": true + } + }, +@@ -2511,11 +2506,10 @@ + "description": "The authentication type to filter payments list", + "required": true, + "schema": { +- "allOf": [ +- { +- "$ref": "#/components/schemas/AuthenticationType" +- } +- ], ++ "type": "array", ++ "items": { ++ "$ref": "#/components/schemas/AuthenticationType" ++ }, + "nullable": true + } + }, +@@ -2525,7 +2519,10 @@ + "description": "The merchant connector id to filter payments list", + "required": true, + "schema": { +- "type": "string", ++ "type": "array", ++ "items": { ++ "type": "string" ++ }, + "nullable": true + } + }, +@@ -2553,11 +2550,10 @@ + "description": "The card networks to filter payments list", + "required": true, + "schema": { +- "allOf": [ +- { +- "$ref": "#/components/schemas/CardNetwork" +- } +- ], ++ "type": "array", ++ "items": { ++ "$ref": "#/components/schemas/CardNetwork" ++ }, + "nullable": true + } + }, +diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs +index e50c3782..61ee4998 100644 +--- a/crates/api_models/src/payments.rs ++++ b/crates/api_models/src/payments.rs +@@ -26,9 +26,39 @@ use common_utils::{ + pii::{self, Email}, + types::{MinorUnit, StringMajorUnit}, + }; +-#[cfg(feature = "v2")] +-use deserialize_form_style_query_parameter::option_form_vec_deserialize; + use error_stack::ResultExt; ++ ++#[cfg(feature = "v2")] ++fn parse_comma_separated<'de, D, T>(v: D) -> Result>, D::Error> ++where ++ D: serde::Deserializer<'de>, ++ T: std::str::FromStr, ++ ::Err: std::fmt::Debug + std::fmt::Display + std::error::Error, ++{ ++ let opt_str: Option = Option::deserialize(v)?; ++ match opt_str { ++ Some(s) if s.is_empty() => Ok(None), ++ Some(s) => { ++ // Estimate capacity based on comma count ++ let capacity = s.matches(',').count() + 1; ++ let mut result = Vec::with_capacity(capacity); ++ ++ for item in s.split(',') { ++ let trimmed_item = item.trim(); ++ if !trimmed_item.is_empty() { ++ let parsed_item = trimmed_item.parse::().map_err(|e| { ++ ::custom(format!( ++ "Invalid value '{trimmed_item}': {e}" ++ )) ++ })?; ++ result.push(parsed_item); ++ } ++ } ++ Ok(Some(result)) ++ } ++ None => Ok(None), ++ } ++} + use masking::{PeekInterface, Secret, WithType}; + use router_derive::Setter; + #[cfg(feature = "v1")] +@@ -6279,26 +6309,33 @@ pub struct PaymentListConstraints { + /// The end amount to filter list of transactions which are less than or equal to the end amount + pub end_amount: Option, + /// The connector to filter payments list +- #[param(value_type = Option)] +- pub connector: Option, ++ #[param(value_type = Option>)] ++ #[serde(deserialize_with = "parse_comma_separated", default)] ++ pub connector: Option>, + /// The currency to filter payments list +- #[param(value_type = Option)] +- pub currency: Option, ++ #[param(value_type = Option>)] ++ #[serde(deserialize_with = "parse_comma_separated", default)] ++ pub currency: Option>, + /// The payment status to filter payments list +- #[param(value_type = Option)] +- pub status: Option, ++ #[param(value_type = Option>)] ++ #[serde(deserialize_with = "parse_comma_separated", default)] ++ pub status: Option>, + /// The payment method type to filter payments list +- #[param(value_type = Option)] +- pub payment_method_type: Option, ++ #[param(value_type = Option>)] ++ #[serde(deserialize_with = "parse_comma_separated", default)] ++ pub payment_method_type: Option>, + /// The payment method subtype to filter payments list +- #[param(value_type = Option)] +- pub payment_method_subtype: Option, ++ #[param(value_type = Option>)] ++ #[serde(deserialize_with = "parse_comma_separated", default)] ++ pub payment_method_subtype: Option>, + /// The authentication type to filter payments list +- #[param(value_type = Option)] +- pub authentication_type: Option, ++ #[param(value_type = Option>)] ++ #[serde(deserialize_with = "parse_comma_separated", default)] ++ pub authentication_type: Option>, + /// The merchant connector id to filter payments list +- #[param(value_type = Option)] +- pub merchant_connector_id: Option, ++ #[param(value_type = Option>)] ++ #[serde(deserialize_with = "parse_comma_separated", default)] ++ pub merchant_connector_id: Option>, + /// The field on which the payments list should be sorted + #[serde(default)] + pub order_on: SortOn, +@@ -6306,8 +6343,9 @@ pub struct PaymentListConstraints { + #[serde(default)] + pub order_by: SortBy, + /// The card networks to filter payments list +- #[param(value_type = Option)] +- pub card_network: Option, ++ #[param(value_type = Option>)] ++ #[serde(deserialize_with = "parse_comma_separated", default)] ++ pub card_network: Option>, + /// The identifier for merchant order reference id + pub merchant_order_reference_id: Option, + } +@@ -8004,7 +8042,7 @@ pub struct ListMethodsForPaymentsRequest { + pub client_secret: Option, + + /// The two-letter ISO currency code +- #[serde(deserialize_with = "option_form_vec_deserialize", default)] ++ #[serde(deserialize_with = "parse_comma_separated", default)] + #[schema(value_type = Option>, example = json!(["US", "UK", "IN"]))] + pub accepted_countries: Option>, + +@@ -8013,7 +8051,7 @@ pub struct ListMethodsForPaymentsRequest { + pub amount: Option, + + /// The three-letter ISO currency code +- #[serde(deserialize_with = "option_form_vec_deserialize", default)] ++ #[serde(deserialize_with = "parse_comma_separated", default)] + #[schema(value_type = Option>,example = json!(["USD", "EUR"]))] + pub accepted_currencies: Option>, + +@@ -8022,7 +8060,7 @@ pub struct ListMethodsForPaymentsRequest { + pub recurring_enabled: Option, + + /// Indicates whether the payment method is eligible for card networks +- #[serde(deserialize_with = "option_form_vec_deserialize", default)] ++ #[serde(deserialize_with = "parse_comma_separated", default)] + #[schema(value_type = Option>, example = json!(["visa", "mastercard"]))] + pub card_networks: Option>, + +diff --git a/crates/common_utils/src/id_type/merchant_connector_account.rs b/crates/common_utils/src/id_type/merchant_connector_account.rs +index f1bdb171..df8d1c3b 100644 +--- a/crates/common_utils/src/id_type/merchant_connector_account.rs ++++ b/crates/common_utils/src/id_type/merchant_connector_account.rs +@@ -1,3 +1,5 @@ ++use std::str::FromStr; ++ + use crate::errors::{CustomResult, ValidationError}; + + crate::id_type!( +@@ -21,3 +23,11 @@ impl MerchantConnectorAccountId { + Self::try_from(std::borrow::Cow::from(merchant_connector_account_id)) + } + } ++ ++impl FromStr for MerchantConnectorAccountId { ++ type Err = std::fmt::Error; ++ ++ fn from_str(s: &str) -> Result { ++ Self::try_from(std::borrow::Cow::Owned(s.to_string())).map_err(|_| std::fmt::Error) ++ } ++} +diff --git a/crates/diesel_models/src/query/payment_attempt.rs b/crates/diesel_models/src/query/payment_attempt.rs +index a7baf75f..b1934ae5 100644 +--- a/crates/diesel_models/src/query/payment_attempt.rs ++++ b/crates/diesel_models/src/query/payment_attempt.rs +@@ -437,12 +437,12 @@ impl PaymentAttempt { + conn: &PgPooledConn, + merchant_id: &common_utils::id_type::MerchantId, + active_attempt_ids: &[String], +- connector: Option, +- payment_method_type: Option, +- payment_method_subtype: Option, +- authentication_type: Option, +- merchant_connector_id: Option, +- card_network: Option, ++ connector: Option>, ++ payment_method_type: Option>, ++ payment_method_subtype: Option>, ++ authentication_type: Option>, ++ merchant_connector_id: Option>, ++ card_network: Option>, + ) -> StorageResult { + let mut filter = ::table() + .count() +@@ -450,24 +450,24 @@ impl PaymentAttempt { + .filter(dsl::id.eq_any(active_attempt_ids.to_owned())) + .into_boxed(); + +- if let Some(connector) = connector { +- filter = filter.filter(dsl::connector.eq(connector)); ++ if let Some(connectors) = connector { ++ filter = filter.filter(dsl::connector.eq_any(connectors)); + } + +- if let Some(payment_method_type) = payment_method_type { +- filter = filter.filter(dsl::payment_method_type_v2.eq(payment_method_type)); ++ if let Some(payment_method_types) = payment_method_type { ++ filter = filter.filter(dsl::payment_method_type_v2.eq_any(payment_method_types)); + } +- if let Some(payment_method_subtype) = payment_method_subtype { +- filter = filter.filter(dsl::payment_method_subtype.eq(payment_method_subtype)); ++ if let Some(payment_method_subtypes) = payment_method_subtype { ++ filter = filter.filter(dsl::payment_method_subtype.eq_any(payment_method_subtypes)); + } +- if let Some(authentication_type) = authentication_type { +- filter = filter.filter(dsl::authentication_type.eq(authentication_type)); ++ if let Some(authentication_types) = authentication_type { ++ filter = filter.filter(dsl::authentication_type.eq_any(authentication_types)); + } +- if let Some(merchant_connector_id) = merchant_connector_id { +- filter = filter.filter(dsl::merchant_connector_id.eq(merchant_connector_id)) ++ if let Some(merchant_connector_ids) = merchant_connector_id { ++ filter = filter.filter(dsl::merchant_connector_id.eq_any(merchant_connector_ids)); + } +- if let Some(card_network) = card_network { +- filter = filter.filter(dsl::card_network.eq(card_network)) ++ if let Some(card_networks) = card_network { ++ filter = filter.filter(dsl::card_network.eq_any(card_networks)); + } + + router_env::logger::debug!(query = %debug_query::(&filter).to_string()); +diff --git a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs +index c29c4d60..755d9f79 100644 +--- a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs ++++ b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs +@@ -235,12 +235,12 @@ pub trait PaymentAttemptInterface { + &self, + merchant_id: &id_type::MerchantId, + active_attempt_ids: &[String], +- connector: Option, +- payment_method_type: Option, +- payment_method_subtype: Option, +- authentication_type: Option, +- merchant_connector_id: Option, +- card_network: Option, ++ connector: Option>, ++ payment_method_type: Option>, ++ payment_method_subtype: Option>, ++ authentication_type: Option>, ++ merchant_connector_id: Option>, ++ card_network: Option>, + storage_scheme: storage_enums::MerchantStorageScheme, + ) -> error_stack::Result; + } +diff --git a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs b/crates/hyperswitch_domain_models/src/payments/payment_intent.rs +index 60158ebd..c96209d2 100644 +--- a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs ++++ b/crates/hyperswitch_domain_models/src/payments/payment_intent.rs +@@ -1340,20 +1340,14 @@ impl PaymentIntentFetchConstraints { + + #[cfg(feature = "v2")] + pub enum PaymentIntentFetchConstraints { +- Single { +- payment_intent_id: id_type::GlobalPaymentId, +- }, + List(Box), + } + + #[cfg(feature = "v2")] + impl PaymentIntentFetchConstraints { + pub fn get_profile_id(&self) -> Option { +- if let Self::List(pi_list_params) = self { +- pi_list_params.profile_id.clone() +- } else { +- None +- } ++ let Self::List(pi_list_params) = self; ++ pi_list_params.profile_id.clone() + } + } + +@@ -1387,21 +1381,22 @@ pub struct PaymentIntentListParams { + pub starting_at: Option, + pub ending_at: Option, + pub amount_filter: Option, +- pub connector: Option, +- pub currency: Option, +- pub status: Option, +- pub payment_method_type: Option, +- pub payment_method_subtype: Option, +- pub authentication_type: Option, +- pub merchant_connector_id: Option, ++ pub connector: Option>, ++ pub currency: Option>, ++ pub status: Option>, ++ pub payment_method_type: Option>, ++ pub payment_method_subtype: Option>, ++ pub authentication_type: Option>, ++ pub merchant_connector_id: Option>, + pub profile_id: Option, + pub customer_id: Option, + pub starting_after_id: Option, + pub ending_before_id: Option, + pub limit: Option, + pub order: api_models::payments::Order, +- pub card_network: Option, ++ pub card_network: Option>, + pub merchant_order_reference_id: Option, ++ pub payment_id: Option, + } + + #[cfg(feature = "v1")] +@@ -1473,39 +1468,36 @@ impl From for PaymentIntentFetchCo + merchant_order_reference_id, + offset, + } = value; +- if let Some(payment_intent_id) = payment_id { +- Self::Single { payment_intent_id } +- } else { +- Self::List(Box::new(PaymentIntentListParams { +- offset: offset.unwrap_or_default(), +- starting_at: created_gte.or(created_gt).or(created), +- ending_at: created_lte.or(created_lt).or(created), +- amount_filter: (start_amount.is_some() || end_amount.is_some()).then_some({ +- api_models::payments::AmountFilter { +- start_amount, +- end_amount, +- } +- }), +- connector, +- currency, +- status, +- payment_method_type, +- payment_method_subtype, +- authentication_type, +- merchant_connector_id, +- profile_id, +- customer_id, +- starting_after_id: starting_after, +- ending_before_id: ending_before, +- limit: Some(std::cmp::min(limit, PAYMENTS_LIST_MAX_LIMIT_V1)), +- order: api_models::payments::Order { +- on: order_on, +- by: order_by, +- }, +- card_network, +- merchant_order_reference_id, +- })) +- } ++ Self::List(Box::new(PaymentIntentListParams { ++ offset: offset.unwrap_or_default(), ++ starting_at: created_gte.or(created_gt).or(created), ++ ending_at: created_lte.or(created_lt).or(created), ++ amount_filter: (start_amount.is_some() || end_amount.is_some()).then_some({ ++ api_models::payments::AmountFilter { ++ start_amount, ++ end_amount, ++ } ++ }), ++ connector, ++ currency, ++ status, ++ payment_method_type, ++ payment_method_subtype, ++ authentication_type, ++ merchant_connector_id, ++ profile_id, ++ customer_id, ++ starting_after_id: starting_after, ++ ending_before_id: ending_before, ++ limit: Some(std::cmp::min(limit, PAYMENTS_LIST_MAX_LIMIT_V1)), ++ order: api_models::payments::Order { ++ on: order_on, ++ by: order_by, ++ }, ++ card_network, ++ merchant_order_reference_id, ++ payment_id, ++ })) + } + } + +diff --git a/crates/router/src/db/kafka_store.rs b/crates/router/src/db/kafka_store.rs +index 43be476f..9eaef17b 100644 +--- a/crates/router/src/db/kafka_store.rs ++++ b/crates/router/src/db/kafka_store.rs +@@ -1827,12 +1827,12 @@ impl PaymentAttemptInterface for KafkaStore { + &self, + merchant_id: &id_type::MerchantId, + active_attempt_ids: &[String], +- connector: Option, +- payment_method_type: Option, +- payment_method_subtype: Option, +- authentication_type: Option, +- merchant_connector_id: Option, +- card_network: Option, ++ connector: Option>, ++ payment_method_type: Option>, ++ payment_method_subtype: Option>, ++ authentication_type: Option>, ++ merchant_connector_id: Option>, ++ card_network: Option>, + storage_scheme: MerchantStorageScheme, + ) -> CustomResult { + self.diesel_store +diff --git a/crates/storage_impl/src/mock_db/payment_attempt.rs b/crates/storage_impl/src/mock_db/payment_attempt.rs +index ec27f9be..0268bc93 100644 +--- a/crates/storage_impl/src/mock_db/payment_attempt.rs ++++ b/crates/storage_impl/src/mock_db/payment_attempt.rs +@@ -65,12 +65,12 @@ impl PaymentAttemptInterface for MockDb { + &self, + _merchant_id: &id_type::MerchantId, + _active_attempt_ids: &[String], +- _connector: Option, +- _payment_method_type: Option, +- _payment_method_subtype: Option, +- _authentication_type: Option, +- _merchanat_connector_id: Option, +- _card_network: Option, ++ _connector: Option>, ++ _payment_method_type: Option>, ++ _payment_method_subtype: Option>, ++ _authentication_type: Option>, ++ _merchant_connector_id: Option>, ++ _card_network: Option>, + _storage_scheme: storage_enums::MerchantStorageScheme, + ) -> CustomResult { + Err(StorageError::MockDbError)? +diff --git a/crates/storage_impl/src/payments/payment_attempt.rs b/crates/storage_impl/src/payments/payment_attempt.rs +index 5ddf5d50..5424ad96 100644 +--- a/crates/storage_impl/src/payments/payment_attempt.rs ++++ b/crates/storage_impl/src/payments/payment_attempt.rs +@@ -546,12 +546,12 @@ impl PaymentAttemptInterface for RouterStore { + &self, + merchant_id: &common_utils::id_type::MerchantId, + active_attempt_ids: &[String], +- connector: Option, +- payment_method_type: Option, +- payment_method_subtype: Option, +- authentication_type: Option, +- merchant_connector_id: Option, +- card_network: Option, ++ connector: Option>, ++ payment_method_type: Option>, ++ payment_method_subtype: Option>, ++ authentication_type: Option>, ++ merchant_connector_id: Option>, ++ card_network: Option>, + _storage_scheme: MerchantStorageScheme, + ) -> CustomResult { + let conn = self +@@ -565,7 +565,9 @@ impl PaymentAttemptInterface for RouterStore { + &conn, + merchant_id, + active_attempt_ids, +- connector.map(|val| val.to_string()), ++ connector ++ .as_ref() ++ .map(|vals| vals.iter().map(|v| v.to_string()).collect()), + payment_method_type, + payment_method_subtype, + authentication_type, +@@ -1713,12 +1715,12 @@ impl PaymentAttemptInterface for KVRouterStore { + &self, + merchant_id: &common_utils::id_type::MerchantId, + active_attempt_ids: &[String], +- connector: Option, +- payment_method_type: Option, +- payment_method_subtype: Option, +- authentication_type: Option, +- merchant_connector_id: Option, +- card_network: Option, ++ connector: Option>, ++ payment_method_type: Option>, ++ payment_method_subtype: Option>, ++ authentication_type: Option>, ++ merchant_connector_id: Option>, ++ card_network: Option>, + storage_scheme: MerchantStorageScheme, + ) -> CustomResult { + self.router_store +diff --git a/crates/storage_impl/src/payments/payment_intent.rs b/crates/storage_impl/src/payments/payment_intent.rs +index d054a4b1..4eb3fad6 100644 +--- a/crates/storage_impl/src/payments/payment_intent.rs ++++ b/crates/storage_impl/src/payments/payment_intent.rs +@@ -1361,9 +1361,6 @@ impl PaymentIntentInterface for crate::RouterStore { + .into_boxed(); + + query = match constraints { +- PaymentIntentFetchConstraints::Single { payment_intent_id } => { +- query.filter(pi_dsl::id.eq(payment_intent_id.to_owned())) +- } + PaymentIntentFetchConstraints::List(params) => { + query = match params.order { + Order { +@@ -1457,50 +1454,54 @@ impl PaymentIntentInterface for crate::RouterStore { + }; + + query = match ¶ms.currency { +- Some(currency) => query.filter(pi_dsl::currency.eq(*currency)), ++ Some(currency) => query.filter(pi_dsl::currency.eq_any(currency.clone())), + None => query, + }; + + query = match ¶ms.connector { +- Some(connector) => query.filter(pa_dsl::connector.eq(*connector)), ++ Some(connector) => query.filter(pa_dsl::connector.eq_any(connector.clone())), + None => query, + }; + + query = match ¶ms.status { +- Some(status) => query.filter(pi_dsl::status.eq(*status)), ++ Some(status) => query.filter(pi_dsl::status.eq_any(status.clone())), + None => query, + }; + + query = match ¶ms.payment_method_type { +- Some(payment_method_type) => { +- query.filter(pa_dsl::payment_method_type_v2.eq(*payment_method_type)) +- } ++ Some(payment_method_type) => query ++ .filter(pa_dsl::payment_method_type_v2.eq_any(payment_method_type.clone())), + None => query, + }; + + query = match ¶ms.payment_method_subtype { +- Some(payment_method_subtype) => { +- query.filter(pa_dsl::payment_method_subtype.eq(*payment_method_subtype)) +- } ++ Some(payment_method_subtype) => query.filter( ++ pa_dsl::payment_method_subtype.eq_any(payment_method_subtype.clone()), ++ ), + None => query, + }; + + query = match ¶ms.authentication_type { +- Some(authentication_type) => { +- query.filter(pa_dsl::authentication_type.eq(*authentication_type)) +- } ++ Some(authentication_type) => query ++ .filter(pa_dsl::authentication_type.eq_any(authentication_type.clone())), + None => query, + }; + + query = match ¶ms.merchant_connector_id { +- Some(merchant_connector_id) => query +- .filter(pa_dsl::merchant_connector_id.eq(merchant_connector_id.clone())), ++ Some(merchant_connector_id) => query.filter( ++ pa_dsl::merchant_connector_id.eq_any(merchant_connector_id.clone()), ++ ), + None => query, + }; + + if let Some(card_network) = ¶ms.card_network { +- query = query.filter(pa_dsl::card_network.eq(card_network.clone())); ++ query = query.filter(pa_dsl::card_network.eq_any(card_network.clone())); + } ++ ++ if let Some(payment_id) = ¶ms.payment_id { ++ query = query.filter(pi_dsl::id.eq(payment_id.clone())); ++ } ++ + query + } + }; +@@ -1561,9 +1562,6 @@ impl PaymentIntentInterface for crate::RouterStore { + .into_boxed(); + + query = match constraints { +- PaymentIntentFetchConstraints::Single { payment_intent_id } => { +- query.filter(pi_dsl::id.eq(payment_intent_id.to_owned())) +- } + PaymentIntentFetchConstraints::List(params) => { + if let Some(customer_id) = ¶ms.customer_id { + query = query.filter(pi_dsl::customer_id.eq(customer_id.clone())); +@@ -1604,15 +1602,19 @@ impl PaymentIntentInterface for crate::RouterStore { + }; + + query = match ¶ms.currency { +- Some(currency) => query.filter(pi_dsl::currency.eq(*currency)), ++ Some(currency) => query.filter(pi_dsl::currency.eq_any(currency.clone())), + None => query, + }; + + query = match ¶ms.status { +- Some(status) => query.filter(pi_dsl::status.eq(*status)), ++ Some(status) => query.filter(pi_dsl::status.eq_any(status.clone())), + None => query, + }; + ++ if let Some(payment_id) = ¶ms.payment_id { ++ query = query.filter(pi_dsl::id.eq(payment_id.clone())); ++ } ++ + query + } + }; + +----- END CHUNK ----- \ No newline at end of file diff --git a/raw/49/49cd1225abb852bf4c024d39ce777caa98c58892.txt b/raw/49/49cd1225abb852bf4c024d39ce777caa98c58892.txt new file mode 100644 index 0000000000000000000000000000000000000000..87c58cf68f87ac7f74064fc4c0694d869cea7c3a --- /dev/null +++ b/raw/49/49cd1225abb852bf4c024d39ce777caa98c58892.txt @@ -0,0 +1,220 @@ +ROUTE: juspay/hyperswitch@49cd1225abb852bf4c024d39ce777caa98c58892 +REPO: https://github.com/juspay/hyperswitch +COMMIT: 49cd1225abb852bf4c024d39ce777caa98c58892 +AUTHOR: Aishwariyaa Anand <124241367+Aishwariyaa-Anand@users.noreply.github.com> +DATE: 2025-08-21T15:59:08 + +=== ISSUE_AND_PR === +[PR #9013] refactor(core): propagate merchant_reference_id for PaymentsAuthorizeData +URL: https://github.com/juspay/hyperswitch/pull/9013 +BODY: +## Type of Change + + +- [ ] Bugfix +- [ ] New feature +- [ ] Enhancement +- [x] Refactoring +- [ ] Dependency updates +- [ ] Documentation +- [ ] CI/CD + +## Description + +This PR adds support for propagating merchant_reference_id for PaymentsAuthorizeData v2. + +### Additional Changes + +- [ ] This PR modifies the API contract +- [ ] This PR modifies the database schema +- [ ] This PR modifies application configuration/environment variables + + + + +## Motivation and Context + + + +## How did you test it? + +enable UCS +``` +curl --location 'http://localhost:8080/v2/configs/' \ +--header 'Authorization: admin-api-key=test_admin' \ +--header 'Content-Type: application/json' \ +--data '{ + "key": "ucs_rollout_config_cloth_seller1756197165_9PGBS852vwot2udmMevW_razorpay_upi_Authorize", + "value": "1.0" + }' +``` +payment create +``` +curl --location 'http://localhost:8080/v2/payments' \ +--header 'x-profile-id: pro_jbuydwkItzTQj5EOqLaA' \ +--header 'Content-Type: application/json' \ +--header 'Authorization: api-key=dev_W97mjtX47mRRBIJWGgGMLZ8vEqUGQuymwlmsD32QpNhJM6318Vs25V21U6Kr665R' \ +--data-raw '{ + "amount_details": { + "currency": "INR", + "order_amount": 100 + }, + "return_raw_connector_response" : true, + "payment_method_data": { + "upi": { + "upi_collect": { + "vpa_id": "success@razorpay" + } + }, + "billing": { + "phone": { + "number": "8056594427", + "country_code": "+91" + }, + "email": "swangi.kumari@juspay.in" + } + }, + "payment_method_subtype": "upi_collect", + "payment_method_type": "upi", + + "metadata" : { + "__notes_91_txn_uuid_93_" : "frefer", + "__notes_91_transaction_id_93_" : "sdfccewf" + }, + "browser_info": { + "user_agent": "Mozilla\/5.0 (iPhone NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/70.0.3538.110 Safari\/537.36", + "ip_address": "128.0.0.1" + }, + "merchant_reference_id": "1756197223" +}' +``` +Response +``` +{ + "id": "12345_pay_0198e582efb27dd19d65039d63fdee24", + "status": "requires_customer_action", + "amount": { + "order_amount": 100, + "currency": "INR", + "shipping_cost": null, + "order_tax_amount": null, + "external_tax_calculation": "skip", + "surcharge_calculation": "skip", + "surcharge_amount": null, + "tax_on_surcharge": null, + "net_amount": 100, + "amount_to_capture": null, + "amount_capturable": 0, + "amount_captured": null + }, + "customer_id": null, + "connector": "razorpay", + "created": "2025-08-26T08:33:40.275Z", + "payment_method_data": { + "billing": { + "address": null, + "phone": { + "number": "8056594427", + "country_code": "+91" + }, + "email": "swangi.kumari@juspay.in" + } + }, + "payment_method_type": "upi", + "payment_method_subtype": "upi_collect", + "connector_transaction_id": "pay_R9tm9SQPe1lw99", + "connector_reference_id": "order_R9tm8rO2C9Po6a", + "merchant_connector_id": "mca_bYbJJ3mQjcf6SDC8cULu", + "browser_info": null, + "error": null, + "shipping": null, + "billing": null, + "attempts": null, + "connector_token_details": null, + "payment_method_id": null, + "next_action": { + "type": "wait_screen_information", + "display_from_timestamp": 1756197222581835000, + "display_to_timestamp": 1756197522581835000, + "poll_config": { + "delay_in_secs": 5, + "frequency": 5 + } + }, + "return_url": "https://google.com/success", + "authentication_type": null, + "authentication_type_applied": "no_three_ds", + "is_iframe_redirection_enabled": null, + "merchant_reference_id": "1756197220", + "raw_connector_response": "{\"razorpay_payment_id\":\"pay_R9tm9SQPe1lw99\"}", + "feature_metadata": null +} +``` +check merchant_order_reference_id in UCS logs +image + + +## Checklist + + +- [x] I formatted the code `cargo +nightly fmt --all` +- [x] I addressed lints thrown by `cargo clippy` +- [ ] I reviewed the submitted code +- [ ] I added unit tests for my changes where possible +COMMENTS: +- semanticdiff-com[bot]: Review changes with  SemanticDiff +
+Changed Files +
+ +| File | Status | +| :--- | :--- | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9013/changes#crates/router/src/core/payments/transformers.rs)  [crates/router/src/core/payments/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9013/changes#crates/router/src/core/payments/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9013/changes#crates/router/src/core/payments/transformers.rs)  37% smaller | + +
+- sai-harsha-vardhan [crates/router/src/core/payments/transformers.rs:409]: We are already populating merchant_reference_id in `connector_request_reference_id` right? Why do we need this? +- Aishwariyaa-Anand [crates/router/src/core/payments/transformers.rs:409]: this is required for connector-service + +=== COMMIT === +SUBJECT: refactor(core): propagate merchant_reference_id for PaymentsAuthorizeData (#9013) + +=== FILES === +Summary: 1 files changed, +4 -1 +- crates/router/src/core/payments/transformers.rs (+4 -1) + +=== PATCH === +diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs +index 348a364c..cf91b2bc 100644 +--- a/crates/router/src/core/payments/transformers.rs ++++ b/crates/router/src/core/payments/transformers.rs +@@ -406,7 +406,10 @@ pub async fn construct_payment_router_data_for_authorize<'a>( + authentication_data: None, + customer_acceptance: None, + split_payments: None, +- merchant_order_reference_id: None, ++ merchant_order_reference_id: payment_data ++ .payment_intent ++ .merchant_reference_id ++ .map(|reference_id| reference_id.get_string_repr().to_owned()), + integrity_object: None, + shipping_cost: payment_data.payment_intent.amount_details.shipping_cost, + additional_payment_method_data: None, + +----- END CHUNK ----- \ No newline at end of file diff --git a/raw/4b/4b7f2093db87be939814c9da0dbaaf2f2975bb84.txt b/raw/4b/4b7f2093db87be939814c9da0dbaaf2f2975bb84.txt new file mode 100644 index 0000000000000000000000000000000000000000..b805c84002ee54329eae49013ef3f687ef396d90 --- /dev/null +++ b/raw/4b/4b7f2093db87be939814c9da0dbaaf2f2975bb84.txt @@ -0,0 +1,49 @@ +ROUTE: juspay/hyperswitch@4b7f2093db87be939814c9da0dbaaf2f2975bb84 +REPO: https://github.com/juspay/hyperswitch +COMMIT: 4b7f2093db87be939814c9da0dbaaf2f2975bb84 +AUTHOR: github-actions <41898282+github-actions[bot]@users.noreply.github.com> +DATE: 2025-08-27T00:30:24 + +=== COMMIT === +SUBJECT: chore(version): 2025.08.27.0 + +=== FILES === +Summary: 1 files changed, +22 -0 +- CHANGELOG.md (+22 -0) + +=== PATCH === +diff --git a/CHANGELOG.md b/CHANGELOG.md +index 43e9baac..b3293b8c 100644 +--- a/CHANGELOG.md ++++ b/CHANGELOG.md +@@ -4,6 +4,28 @@ All notable changes to HyperSwitch will be documented here. + + - - - + ++## 2025.08.27.0 ++ ++### Features ++ ++- **connector:** ++ - [Paysafe] add connector template code ([#9011](https://github.com/juspay/hyperswitch/pull/9011)) ([`ce0159b`](https://github.com/juspay/hyperswitch/commit/ce0159b6d098dba1e00622d18b0f1b29f2151b9f)) ++ - [Nuvei] Implement setup mandate flow for cards ([#9012](https://github.com/juspay/hyperswitch/pull/9012)) ([`58ff01b`](https://github.com/juspay/hyperswitch/commit/58ff01bab25b167c5f6d8614b02b10d16154e461)) ++- **payment-link:** Handle locale in payment links ([#9064](https://github.com/juspay/hyperswitch/pull/9064)) ([`aaf5ea9`](https://github.com/juspay/hyperswitch/commit/aaf5ea9886cd11222ee2eced21e098182c0388ac)) ++ ++### Bug Fixes ++ ++- **connector:** [nordea] pass valid connector metadata fields and properly throw error unsupported flows ([#9041](https://github.com/juspay/hyperswitch/pull/9041)) ([`70b426e`](https://github.com/juspay/hyperswitch/commit/70b426e3cac2dffee30fe99cdaa7040d74d92312)) ++- **routing:** Activating multiple configs in decision engine ([#9036](https://github.com/juspay/hyperswitch/pull/9036)) ([`8446ffb`](https://github.com/juspay/hyperswitch/commit/8446ffbf5992a97d79d129cade997effc60fcd85)) ++ ++### Refactors ++ ++- **connector:** Implement amount converter framework for authorizedotnet, bankofamerica ([#8878](https://github.com/juspay/hyperswitch/pull/8878)) ([`30925ca`](https://github.com/juspay/hyperswitch/commit/30925ca5dd51be93e33ac4492b85c2322263b3fc)) ++ ++**Full Changelog:** [`2025.08.26.0...2025.08.27.0`](https://github.com/juspay/hyperswitch/compare/2025.08.26.0...2025.08.27.0) ++ ++- - - ++ + ## 2025.08.26.0 + + ### Features + +----- END CHUNK ----- \ No newline at end of file diff --git a/raw/58/58ff01bab25b167c5f6d8614b02b10d16154e461.txt b/raw/58/58ff01bab25b167c5f6d8614b02b10d16154e461.txt new file mode 100644 index 0000000000000000000000000000000000000000..1ec667d7504865067fd3c3abc850c87261fcff0e --- /dev/null +++ b/raw/58/58ff01bab25b167c5f6d8614b02b10d16154e461.txt @@ -0,0 +1,1590 @@ +ROUTE: juspay/hyperswitch@58ff01bab25b167c5f6d8614b02b10d16154e461 +REPO: https://github.com/juspay/hyperswitch +COMMIT: 58ff01bab25b167c5f6d8614b02b10d16154e461 +AUTHOR: Vani Gupta <118043711+Vani-1107@users.noreply.github.com> +DATE: 2025-08-26T12:04:41 + +=== ISSUE_AND_PR === +[PR #9012] feat(connector): [Nuvei] Implement setup mandate flow for cards +URL: https://github.com/juspay/hyperswitch/pull/9012 +BODY: +## Type of Change + + +- [ ] Bugfix +- [x] New feature +- [ ] Enhancement +- [ ] Refactoring +- [ ] Dependency updates +- [ ] Documentation +- [ ] CI/CD + +## Description + +Add setup mandate flow for cards + +### Additional Changes + +- [ ] This PR modifies the API contract +- [ ] This PR modifies the database schema +- [ ] This PR modifies application configuration/environment variables + + + + +## Motivation and Context + +https://github.com/juspay/hyperswitch-cloud/issues/10774 + +## How did you test it? + + +Setup mandate flow : + +
+ + Request + +``` + +{ + "amount": 0, + "currency": "EUR", + "confirm": true, + "customer_id":"nithxxinn", + "return_url": "https://www.google.com", + "capture_method": "automatic", + "payment_type" : "setup_mandate", + "setup_future_usage": "off_session", + "authentication_type": "no_three_ds", + "description": "hellow world", + "customer_acceptance": { + "acceptance_type": "online", + "accepted_at": "1963-05-03T04:07:52.723Z", + "online": { + "ip_address": "in sit", + "user_agent": "amet irure esse" + } + }, + "billing": { + "address": { + "zip": "560095", + "country": "US", + "first_name": "Sakil", + "last_name": "Mostak", + "line1": "Fasdf", + "line2": "Fasdf", + "city": "Fasdf" + } + }, + "browser_info": { + "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", + "ip_address": "192.168.1.1", + "java_enabled": false, + "java_script_enabled": true, + "language": "en-US", + "color_depth": 24, + "screen_height": 1080, + "screen_width": 1920, + "time_zone": 330, + "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36" + }, + "email": "hello@gmail.com", + "payment_method": "card", + "payment_method_type": "credit", + "payment_method_data": { + "card": { + "card_number": "2221008123677736", + "card_exp_month": "12", + "card_exp_year": "2030", + "card_holder_name": "CL-BRW2", + "card_cvc": "217" + } + } +} + +``` + +
+ + +
+ + Response + +``` + +{ + "payment_id": "pay_pIlTtdr1FzpccQG2efu1", + "merchant_id": "merchant_1755776197", + "status": "succeeded", + "amount": 0, + "net_amount": 0, + "shipping_cost": null, + "amount_capturable": 0, + "amount_received": null, + "connector": "nuvei", + "client_secret": "pay_pIlTtdr1FzpccQG2efu1_secret_81FAsrNQcaGOZA9kn4wg", + "created": "2025-08-21T12:22:44.656Z", + "currency": "EUR", + "customer_id": "nithxxinn", + "customer": { + "id": "nithxxinn", + "name": null, + "email": "hello@gmail.com", + "phone": null, + "phone_country_code": null + }, + "description": "hellow world", + "refunds": null, + "disputes": null, + "mandate_id": null, + "mandate_data": null, + "setup_future_usage": "off_session", + "off_session": null, + "capture_on": null, + "capture_method": "automatic", + "payment_method": "card", + "payment_method_data": { + "card": { + "last4": "7736", + "card_type": null, + "card_network": null, + "card_issuer": null, + "card_issuing_country": null, + "card_isin": "222100", + "card_extended_bin": null, + "card_exp_month": "12", + "card_exp_year": "2030", + "card_holder_name": "CL-BRW2", + "payment_checks": { + "avs_description": null, + "avs_result_code": "", + "cvv_2_reply_code": "", + "cvv_2_description": null, + "merchant_advice_code": "", + "merchant_advice_code_description": null + }, + "authentication_data": {} + }, + "billing": null + }, + "payment_token": "token_HvFMUgI2CKK3b4yjzVAl", + "shipping": null, + "billing": { + "address": { + "city": "Fasdf", + "country": "US", + "line1": "Fasdf", + "line2": "Fasdf", + "line3": null, + "zip": "560095", + "state": null, + "first_name": "Sakil", + "last_name": "Mostak", + "origin_zip": null + }, + "phone": null, + "email": null + }, + "order_details": null, + "email": "hello@gmail.com", + "name": null, + "phone": null, + "return_url": "https://www.google.com/", + "authentication_type": "no_three_ds", + "statement_descriptor_name": null, + "statement_descriptor_suffix": null, + "next_action": null, + "cancellation_reason": null, + "error_code": null, + "error_message": null, + "unified_code": null, + "unified_message": null, + "payment_experience": null, + "payment_method_type": "credit", + "connector_label": null, + "business_country": null, + "business_label": "default", + "business_sub_label": null, + "allowed_payment_method_types": null, + "ephemeral_key": { + "customer_id": "nithxxinn", + "created_at": 1755778964, + "expires": 1755782564, + "secret": "epk_959b0c962665436da106a97edbd70ae3" + }, + "manual_retry_allowed": false, + "connector_transaction_id": "7110000000016661021", + "frm_message": null, + "metadata": null, + "connector_metadata": null, + "feature_metadata": { + "redirect_response": null, + "search_tags": null, + "apple_pay_recurring_details": null, + "gateway_system": "direct" + }, + "reference_id": "8110755112", + "payment_link": null, + "profile_id": "pro_zCDeu3sBLjaoR0j1q2f0", + "surcharge_details": null, + "attempt_count": 1, + "merchant_decision": null, + "merchant_connector_id": "mca_DKTxGltWZglmtIc8ESRB", + "incremental_authorization_allowed": false, + "authorization_count": null, + "incremental_authorizations": null, + "external_authentication_details": null, + "external_3ds_authentication_attempted": false, + "expires_on": "2025-08-21T12:37:44.656Z", + "fingerprint": null, + "browser_info": { + "language": "en-US", + "time_zone": 330, + "ip_address": "192.168.1.1", + "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36", + "color_depth": 24, + "java_enabled": false, + "screen_width": 1920, + "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", + "screen_height": 1080, + "java_script_enabled": true + }, + "payment_channel": null, + "payment_method_id": "pm_1e16m2dO2LGRw0xHN4Ns", + "network_transaction_id": null, + "payment_method_status": "active", + "updated": "2025-08-21T12:22:47.199Z", + "split_payments": null, + "frm_metadata": null, + "extended_authorization_applied": null, + "capture_before": null, + "merchant_order_reference_id": null, + "order_tax_amount": null, + "connector_mandate_id": "2088668112", + "card_discovery": "manual", + "force_3ds_challenge": false, + "force_3ds_challenge_trigger": false, + "issuer_error_code": null, + "issuer_error_message": null, + "is_iframe_redirection_enabled": null, + "whole_connector_response": null, + "enable_partial_authorization": null +} + +``` + +
+ +Recurring call : + +
+ + Request + +``` + +{ + "amount": 100, + "currency": "EUR", + "customer_id": "nithxxinn", + "confirm": true, + "off_session": true, + "recurring_details": { + "type": "payment_method_id", + "data": "pm_1e16m2dO2LGRw0xHN4Ns" + } +} + +``` + +
+ +
+ + Request + +``` + +{ + "payment_id": "pay_0yEgYyrcrlNbjuSUTlRf", + "merchant_id": "merchant_1755776197", + "status": "succeeded", + "amount": 100, + "net_amount": 100, + "shipping_cost": null, + "amount_capturable": 0, + "amount_received": 100, + "connector": "nuvei", + "client_secret": "pay_0yEgYyrcrlNbjuSUTlRf_secret_9c0ZpjkCY5jh9HLeyw22", + "created": "2025-08-21T12:23:44.859Z", + "currency": "EUR", + "customer_id": "nithxxinn", + "customer": { + "id": "nithxxinn", + "name": null, + "email": "hello@gmail.com", + "phone": null, + "phone_country_code": null + }, + "description": null, + "refunds": null, + "disputes": null, + "mandate_id": null, + "mandate_data": null, + "setup_future_usage": null, + "off_session": true, + "capture_on": null, + "capture_method": null, + "payment_method": "card", + "payment_method_data": { + "card": { + "last4": "7736", + "card_type": null, + "card_network": null, + "card_issuer": null, + "card_issuing_country": null, + "card_isin": "222100", + "card_extended_bin": null, + "card_exp_month": "12", + "card_exp_year": "2030", + "card_holder_name": "CL-BRW2", + "payment_checks": null, + "authentication_data": null + }, + "billing": null + }, + "payment_token": null, + "shipping": null, + "billing": null, + "order_details": null, + "email": "hello@gmail.com", + "name": null, + "phone": null, + "return_url": null, + "authentication_type": "no_three_ds", + "statement_descriptor_name": null, + "statement_descriptor_suffix": null, + "next_action": null, + "cancellation_reason": null, + "error_code": null, + "error_message": null, + "unified_code": null, + "unified_message": null, + "payment_experience": null, + "payment_method_type": "credit", + "connector_label": null, + "business_country": null, + "business_label": "default", + "business_sub_label": null, + "allowed_payment_method_types": null, + "ephemeral_key": { + "customer_id": "nithxxinn", + "created_at": 1755779024, + "expires": 1755782624, + "secret": "epk_88ca1d7865784274bad1200e6cfc4d64" + }, + "manual_retry_allowed": false, + "connector_transaction_id": "7110000000016661082", + "frm_message": null, + "metadata": null, + "connector_metadata": null, + "feature_metadata": { + "redirect_response": null, + "search_tags": null, + "apple_pay_recurring_details": null, + "gateway_system": "direct" + }, + "reference_id": "8110775112", + "payment_link": null, + "profile_id": "pro_zCDeu3sBLjaoR0j1q2f0", + "surcharge_details": null, + "attempt_count": 1, + "merchant_decision": null, + "merchant_connector_id": "mca_DKTxGltWZglmtIc8ESRB", + "incremental_authorization_allowed": false, + "authorization_count": null, + "incremental_authorizations": null, + "external_authentication_details": null, + "external_3ds_authentication_attempted": false, + "expires_on": "2025-08-21T12:38:44.858Z", + "fingerprint": null, + "browser_info": { + "language": "en-US", + "time_zone": 330, + "ip_address": "192.168.1.1", + "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36", + "color_depth": 24, + "java_enabled": false, + "screen_width": 1920, + "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", + "screen_height": 1080, + "java_script_enabled": true + }, + "payment_channel": null, + "payment_method_id": "pm_1e16m2dO2LGRw0xHN4Ns", + "network_transaction_id": null, + "payment_method_status": "active", + "updated": "2025-08-21T12:23:46.367Z", + "split_payments": null, + "frm_metadata": null, + "extended_authorization_applied": null, + "capture_before": null, + "merchant_order_reference_id": null, + "order_tax_amount": null, + "connector_mandate_id": "2088668112", + "card_discovery": "manual", + "force_3ds_challenge": false, + "force_3ds_challenge_trigger": false, + "issuer_error_code": null, + "issuer_error_message": null, + "is_iframe_redirection_enabled": null, + "whole_connector_response": null, + "enable_partial_authorization": null +} + +``` + +
+ +Screenshot 2025-08-26 at 8 21 38 AM + +## Checklist + + +- [x] I formatted the code `cargo +nightly fmt --all` +- [x] I addressed lints thrown by `cargo clippy` +- [x] I reviewed the submitted code +- [ ] I added unit tests for my changes where possible +COMMENTS: +- semanticdiff-com[bot]: Review changes with  SemanticDiff +
+Changed Files +
+ +| File | Status | +| :--- | :--- | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9012/changes#crates/router/src/core/payments/flows/setup_mandate_flow.rs)  [crates/router/src/core/payments/flows/setup\_mandate\_flow\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9012/changes#crates/router/src/core/payments/flows/setup_mandate_flow.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9012/changes#crates/router/src/core/payments/flows/setup_mandate_flow.rs)  5% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9012/changes#crates/hyperswitch_connectors/src/connectors/nuvei.rs)  [crates/hyperswitch\_connectors/src/connectors/nuvei\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9012/changes#crates/hyperswitch_connectors/src/connectors/nuvei.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9012/changes#crates/hyperswitch_connectors/src/connectors/nuvei.rs)  3% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9012/changes#crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/nuvei/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9012/changes#crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9012/changes#crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs)  2% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9012/changes#crates/hyperswitch_connectors/src/connectors/celero/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/celero/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9012/changes#crates/hyperswitch_connectors/src/connectors/celero/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9012/changes#crates/hyperswitch_connectors/src/connectors/celero/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9012/changes#crates/hyperswitch_domain_models/src/router_request_types.rs)  [crates/hyperswitch\_domain\_models/src/router\_request\_types\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9012/changes#crates/hyperswitch_domain_models/src/router_request_types.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9012/changes#crates/hyperswitch_domain_models/src/router_request_types.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9012/changes#crates/router/src/core/payments/transformers.rs)  [crates/router/src/core/payments/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9012/changes#crates/router/src/core/payments/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9012/changes#crates/router/src/core/payments/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9012/changes#crates/router/src/types.rs)  [crates/router/src/types\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9012/changes#crates/router/src/types.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9012/changes#crates/router/src/types.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9012/changes#cypress-tests/cypress/e2e/configs/Payment/Nuvei.js)  [cypress\-tests/cypress/e2e/configs/Payment/Nuvei\.js](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9012/changes#cypress-tests/cypress/e2e/configs/Payment/Nuvei.js) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9012/changes#cypress-tests/cypress/e2e/configs/Payment/Nuvei.js)  0% smaller | + +
+- deepanshu-iiitu: In the recurring call why are we passing browser info? + +=== COMMIT === +SUBJECT: feat(connector): [Nuvei] Implement setup mandate flow for cards (#9012) +BODY: +Co-authored-by: Vani Gupta +Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> + +=== FILES === +Summary: 8 files changed, +601 -101 +- crates/hyperswitch_connectors/src/connectors/celero/transformers.rs (+1 -1) +- crates/hyperswitch_connectors/src/connectors/nuvei.rs (+78 -7) +- crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs (+217 -54) +- crates/hyperswitch_domain_models/src/router_request_types.rs (+40 -1) +- crates/router/src/core/payments/flows/setup_mandate_flow.rs (+107 -1) +- crates/router/src/core/payments/transformers.rs (+6 -0) +- crates/router/src/types.rs (+11 -0) +- cypress-tests/cypress/e2e/configs/Payment/Nuvei.js (+141 -37) + +=== PATCH === +diff --git a/crates/hyperswitch_connectors/src/connectors/celero/transformers.rs b/crates/hyperswitch_connectors/src/connectors/celero/transformers.rs +index 76990260..2003ba59 100644 +--- a/crates/hyperswitch_connectors/src/connectors/celero/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/celero/transformers.rs +@@ -844,7 +844,7 @@ pub fn get_avs_definition(code: &str) -> Option<&'static str> { + "8" => Some("Cardholder name, address, and ZIP do not match"), + _ => { + router_env::logger::info!( +- "Celero avs response code ({:?}) is not mapped to any defination.", ++ "Celero avs response code ({:?}) is not mapped to any definition.", + code + ); + +diff --git a/crates/hyperswitch_connectors/src/connectors/nuvei.rs b/crates/hyperswitch_connectors/src/connectors/nuvei.rs +index 79434797..8fda86c4 100644 +--- a/crates/hyperswitch_connectors/src/connectors/nuvei.rs ++++ b/crates/hyperswitch_connectors/src/connectors/nuvei.rs +@@ -129,6 +129,8 @@ impl ConnectorIntegration for Nuvei {} ++ + impl api::MandateSetup for Nuvei {} + impl api::PaymentVoid for Nuvei {} + impl api::PaymentSync for Nuvei {} +@@ -143,16 +145,87 @@ impl api::PaymentsCompleteAuthorize for Nuvei {} + impl api::ConnectorAccessToken for Nuvei {} + impl api::PaymentsPreProcessing for Nuvei {} + impl api::PaymentPostCaptureVoid for Nuvei {} ++ + impl ConnectorIntegration for Nuvei { +- fn build_request( ++ fn get_headers( ++ &self, ++ req: &RouterData, ++ connectors: &Connectors, ++ ) -> CustomResult)>, errors::ConnectorError> { ++ self.build_headers(req, connectors) ++ } ++ ++ fn get_content_type(&self) -> &'static str { ++ self.common_get_content_type() ++ } ++ ++ fn get_url( + &self, + _req: &RouterData, ++ connectors: &Connectors, ++ ) -> CustomResult { ++ Ok(format!( ++ "{}ppp/api/v1/payment.do", ++ ConnectorCommon::base_url(self, connectors) ++ )) ++ } ++ ++ fn get_request_body( ++ &self, ++ req: &RouterData, + _connectors: &Connectors, ++ ) -> CustomResult { ++ let connector_req = nuvei::NuveiPaymentsRequest::try_from((req, req.get_session_token()?))?; ++ Ok(RequestContent::Json(Box::new(connector_req))) ++ } ++ ++ fn build_request( ++ &self, ++ req: &RouterData, ++ connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { +- Err( +- errors::ConnectorError::NotImplemented("Setup Mandate flow for Nuvei".to_string()) +- .into(), +- ) ++ Ok(Some( ++ RequestBuilder::new() ++ .method(Method::Post) ++ .url(&types::SetupMandateType::get_url(self, req, connectors)?) ++ .attach_default_headers() ++ .headers(types::SetupMandateType::get_headers(self, req, connectors)?) ++ .set_body(types::SetupMandateType::get_request_body( ++ self, req, connectors, ++ )?) ++ .build(), ++ )) ++ } ++ ++ fn handle_response( ++ &self, ++ data: &RouterData, ++ event_builder: Option<&mut ConnectorEvent>, ++ res: Response, ++ ) -> CustomResult< ++ RouterData, ++ errors::ConnectorError, ++ > { ++ let response: nuvei::NuveiPaymentsResponse = res ++ .response ++ .parse_struct("NuveiPaymentsResponse") ++ .switch()?; ++ event_builder.map(|i| i.set_response_body(&response)); ++ router_env::logger::info!(connector_response=?response); ++ ++ RouterData::try_from(ResponseRouterData { ++ response, ++ data: data.clone(), ++ http_code: res.status_code, ++ }) ++ } ++ ++ fn get_error_response( ++ &self, ++ res: Response, ++ event_builder: Option<&mut ConnectorEvent>, ++ ) -> CustomResult { ++ self.build_error_response(res, event_builder) + } + } + +@@ -569,8 +642,6 @@ impl ConnectorIntegration fo + } + } + +-impl ConnectorIntegration for Nuvei {} +- + #[async_trait::async_trait] + impl ConnectorIntegration for Nuvei { + fn get_headers( +diff --git a/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs b/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs +index 2280bbb7..fa9c3e4d 100644 +--- a/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs +@@ -1,19 +1,18 @@ +-use common_enums::{enums, CaptureMethod, PaymentChannel}; ++use common_enums::{enums, CaptureMethod, FutureUsage, PaymentChannel}; + use common_types::payments::{ApplePayPaymentData, GpayTokenizationData}; + use common_utils::{ + crypto::{self, GenerateDigest}, + date_time, +- ext_traits::{Encode, OptionExt}, ++ ext_traits::Encode, + fp_utils, + id_type::CustomerId, +- pii::{Email, IpAddress}, ++ pii::{self, Email, IpAddress}, + request::Method, + types::{MinorUnit, StringMajorUnit, StringMajorUnitForConnector}, + }; + use error_stack::ResultExt; + use hyperswitch_domain_models::{ + address::Address, +- mandates::{MandateData, MandateDataType}, + payment_method_data::{ + self, ApplePayWalletData, BankRedirectData, GooglePayWalletData, PayLaterData, + PaymentMethodData, WalletData, +@@ -24,11 +23,11 @@ use hyperswitch_domain_models::{ + }, + router_flow_types::{ + refunds::{Execute, RSync}, +- Authorize, Capture, CompleteAuthorize, PSync, PostCaptureVoid, Void, ++ Authorize, Capture, CompleteAuthorize, PSync, PostCaptureVoid, SetupMandate, Void, + }, + router_request_types::{ + authentication::MessageExtensionAttribute, BrowserInformation, PaymentsAuthorizeData, +- PaymentsPreProcessingData, ResponseId, ++ PaymentsPreProcessingData, ResponseId, SetupMandateRequestData, + }, + router_response_types::{ + MandateReference, PaymentsResponseData, RedirectForm, RefundsResponseData, +@@ -70,12 +69,11 @@ fn to_boolean(string: String) -> bool { + // The dimensions of the challenge window for full screen. + const CHALLENGE_WINDOW_SIZE: &str = "05"; + // The challenge preference for the challenge flow. +-const CHALLENGE_PREFERNCE: &str = "01"; ++const CHALLENGE_PREFERENCE: &str = "01"; + + trait NuveiAuthorizePreprocessingCommon { + fn get_browser_info(&self) -> Option; + fn get_related_transaction_id(&self) -> Option; +- fn get_setup_mandate_details(&self) -> Option; + fn get_complete_authorize_url(&self) -> Option; + fn get_is_moto(&self) -> Option; + fn get_connector_mandate_id(&self) -> Option; +@@ -98,9 +96,10 @@ trait NuveiAuthorizePreprocessingCommon { + fn get_order_tax_amount( + &self, + ) -> Result, error_stack::Report>; ++ fn is_customer_initiated_mandate_payment(&self) -> bool; + } + +-impl NuveiAuthorizePreprocessingCommon for PaymentsAuthorizeData { ++impl NuveiAuthorizePreprocessingCommon for SetupMandateRequestData { + fn get_browser_info(&self) -> Option { + self.browser_info.clone() + } +@@ -119,8 +118,89 @@ impl NuveiAuthorizePreprocessingCommon for PaymentsAuthorizeData { + self.customer_id.clone() + } + +- fn get_setup_mandate_details(&self) -> Option { +- self.setup_mandate_details.clone() ++ fn get_complete_authorize_url(&self) -> Option { ++ self.complete_authorize_url.clone() ++ } ++ ++ fn get_connector_mandate_id(&self) -> Option { ++ self.mandate_id.as_ref().and_then(|mandate_ids| { ++ mandate_ids.mandate_reference_id.as_ref().and_then( ++ |mandate_ref_id| match mandate_ref_id { ++ api_models::payments::MandateReferenceId::ConnectorMandateId(id) => { ++ id.get_connector_mandate_id() ++ } ++ _ => None, ++ }, ++ ) ++ }) ++ } ++ ++ fn get_return_url_required( ++ &self, ++ ) -> Result> { ++ self.router_return_url ++ .clone() ++ .ok_or_else(missing_field_err("return_url")) ++ } ++ ++ fn get_capture_method(&self) -> Option { ++ self.capture_method ++ } ++ ++ fn get_currency_required( ++ &self, ++ ) -> Result> { ++ Ok(self.currency) ++ } ++ fn get_payment_method_data_required( ++ &self, ++ ) -> Result> { ++ Ok(self.payment_method_data.clone()) ++ } ++ fn get_order_tax_amount( ++ &self, ++ ) -> Result, error_stack::Report> { ++ Ok(None) ++ } ++ ++ fn get_minor_amount_required( ++ &self, ++ ) -> Result> { ++ self.minor_amount ++ .ok_or_else(missing_field_err("minor_amount")) ++ } ++ ++ fn get_is_partial_approval(&self) -> Option { ++ self.enable_partial_authorization ++ .map(PartialApprovalFlag::from) ++ } ++ ++ fn get_email_required(&self) -> Result> { ++ self.email.clone().ok_or_else(missing_field_err("email")) ++ } ++ fn is_customer_initiated_mandate_payment(&self) -> bool { ++ (self.customer_acceptance.is_some() || self.setup_mandate_details.is_some()) ++ && self.setup_future_usage == Some(FutureUsage::OffSession) ++ } ++} ++ ++impl NuveiAuthorizePreprocessingCommon for PaymentsAuthorizeData { ++ fn get_browser_info(&self) -> Option { ++ self.browser_info.clone() ++ } ++ ++ fn get_related_transaction_id(&self) -> Option { ++ self.related_transaction_id.clone() ++ } ++ fn get_is_moto(&self) -> Option { ++ match self.payment_channel { ++ Some(PaymentChannel::MailOrder) | Some(PaymentChannel::TelephoneOrder) => Some(true), ++ _ => None, ++ } ++ } ++ ++ fn get_customer_id_required(&self) -> Option { ++ self.customer_id.clone() + } + + fn get_complete_authorize_url(&self) -> Option { +@@ -166,7 +246,10 @@ impl NuveiAuthorizePreprocessingCommon for PaymentsAuthorizeData { + fn get_email_required(&self) -> Result> { + self.get_email() + } +- ++ fn is_customer_initiated_mandate_payment(&self) -> bool { ++ (self.customer_acceptance.is_some() || self.setup_mandate_details.is_some()) ++ && self.setup_future_usage == Some(FutureUsage::OffSession) ++ } + fn get_is_partial_approval(&self) -> Option { + self.enable_partial_authorization + .map(PartialApprovalFlag::from) +@@ -192,8 +275,9 @@ impl NuveiAuthorizePreprocessingCommon for PaymentsPreProcessingData { + fn get_email_required(&self) -> Result> { + self.get_email() + } +- fn get_setup_mandate_details(&self) -> Option { +- self.setup_mandate_details.clone() ++ fn is_customer_initiated_mandate_payment(&self) -> bool { ++ (self.customer_acceptance.is_some() || self.setup_mandate_details.is_some()) ++ && self.setup_future_usage == Some(FutureUsage::OffSession) + } + + fn get_complete_authorize_url(&self) -> Option { +@@ -1430,6 +1514,19 @@ where + item.get_optional_shipping().map(|address| address.into()); + + let billing_address: Option = address.map(|ref address| address.into()); ++ ++ let device_details = if request_data ++ .device_details ++ .ip_address ++ .clone() ++ .expose() ++ .is_empty() ++ { ++ DeviceDetails::foreign_try_from(&item.request.get_browser_info())? ++ } else { ++ request_data.device_details.clone() ++ }; ++ + Ok(Self { + is_rebilling: request_data.is_rebilling, + user_token_id: item.customer_id.clone(), +@@ -1437,9 +1534,7 @@ where + payment_option: request_data.payment_option, + billing_address, + shipping_address, +- device_details: DeviceDetails::foreign_try_from( +- &item.request.get_browser_info().clone(), +- )?, ++ device_details, + url_details: Some(UrlDetails { + success_url: return_url.clone(), + failure_url: return_url.clone(), +@@ -1471,59 +1566,41 @@ where + .and_then(|billing_details| billing_details.address.as_ref()); + + if let Some(address) = address { +- // mandatory feilds check ++ // mandatory fields check + address.get_first_name()?; + item.request.get_email_required()?; + item.get_billing_country()?; + } + + let (is_rebilling, additional_params, user_token_id) = +- match item.request.get_setup_mandate_details().clone() { +- Some(mandate_data) => { +- let details = match mandate_data +- .mandate_type +- .get_required_value("mandate_type") +- .change_context(errors::ConnectorError::MissingRequiredField { +- field_name: "mandate_type", +- })? { +- MandateDataType::SingleUse(details) => details, +- MandateDataType::MultiUse(details) => { +- details.ok_or(errors::ConnectorError::MissingRequiredField { +- field_name: "mandate_data.mandate_type.multi_use", +- })? +- } +- }; +- let mandate_meta: NuveiMandateMeta = utils::to_connector_meta_from_secret(Some( +- details.get_metadata().ok_or_else(missing_field_err( +- "mandate_data.mandate_type.{multi_use|single_use}.metadata", +- ))?, +- ))?; ++ match item.request.is_customer_initiated_mandate_payment() { ++ true => { + ( + Some("0".to_string()), // In case of first installment, rebilling should be 0 + Some(V2AdditionalParams { + rebill_expiry: Some( +- details +- .get_end_date(date_time::DateFormat::YYYYMMDD) +- .change_context(errors::ConnectorError::DateFormattingFailed)? +- .ok_or_else(missing_field_err( +- "mandate_data.mandate_type.{multi_use|single_use}.end_date", +- ))?, ++ time::OffsetDateTime::now_utc() ++ .replace_year(time::OffsetDateTime::now_utc().year() + 5) ++ .map_err(|_| errors::ConnectorError::DateFormattingFailed)? ++ .date() ++ .format(&time::macros::format_description!("[year][month][day]")) ++ .map_err(|_| errors::ConnectorError::DateFormattingFailed)?, + ), +- rebill_frequency: Some(mandate_meta.frequency), +- challenge_window_size: None, +- challenge_preference: None, ++ rebill_frequency: Some("0".to_string()), ++ challenge_window_size: Some(CHALLENGE_WINDOW_SIZE.to_string()), ++ challenge_preference: Some(CHALLENGE_PREFERENCE.to_string()), + }), + item.request.get_customer_id_required(), + ) + } + // non mandate transactions +- _ => ( ++ false => ( + None, + Some(V2AdditionalParams { + rebill_expiry: None, + rebill_frequency: None, + challenge_window_size: Some(CHALLENGE_WINDOW_SIZE.to_string()), +- challenge_preference: Some(CHALLENGE_PREFERNCE.to_string()), ++ challenge_preference: Some(CHALLENGE_PREFERENCE.to_string()), + }), + None, + ), +@@ -1570,7 +1647,6 @@ where + three_d, + card_holder_name: item.get_optional_billing_full_name(), + }), +- + is_moto, + ..Default::default() + }) +@@ -2110,6 +2186,66 @@ impl NuveiPaymentsGenericResponse for PSync {} + impl NuveiPaymentsGenericResponse for Capture {} + impl NuveiPaymentsGenericResponse for PostCaptureVoid {} + ++impl ++ TryFrom< ++ ResponseRouterData< ++ SetupMandate, ++ NuveiPaymentsResponse, ++ SetupMandateRequestData, ++ PaymentsResponseData, ++ >, ++ > for RouterData ++{ ++ type Error = error_stack::Report; ++ fn try_from( ++ item: ResponseRouterData< ++ SetupMandate, ++ NuveiPaymentsResponse, ++ SetupMandateRequestData, ++ PaymentsResponseData, ++ >, ++ ) -> Result { ++ let amount = item.data.request.amount; ++ ++ let (status, redirection_data, connector_response_data) = ++ process_nuvei_payment_response(&item, amount)?; ++ ++ let (amount_captured, minor_amount_capturable) = item.response.get_amount_captured()?; ++ ++ let ip_address = item ++ .data ++ .request ++ .browser_info ++ .as_ref() ++ .ok_or_else(|| errors::ConnectorError::MissingRequiredField { ++ field_name: "browser_info", ++ })? ++ .ip_address ++ .as_ref() ++ .ok_or_else(|| errors::ConnectorError::MissingRequiredField { ++ field_name: "browser_info.ip_address", ++ })? ++ .to_string(); ++ ++ Ok(Self { ++ status, ++ response: if let Some(err) = build_error_response(&item.response, item.http_code) { ++ Err(err) ++ } else { ++ Ok(create_transaction_response( ++ &item.response, ++ redirection_data, ++ Some(ip_address), ++ )?) ++ }, ++ amount_captured, ++ minor_amount_capturable, ++ connector_response: connector_response_data, ++ ..item.data ++ }) ++ } ++} ++ + // Helper function to process Nuvei payment response + + fn process_nuvei_payment_response( +@@ -2160,6 +2296,7 @@ where + fn create_transaction_response( + response: &NuveiPaymentsResponse, + redirection_data: Option, ++ ip_address: Option, + ) -> Result> { + Ok(PaymentsResponseData::TransactionResponse { + resource_id: response +@@ -2177,7 +2314,8 @@ fn create_transaction_response( + .map(|id| MandateReference { + connector_mandate_id: Some(id), + payment_method_id: None, +- mandate_metadata: None, ++ mandate_metadata: ip_address ++ .map(|ip| pii::SecretSerdeValue::new(serde_json::Value::String(ip))), + connector_mandate_request_reference_id: None, + }), + ), +@@ -2226,6 +2364,14 @@ impl + process_nuvei_payment_response(&item, amount)?; + + let (amount_captured, minor_amount_capturable) = item.response.get_amount_captured()?; ++ ++ let ip_address = item ++ .data ++ .request ++ .browser_info ++ .clone() ++ .and_then(|browser_info| browser_info.ip_address.map(|ip| ip.to_string())); ++ + Ok(Self { + status, + response: if let Some(err) = build_error_response(&item.response, item.http_code) { +@@ -2234,6 +2380,7 @@ impl + Ok(create_transaction_response( + &item.response, + redirection_data, ++ ip_address, + )?) + }, + amount_captured, +@@ -2273,6 +2420,7 @@ where + Ok(create_transaction_response( + &item.response, + redirection_data, ++ None, + )?) + }, + amount_captured, +@@ -2388,11 +2536,26 @@ where + None + }; + ++ let ip_address = data ++ .recurring_mandate_payment_data ++ .as_ref() ++ .and_then(|r| r.mandate_metadata.as_ref()) ++ .ok_or(errors::ConnectorError::MissingRequiredField { ++ field_name: "browser_info.ip_address", ++ })? ++ .clone() ++ .expose() ++ .as_str() ++ .ok_or(errors::ConnectorError::MissingRequiredField { ++ field_name: "browser_info.ip_address", ++ })? ++ .to_owned(); ++ + Ok(Self { + related_transaction_id, +- device_details: DeviceDetails::foreign_try_from( +- &item.request.get_browser_info().clone(), +- )?, ++ device_details: DeviceDetails { ++ ip_address: Secret::new(ip_address), ++ }, + is_rebilling: Some("1".to_string()), // In case of second installment, rebilling should be 1 + user_token_id: Some(customer_id), + payment_option: PaymentOption { +diff --git a/crates/hyperswitch_domain_models/src/router_request_types.rs b/crates/hyperswitch_domain_models/src/router_request_types.rs +index 5730c23d..f5ec0e7d 100644 +--- a/crates/hyperswitch_domain_models/src/router_request_types.rs ++++ b/crates/hyperswitch_domain_models/src/router_request_types.rs +@@ -305,6 +305,38 @@ impl TryFrom for ConnectorCustomerData { + }) + } + } ++ ++impl TryFrom for PaymentsPreProcessingData { ++ type Error = error_stack::Report; ++ ++ fn try_from(data: SetupMandateRequestData) -> Result { ++ Ok(Self { ++ payment_method_data: Some(data.payment_method_data), ++ amount: data.amount, ++ minor_amount: data.minor_amount, ++ email: data.email, ++ currency: Some(data.currency), ++ payment_method_type: data.payment_method_type, ++ setup_mandate_details: data.setup_mandate_details, ++ capture_method: data.capture_method, ++ order_details: None, ++ router_return_url: data.router_return_url, ++ webhook_url: data.webhook_url, ++ complete_authorize_url: data.complete_authorize_url, ++ browser_info: data.browser_info, ++ surcharge_details: None, ++ connector_transaction_id: None, ++ mandate_id: data.mandate_id, ++ related_transaction_id: None, ++ redirect_response: None, ++ enrolled_for_3ds: false, ++ split_payments: None, ++ metadata: data.metadata, ++ customer_acceptance: data.customer_acceptance, ++ setup_future_usage: data.setup_future_usage, ++ }) ++ } ++} + impl + TryFrom< + &RouterData, +@@ -515,7 +547,8 @@ pub struct PaymentsPreProcessingData { + pub redirect_response: Option, + pub metadata: Option>, + pub split_payments: Option, +- ++ pub customer_acceptance: Option, ++ pub setup_future_usage: Option, + // New amount for amount frame work + pub minor_amount: Option, + } +@@ -546,6 +579,8 @@ impl TryFrom for PaymentsPreProcessingData { + enrolled_for_3ds: data.enrolled_for_3ds, + split_payments: data.split_payments, + metadata: data.metadata.map(Secret::new), ++ customer_acceptance: data.customer_acceptance, ++ setup_future_usage: data.setup_future_usage, + }) + } + } +@@ -576,6 +611,8 @@ impl TryFrom for PaymentsPreProcessingData { + split_payments: None, + enrolled_for_3ds: true, + metadata: data.connector_meta.map(Secret::new), ++ customer_acceptance: data.customer_acceptance, ++ setup_future_usage: data.setup_future_usage, + }) + } + } +@@ -1215,6 +1252,8 @@ pub struct SetupMandateRequestData { + pub metadata: Option, + pub complete_authorize_url: Option, + pub capture_method: Option, ++ pub enrolled_for_3ds: bool, ++ pub related_transaction_id: Option, + + // MinorUnit for amount framework + pub minor_amount: Option, +diff --git a/crates/router/src/core/payments/flows/setup_mandate_flow.rs b/crates/router/src/core/payments/flows/setup_mandate_flow.rs +index 4c1b1a44..03593780 100644 +--- a/crates/router/src/core/payments/flows/setup_mandate_flow.rs ++++ b/crates/router/src/core/payments/flows/setup_mandate_flow.rs +@@ -19,7 +19,10 @@ use crate::{ + }, + routes::SessionState, + services, +- types::{self, api, domain, transformers::ForeignTryFrom}, ++ types::{ ++ self, api, domain, ++ transformers::{ForeignFrom, ForeignTryFrom}, ++ }, + }; + + #[cfg(feature = "v1")] +@@ -155,6 +158,38 @@ impl Feature for types::Setup + .await + } + ++ async fn add_session_token<'a>( ++ self, ++ state: &SessionState, ++ connector: &api::ConnectorData, ++ ) -> RouterResult ++ where ++ Self: Sized, ++ { ++ let connector_integration: services::BoxedPaymentConnectorIntegrationInterface< ++ api::AuthorizeSessionToken, ++ types::AuthorizeSessionTokenData, ++ types::PaymentsResponseData, ++ > = connector.connector.get_connector_integration(); ++ let authorize_data = &types::PaymentsAuthorizeSessionTokenRouterData::foreign_from(( ++ &self, ++ types::AuthorizeSessionTokenData::foreign_from(&self), ++ )); ++ let resp = services::execute_connector_processing_step( ++ state, ++ connector_integration, ++ authorize_data, ++ payments::CallConnectorAction::Trigger, ++ None, ++ None, ++ ) ++ .await ++ .to_payment_failed_response()?; ++ let mut router_data = self; ++ router_data.session_token = resp.session_token; ++ Ok(router_data) ++ } ++ + async fn add_payment_method_token<'a>( + &mut self, + state: &SessionState, +@@ -213,6 +248,14 @@ impl Feature for types::Setup + } + } + ++ async fn preprocessing_steps<'a>( ++ self, ++ state: &SessionState, ++ connector: &api::ConnectorData, ++ ) -> RouterResult { ++ setup_mandate_preprocessing_steps(state, &self, true, connector).await ++ } ++ + async fn call_unified_connector_service<'a>( + &mut self, + state: &SessionState, +@@ -301,3 +344,66 @@ impl mandate::MandateBehaviour for types::SetupMandateRequestData { + self.customer_acceptance.clone() + } + } ++ ++pub async fn setup_mandate_preprocessing_steps( ++ state: &SessionState, ++ router_data: &types::RouterData, ++ confirm: bool, ++ connector: &api::ConnectorData, ++) -> RouterResult> ++{ ++ if confirm { ++ let connector_integration: services::BoxedPaymentConnectorIntegrationInterface< ++ api::PreProcessing, ++ types::PaymentsPreProcessingData, ++ types::PaymentsResponseData, ++ > = connector.connector.get_connector_integration(); ++ ++ let preprocessing_request_data = ++ types::PaymentsPreProcessingData::try_from(router_data.request.clone())?; ++ ++ let preprocessing_response_data: Result = ++ Err(types::ErrorResponse::default()); ++ ++ let preprocessing_router_data = ++ helpers::router_data_type_conversion::<_, api::PreProcessing, _, _, _, _>( ++ router_data.clone(), ++ preprocessing_request_data, ++ preprocessing_response_data, ++ ); ++ ++ let resp = services::execute_connector_processing_step( ++ state, ++ connector_integration, ++ &preprocessing_router_data, ++ payments::CallConnectorAction::Trigger, ++ None, ++ None, ++ ) ++ .await ++ .to_payment_failed_response()?; ++ ++ let mut setup_mandate_router_data = helpers::router_data_type_conversion::<_, F, _, _, _, _>( ++ resp.clone(), ++ router_data.request.to_owned(), ++ resp.response.clone(), ++ ); ++ ++ if connector.connector_name == api_models::enums::Connector::Nuvei { ++ let (enrolled_for_3ds, related_transaction_id) = ++ match &setup_mandate_router_data.response { ++ Ok(types::PaymentsResponseData::ThreeDSEnrollmentResponse { ++ enrolled_v2, ++ related_transaction_id, ++ }) => (*enrolled_v2, related_transaction_id.clone()), ++ _ => (false, None), ++ }; ++ setup_mandate_router_data.request.enrolled_for_3ds = enrolled_for_3ds; ++ setup_mandate_router_data.request.related_transaction_id = related_transaction_id; ++ } ++ ++ Ok(setup_mandate_router_data) ++ } else { ++ Ok(router_data.clone()) ++ } ++} +diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs +index cdd552da..22fa8e4c 100644 +--- a/crates/router/src/core/payments/transformers.rs ++++ b/crates/router/src/core/payments/transformers.rs +@@ -1301,6 +1301,8 @@ pub async fn construct_payment_router_data_for_setup_mandate<'a>( + customer_id: None, + enable_partial_authorization: None, + payment_channel: None, ++ enrolled_for_3ds: true, ++ related_transaction_id: None, + }; + let connector_mandate_request_reference_id = payment_data + .payment_attempt +@@ -5118,6 +5120,8 @@ impl TryFrom> for types::SetupMandateRequ + customer_id: payment_data.payment_intent.customer_id, + enable_partial_authorization: payment_data.payment_intent.enable_partial_authorization, + payment_channel: payment_data.payment_intent.payment_channel, ++ related_transaction_id: None, ++ enrolled_for_3ds: true, + }) + } + } +@@ -5369,6 +5373,8 @@ impl TryFrom> for types::PaymentsPreProce + enrolled_for_3ds: true, + split_payments: payment_data.payment_intent.split_payments, + metadata: payment_data.payment_intent.metadata.map(Secret::new), ++ customer_acceptance: payment_data.customer_acceptance, ++ setup_future_usage: payment_data.payment_intent.setup_future_usage, + }) + } + } +diff --git a/crates/router/src/types.rs b/crates/router/src/types.rs +index 3055a254..1bf4c825 100644 +--- a/crates/router/src/types.rs ++++ b/crates/router/src/types.rs +@@ -1158,6 +1158,17 @@ impl ForeignFrom<&ExternalVaultProxyPaymentsRouterData> for AuthorizeSessionToke + } + } + ++impl<'a> ForeignFrom<&'a SetupMandateRouterData> for AuthorizeSessionTokenData { ++ fn foreign_from(data: &'a SetupMandateRouterData) -> Self { ++ Self { ++ amount_to_capture: data.request.amount, ++ currency: data.request.currency, ++ connector_transaction_id: data.payment_id.clone(), ++ amount: data.request.amount, ++ } ++ } ++} ++ + pub trait Tokenizable { + fn set_session_token(&mut self, token: Option); + } +diff --git a/cypress-tests/cypress/e2e/configs/Payment/Nuvei.js b/cypress-tests/cypress/e2e/configs/Payment/Nuvei.js +index fe3d4e87..00858819 100644 +--- a/cypress-tests/cypress/e2e/configs/Payment/Nuvei.js ++++ b/cypress-tests/cypress/e2e/configs/Payment/Nuvei.js +@@ -16,6 +16,25 @@ const successfulThreeDSCardDetails = { + card_holder_name: "CL-BRW1", + card_cvc: "123", + }; ++const singleUseMandateData = { ++ customer_acceptance: customerAcceptance, ++ mandate_type: { ++ single_use: { ++ amount: 8000, ++ currency: "USD", ++ }, ++ }, ++}; ++ ++const multiUseMandateData = { ++ customer_acceptance: customerAcceptance, ++ mandate_type: { ++ multi_use: { ++ amount: 8000, ++ currency: "USD", ++ }, ++ }, ++}; + // Payment method data objects for responses + const payment_method_data_no3ds = { + card: { +@@ -42,31 +61,6 @@ const payment_method_data_no3ds = { + billing: null, + }; + +-const payment_method_data_3ds = { +- card: { +- last4: "0961", +- card_type: "CREDIT", +- card_network: "Visa", +- card_issuer: "RIVER VALLEY CREDIT UNION", +- card_issuing_country: "UNITEDSTATES", +- card_isin: "400002", +- card_extended_bin: null, +- card_exp_month: "10", +- card_exp_year: "25", +- card_holder_name: "CL-BRW1", +- payment_checks: { +- avs_description: null, +- avs_result_code: "", +- cvv_2_reply_code: "", +- cvv_2_description: null, +- merchant_advice_code: "", +- merchant_advice_code_description: null, +- }, +- authentication_data: {}, +- }, +- billing: null, +-}; +- + export const connectorDetails = { + card_pm: { + // Basic payment intent creation +@@ -204,7 +198,6 @@ export const connectorDetails = { + body: { + status: "requires_customer_action", + setup_future_usage: "on_session", +- payment_method_data: payment_method_data_3ds, + }, + }, + }, +@@ -315,7 +308,25 @@ export const connectorDetails = { + }, + }, + }, +- ++ ZeroAuthMandate: { ++ Configs: { ++ TRIGGER_SKIP: true, ++ }, ++ Request: { ++ payment_method: "card", ++ payment_method_data: { ++ card: successfulNo3DSCardDetails, ++ }, ++ currency: "USD", ++ customer_acceptance: customerAcceptance, ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "succeeded", ++ }, ++ }, ++ }, + ZeroAuthPaymentIntent: { + Request: { + amount: 0, +@@ -331,23 +342,119 @@ export const connectorDetails = { + }, + }, + ZeroAuthConfirmPayment: { ++ Request: { ++ payment_type: "setup_mandate", ++ payment_method: "card", ++ payment_method_type: "credit", ++ payment_method_data: { ++ card: successfulNo3DSCardDetails, ++ }, ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "succeeded", ++ }, ++ }, ++ }, ++ MITManualCapture: { ++ Configs: { ++ TRIGGER_SKIP: true, ++ }, ++ Request: {}, ++ Response: { ++ status: 200, ++ body: { ++ status: "requires_capture", ++ }, ++ }, ++ }, ++ MandateSingleUseNo3DSAutoCapture: { + Configs: { + TRIGGER_SKIP: true, + }, + Request: { +- payment_type: "setup_mandate", + payment_method: "card", +- payment_method_type: "credit", + payment_method_data: { + card: successfulNo3DSCardDetails, + }, ++ currency: "USD", ++ customer_acceptance: customerAcceptance, ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "succeeded", ++ }, ++ }, ++ }, ++ MandateMultiUseNo3DSAutoCapture: { ++ Configs: { ++ TRIGGER_SKIP: true, ++ }, ++ Request: { ++ payment_method: "card", ++ payment_method_data: { ++ card: successfulNo3DSCardDetails, ++ }, ++ currency: "USD", ++ mandate_data: multiUseMandateData, ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "succeeded", ++ }, ++ }, ++ }, ++ MandateSingleUseNo3DSManualCapture: { ++ Configs: { ++ TRIGGER_SKIP: true, ++ }, ++ Request: { ++ payment_method: "card", ++ payment_method_data: { ++ card: successfulNo3DSCardDetails, ++ }, ++ currency: "USD", ++ mandate_data: singleUseMandateData, + }, + Response: { +- status: 501, +- error: { +- type: "invalid_request", +- message: "Setup Mandate flow for Nuvei is not implemented", +- code: "IR_00", ++ status: 200, ++ body: { ++ status: "requires_capture", ++ }, ++ }, ++ }, ++ MandateMultiUseNo3DSManualCapture: { ++ Configs: { ++ TRIGGER_SKIP: true, ++ }, ++ Request: { ++ payment_method: "card", ++ payment_method_data: { ++ card: successfulNo3DSCardDetails, ++ }, ++ currency: "USD", ++ mandate_data: multiUseMandateData, ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "requires_capture", ++ payment_method_data: payment_method_data_no3ds, ++ payment_method: "card", ++ }, ++ }, ++ }, ++ MITAutoCapture: { ++ Request: { ++ amount_to_capture: 6000, ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "succeeded", + }, + }, + }, +@@ -475,9 +582,6 @@ export const connectorDetails = { + }, + // Payment method ID mandate scenarios + PaymentMethodIdMandateNo3DSAutoCapture: { +- Configs: { +- TRIGGER_SKIP: true, +- }, + Request: { + payment_method: "card", + payment_method_data: { + +----- END CHUNK ----- \ No newline at end of file diff --git a/raw/5e/5efe4d9751bd88861bbe3e609bb815983fca9778.txt b/raw/5e/5efe4d9751bd88861bbe3e609bb815983fca9778.txt new file mode 100644 index 0000000000000000000000000000000000000000..ff44753087cd912c21d52553768dfb4dc9cd3d7f --- /dev/null +++ b/raw/5e/5efe4d9751bd88861bbe3e609bb815983fca9778.txt @@ -0,0 +1,1994 @@ +ROUTE: juspay/hyperswitch@5efe4d9751bd88861bbe3e609bb815983fca9778 +REPO: https://github.com/juspay/hyperswitch +COMMIT: 5efe4d9751bd88861bbe3e609bb815983fca9778 +AUTHOR: Aditya Chaurasia <113281443+AdityaKumaar21@users.noreply.github.com> +DATE: 2025-08-25T12:43:44 + +=== ISSUE_AND_PR === +[PR #8848] feat(revenue_recovery): Introducing new calculate job for card switching and invoice queueing +URL: https://github.com/juspay/hyperswitch/pull/8848 +BODY: +## Type of Change + + +- [ ] Bugfix +- [x] New feature +- [ ] Enhancement +- [ ] Refactoring +- [ ] Dependency updates +- [ ] Documentation +- [ ] CI/CD + +## Description + +**CALCULATE WORKFLOW** +CALCULATE WORKFLOW +When we receive failed webhook and its intent retry count is more than the threshold, it will inserted into calculate job with the schedule time with 1 hour from now, before inserting it will first check the DB for existing entry for CALCULATE_WORKFLOW_{payment_intent}, +If found and business_status is CALCULATE_WORKFLOW_QUEUED, then we just update the existing entry with scheduled time with plus hour. +If found and business_status is not CALCULATE_WORKFLOW_QUEUED, we do not insert the entry +If not found, make a new entry with scheduled time as 1 hour plus from now time and feed token list from payment_intent to tracking_data + +Introduced one new field in tracking_data +Invoice_scheduled_time Option (used as scheduling time in execute workflow and as well as for dashboard purpose) + +At the scheduled time, consumer picks it up and perform tasks like:- +Call a function(best_token_with_time() ) that returns Option<{(token, scheduled_time)}> +We pass scheduled time in tracking_data as well as pass in insert_execute_task_to_pt so that we can schedule EXECUTE WORKFLOW at that time, we change calculate flow's the business_status to CALCULATE_WORKFLOW_SCHEDULED and status as Finish also lock the customer of that active token with redis fn call. + +If we receive None from best_token_with_time(), then we call get_payment_processor_token_with_schedule_time() whose return type is also Option<{PSPstatusdetails}>, if this is Some() then we just requeue it with wait time return by this fn, and add 15 minutes as buffer time and update the business_status as CALCULATE_WORKFLOW_QUEUED, else if it returns None then we mark the invoice as finish and finish the calculate workflow since this is a HARD DECLINE. + +EXECUTE WORKFLOW +When the consumer picks up the execute task, it tries to do payment by calling proxy_api at the scheduled_time, here we have three possibilities for response of payment:- +Success:- +Update the token with success status and also update calculate_workflow entry’s business_status to CALCULATE_WORKFLOW_COMPLETED and status to Finish and also unlock the customer with redis fn call and change the status of token to success in redis. +Failure:- +Finish the task by updating the status to Finish and business status to EXECUTE_WORKFLOW_FINISH, increment the retry count by 1 and also unlock the customer with redis fn call, then find the calculate job for the id, and update its the business status to CALCULATE_WORKFLOW_QUEUED and scheduled time to now() + 1 hr +Pending:- +Will call PSYNC, update the business status of calculate job to CALCULATE_WORKFLOW_PROCESSING + +PSYNC WORKFLOW +When the consumer picks up the psync task, here we have three possibilities:- +Success:- +Update the token with success status and also update calculate_workflow entry’s business_status to CALCULATE_WORKFLOW_COMPLETED and status to Finish. +Failure:- +Finish the task by updating the status to Finish and business status to EXECUTE_WORKFLOW_FINISH and also increment the retry count by 1, find the calculate job for the id, and update the business status to CALCULATE_WORKFLOW_QUEUED and scheduled time to now() + 1 hr +Pending:- +Will call PSYNC, update the business status of calculate job to CALCULATE_WORKFLOW_PROCESSING + +Screenshot 2025-08-13 at 16 42 06 + + +### Additional Changes + +- [ ] This PR modifies the API contract +- [ ] This PR modifies the database schema +- [ ] This PR modifies application configuration/environment variables + + + + +## Motivation and Context + + + +## How did you test it? + + +How to test invoice queuing and card switching: + + +Create a business profile - where the default revenue_recovery_algorithm_type would be Monitoring by default. (Need to update it to Cascading and Smart and test the flows. + +Create a Payment Processor (worldpayvantiv) + +```curl --location 'http://localhost:8080/v2/connector-accounts' \ +--header 'Content-Type: application/json' \ +--header 'Accept: application/json' \ +--header 'x-merchant-id: {{}}' \ +--header 'x-profile-id: {{}}' \ +--header 'Authorization: admin-api-key=test_admin' \ +--header 'api-key: {{}}' \ +--data ' +{ + "connector_type": "payment_processor", + "connector_name": "worldpayvantiv", + "connector_account_details": { + "auth_type": "SignatureKey", + "api_key": "u83996941026920501", + "key1": "010193081", + "api_secret": "qRfXV7aPcvkX6Fr" + }, + "payment_methods_enabled": [ + { + "payment_method_type": "card", + "payment_method_subtypes": [ + { + "payment_method_subtype": "credit", + "payment_experience": null, + "card_networks": [ + "Visa", + "Mastercard" + ], + "accepted_currencies": null, + "accepted_countries": null, + "minimum_amount": -1, + "maximum_amount": 68607706, + "recurring_enabled": true, + "installment_payment_enabled": true + }, + { + "payment_method_subtype": "debit", + "payment_experience": null, + "card_networks": [ + "Visa", + "Mastercard" + ], + "accepted_currencies": null, + "accepted_countries": null, + "minimum_amount": -1, + "maximum_amount": 68607706, + "recurring_enabled": true, + "installment_payment_enabled": true + } + ] + } + ], + "frm_configs": null, + "connector_webhook_details": { + "merchant_secret": "" + }, + "metadata": { + "report_group": "Hello", + "merchant_config_currency": "USD" + }, + "profile_id": "pro_6BnIGqGPytQ3vwObbAw6" +}' +``` + +Create Billing Processor for custom billing + +```curl --location 'http://localhost:8080/v2/connector-accounts' \ +--header 'Content-Type: application/json' \ +--header 'Accept: application/json' \ +--header 'x-merchant-id: {{}}' \ +--header 'x-profile-id: {{}}' \ +--header 'Authorization: admin-api-key=test_admin' \ +--header 'api-key: {{}}' \ +--data '{ + "connector_type": "billing_processor", + "connector_name": "custombilling", + "connector_account_details": { + "auth_type": "NoKey" + }, + "feature_metadata" : { + "revenue_recovery" : { + "max_retry_count" : 9, + "billing_connector_retry_threshold" : 0, + "billing_account_reference" :{ + "{{connector_mca_id}}" : "{{connector_mca_id}}" + }, + "switch_payment_method_config" : { + "retry_threshold" : 0, + "time_threshold_after_creation": 0 + } + } + }, + "profile_id": "pro_6BnIGqGPytQ3vwObbAw6" +}' + +``` + + +Use the payment/recovery api + +```curl --location 'http://localhost:8080/v2/payments/recovery' \ +--header 'Authorization: api-key=dev_qHo39mf1hdLbY7GW7FOr89FaoCM1NQOdwPddWguUDI3RnsjQKPzG71uZIkuULDQu' \ +--header 'x-profile-id: pro_xsbw9tuM9f6whrwaZKC2' \ +--header 'x-merchant-id: cloth_seller_2px3Q1TUxtGOvO3Yzm0S' \ +--header 'Content-Type: application/json' \ +--header 'api-key: dev_qHo39mf1hdLbY7GW7FOr89FaoCM1NQOdwPddWguUDI3RnsjQKPzG71uZIkuULDQu' \ +--data '{ + "amount_details": { + "order_amount": 2250, + "currency": "USD" + }, + "merchant_reference_id": "1234567891", + "connector_transaction_id": "43255654", + "connector_customer_id": "526755", + "error": { + "code": "110", + "message": "Insufficient Funds" + }, + "billing": { + "address": { + "state": "CA", + "country": "US" + } + }, + "payment_method_type": "card", + "payment_method_sub_type": "credit", + "payment_method_data": { + "primary_processor_payment_method_token": "2541911049890008", + "additional_payment_method_info": { + "card_exp_month": "12", + "card_exp_year": "25", + "last_four_digits": 1997, + "card_network": "VISA", + "card_issuer": "Wells Fargo NA", + "card_type": "credit" + } + }, + "billing_started_at": "2024-05-29T08:10:58Z", + "transaction_created_at": "2024-05-29T08:10:58Z", + "attempt_status": "failure", + "action": "schedule_failed_payment", + "billing_merchant_connector_id": "mca_6y5xtQUL2tgnHbjS7Bai", + "payment_merchant_connector_id": "mca_OWLpnzoAxkhT1eZVJ3Q3" + }' +``` + +We need to hit recovery api curl multiple times by changing, here merchant reference is invoice_id : + "merchant_reference_id": "1234567891", + "connector_transaction_id": "43255654", + "connector_customer_id": "526755", + + +There should be entry in the process tracker only when the retries exceed the threshold. +In the given curl we have kept the retry threshold as 0. + +Redis will contain keys +Screenshot 2025-08-25 at 18 04 14 + + +Cascading + +When the profile is in CASCADING phase, the decider should not be called(gRPC call). +It should take the retry date from config and schedule accordingly. + +Process Tracker entry (Calculate Job) : +Screenshot 2025-08-25 at 18 05 02 + + +Process Tracker (Execute Job) : + +Screenshot 2025-08-25 at 18 05 35 + + +At the scheduled time proxy api is called. +Screenshot 2025-08-25 at 18 06 11 + + +After which if payment is successful- Psync flow triggered +Screenshot 2025-08-25 at 18 07 52 + + +And end with business_status as global failure on succeeded status in psync call. + + +Smart + +When the profile is in SMART phase, the decider should be called(gRPC call). + +Process Tracker entry (Calculate Job) : +Screenshot 2025-08-25 at 18 08 18 + +Process Tracker (Execute Job) : +Screenshot 2025-08-25 at 18 08 40 +Process Tracker status after Proxy call + +Process Tracker (Execute Job) : +Screenshot 2025-08-25 at 18 10 07 + +Process Tracker (Psync Flow ) + +Screenshot 2025-08-25 at 18 10 34 + + +In psync job, if we get a response as failed from connector +The calculate job is reopened . + + +## Checklist + + +- [x] I formatted the code `cargo +nightly fmt --all` +- [x] I addressed lints thrown by `cargo clippy` +- [x] I reviewed the submitted code +- [ ] I added unit tests for my changes where possible +COMMENTS: +- semanticdiff-com[bot]: Review changes with  SemanticDiff +
+Changed Files +
+ +| File | Status | +| :--- | :--- | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8848/changes#crates/router/src/core/webhooks/recovery_incoming.rs)  [crates/router/src/core/webhooks/recovery\_incoming\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8848/changes#crates/router/src/core/webhooks/recovery_incoming.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8848/changes#crates/router/src/core/webhooks/recovery_incoming.rs)  71% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8848/changes#crates/router/src/core/revenue_recovery/types.rs)  [crates/router/src/core/revenue\_recovery/types\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8848/changes#crates/router/src/core/revenue_recovery/types.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8848/changes#crates/router/src/core/revenue_recovery/types.rs)  28% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8848/changes#crates/router/src/types/storage/revenue_recovery.rs)  [crates/router/src/types/storage/revenue\_recovery\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8848/changes#crates/router/src/types/storage/revenue_recovery.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8848/changes#crates/router/src/types/storage/revenue_recovery.rs)  2% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8848/changes#crates/router/src/core/revenue_recovery.rs)  [crates/router/src/core/revenue\_recovery\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8848/changes#crates/router/src/core/revenue_recovery.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8848/changes#crates/router/src/core/revenue_recovery.rs)  1% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8848/changes#crates/diesel_models/src/process_tracker.rs)  [crates/diesel\_models/src/process\_tracker\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8848/changes#crates/diesel_models/src/process_tracker.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8848/changes#crates/diesel_models/src/process_tracker.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8848/changes#crates/hyperswitch_domain_models/src/payments.rs)  [crates/hyperswitch\_domain\_models/src/payments\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8848/changes#crates/hyperswitch_domain_models/src/payments.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8848/changes#crates/hyperswitch_domain_models/src/payments.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8848/changes#crates/router/src/core/errors.rs)  [crates/router/src/core/errors\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8848/changes#crates/router/src/core/errors.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8848/changes#crates/router/src/core/errors.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8848/changes#crates/router/src/workflows/revenue_recovery.rs)  [crates/router/src/workflows/revenue\_recovery\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8848/changes#crates/router/src/workflows/revenue_recovery.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8848/changes#crates/router/src/workflows/revenue_recovery.rs)  0% smaller | + +
+- srujanchikke [crates/router/src/core/revenue_recovery.rs:342]: Are we updating invoice_scheduled_time in calculate_workflow ? +- srujanchikke [crates/router/src/core/revenue_recovery.rs:331]: Can you log this error ? + +- srujanchikke [crates/router/src/core/revenue_recovery.rs:364]: Why is this None ? also update the tracking data +- srujanchikke [crates/router/src/core/revenue_recovery.rs:420]: This needs to be updated with customer_token schedule time . +- srujanchikke [crates/router/src/core/revenue_recovery.rs:450]: Can this be implemented against PaymentIntent +- srujanchikke [crates/router/src/core/revenue_recovery.rs:667]: Can we delete exisitng execute pcr task ? + +- Aprabhat19 [config/deployments/production.toml:856]: Can you change the naming to `max_retry_count_for_thirty_day` +- Aprabhat19 [crates/diesel_models/src/process_tracker.rs:259]: this is ambiguous , also can you provide appropriate comments +- Aprabhat19 [crates/diesel_models/src/process_tracker.rs:291]: Can you improve the comments in on all of the values +- Aprabhat19 [crates/router/src/core/revenue_recovery.rs:82]: Can you add the active token data in the revenue_recovery_payment_data and pass it along instead of having it as a separate variable +- Aprabhat19 [crates/router/src/core/revenue_recovery.rs:226]: Why are we making this optional, if you are creating a psync task make sure this is mandatory +- Aprabhat19 [crates/router/src/core/revenue_recovery.rs:418]: If need be we can create a nw tracking data for calculate workflow +- Aprabhat19 [crates/router/src/core/revenue_recovery.rs:374]: Why are you updating the calculate process mark it as finished and restart the execute workflow before this and not after +- Aprabhat19 [crates/router/src/core/revenue_recovery.rs:488]: Do not call insert task directly search for the current execute being present or not first if it is there update that process else insert +- Aprabhat19 [crates/router/src/core/revenue_recovery.rs:488]: And like I said do it before finishing calculate job +- Aprabhat19 [crates/router/src/core/revenue_recovery.rs:420]: Update the tracking data wit the previous values, why are we populating it as None +- Aprabhat19 [crates/router/src/core/revenue_recovery.rs:422]: You can move the status to Pending , new specifies only the new initial jobs +- Aprabhat19 [crates/router/src/core/revenue_recovery.rs:667]: Why delete why can we not reuse that +- Aprabhat19 [crates/router/src/core/revenue_recovery.rs:450]: Also Can you mention connector_customer_id to avoid confusion? +- Aprabhat19 [crates/router/src/core/webhooks/recovery_incoming.rs:319]: Can you please check this the commented line and the implementation are quite different + +=== COMMIT === +SUBJECT: feat(revenue_recovery): Introducing new calculate job for card switching and invoice queueing (#8848) +BODY: +Co-authored-by: Aniket Burman +Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> +Co-authored-by: Aniket Burman <93077964+aniketburman014@users.noreply.github.com> +Co-authored-by: chikke srujan <121822803+srujanchikke@users.noreply.github.com> + +=== FILES === +Summary: 8 files changed, +1148 -121 +- crates/diesel_models/src/process_tracker.rs (+20 -0) +- crates/hyperswitch_domain_models/src/payments.rs (+20 -0) +- crates/router/src/core/errors.rs (+2 -0) +- crates/router/src/core/revenue_recovery.rs (+539 -3) +- crates/router/src/core/revenue_recovery/types.rs (+527 -106) +- crates/router/src/core/webhooks/recovery_incoming.rs (+21 -10) +- crates/router/src/types/storage/revenue_recovery.rs (+2 -1) +- crates/router/src/workflows/revenue_recovery.rs (+17 -1) + +=== PATCH === +diff --git a/crates/diesel_models/src/process_tracker.rs b/crates/diesel_models/src/process_tracker.rs +index 3aefb486..962f9177 100644 +--- a/crates/diesel_models/src/process_tracker.rs ++++ b/crates/diesel_models/src/process_tracker.rs +@@ -255,6 +255,9 @@ pub mod business_status { + /// This status indicates the completion of a execute task + pub const EXECUTE_WORKFLOW_COMPLETE: &str = "COMPLETED_EXECUTE_TASK"; + ++ /// This status indicates the failure of a execute task ++ pub const EXECUTE_WORKFLOW_FAILURE: &str = "FAILED_EXECUTE_TASK"; ++ + /// This status indicates that the execute task was completed to trigger the psync task + pub const EXECUTE_WORKFLOW_COMPLETE_FOR_PSYNC: &str = "COMPLETED_EXECUTE_TASK_TO_TRIGGER_PSYNC"; + +@@ -276,4 +279,21 @@ pub mod business_status { + + /// This status indicates the completion of a review task + pub const REVIEW_WORKFLOW_COMPLETE: &str = "COMPLETED_REVIEW_TASK"; ++ ++ /// For the CALCULATE_WORKFLOW ++ /// ++ /// This status indicates an invoice is queued ++ pub const CALCULATE_WORKFLOW_QUEUED: &str = "CALCULATE_WORKFLOW_QUEUED"; ++ ++ /// This status indicates an invoice has been declined due to hard decline ++ pub const CALCULATE_WORKFLOW_FINISH: &str = "FAILED_DUE_TO_HARD_DECLINE_ERROR"; ++ ++ /// This status indicates that the invoice is scheduled with the best available token ++ pub const CALCULATE_WORKFLOW_SCHEDULED: &str = "CALCULATE_WORKFLOW_SCHEDULED"; ++ ++ /// This status indicates the invoice is in payment sync state ++ pub const CALCULATE_WORKFLOW_PROCESSING: &str = "CALCULATE_WORKFLOW_PROCESSING"; ++ ++ /// This status indicates the workflow has completed successfully when the invoice is paid ++ pub const CALCULATE_WORKFLOW_COMPLETE: &str = "CALCULATE_WORKFLOW_COMPLETE"; + } +diff --git a/crates/hyperswitch_domain_models/src/payments.rs b/crates/hyperswitch_domain_models/src/payments.rs +index 0a63c036..1a8224b8 100644 +--- a/crates/hyperswitch_domain_models/src/payments.rs ++++ b/crates/hyperswitch_domain_models/src/payments.rs +@@ -518,6 +518,26 @@ pub struct PaymentIntent { + + #[cfg(feature = "v2")] + impl PaymentIntent { ++ /// Extract customer_id from payment intent feature metadata ++ pub fn extract_connector_customer_id_from_payment_intent( ++ &self, ++ ) -> Result { ++ self.feature_metadata ++ .as_ref() ++ .and_then(|metadata| metadata.payment_revenue_recovery_metadata.as_ref()) ++ .map(|recovery| { ++ recovery ++ .billing_connector_payment_details ++ .connector_customer_id ++ .clone() ++ }) ++ .ok_or( ++ common_utils::errors::ValidationError::MissingRequiredField { ++ field_name: "connector_customer_id".to_string(), ++ }, ++ ) ++ } ++ + fn get_payment_method_sub_type(&self) -> Option { + self.feature_metadata + .as_ref() +diff --git a/crates/router/src/core/errors.rs b/crates/router/src/core/errors.rs +index bc8397b4..bf5330a9 100644 +--- a/crates/router/src/core/errors.rs ++++ b/crates/router/src/core/errors.rs +@@ -486,6 +486,8 @@ pub enum RevenueRecoveryError { + BillingConnectorPaymentsSyncFailed, + #[error("Billing connector invoice sync call failed")] + BillingConnectorInvoiceSyncFailed, ++ #[error("Failed to fetch connector customer ID")] ++ CustomerIdNotFound, + #[error("Failed to get the retry count for payment intent")] + RetryCountFetchFailed, + #[error("Failed to get the billing threshold retry count")] +diff --git a/crates/router/src/core/revenue_recovery.rs b/crates/router/src/core/revenue_recovery.rs +index 235d57f9..a2a90f1e 100644 +--- a/crates/router/src/core/revenue_recovery.rs ++++ b/crates/router/src/core/revenue_recovery.rs +@@ -1,35 +1,154 @@ + pub mod api; + pub mod transformers; + pub mod types; +-use api_models::{enums, process_tracker::revenue_recovery}; ++use api_models::{enums, process_tracker::revenue_recovery, webhooks}; + use common_utils::{ + self, ++ errors::CustomResult, + ext_traits::{OptionExt, ValueExt}, + id_type, + }; + use diesel_models::{enums as diesel_enum, process_tracker::business_status}; + use error_stack::{self, ResultExt}; +-use hyperswitch_domain_models::{payments::PaymentIntent, ApiModelToDieselModelConvertor}; ++use hyperswitch_domain_models::{ ++ payments::PaymentIntent, revenue_recovery as domain_revenue_recovery, ++ ApiModelToDieselModelConvertor, ++}; + use scheduler::errors as sch_errors; + + use crate::{ + core::errors::{self, RouterResponse, RouterResult, StorageErrorExt}, + db::StorageInterface, + logger, +- routes::{metrics, SessionState}, ++ routes::{app::ReqState, metrics, SessionState}, + services::ApplicationResponse, + types::{ ++ domain, + storage::{self, revenue_recovery as pcr}, + transformers::ForeignInto, + }, ++ workflows, + }; + + pub const EXECUTE_WORKFLOW: &str = "EXECUTE_WORKFLOW"; + pub const PSYNC_WORKFLOW: &str = "PSYNC_WORKFLOW"; ++pub const CALCULATE_WORKFLOW: &str = "CALCULATE_WORKFLOW"; ++ ++#[allow(clippy::too_many_arguments)] ++pub async fn upsert_calculate_pcr_task( ++ billing_connector_account: &domain::MerchantConnectorAccount, ++ state: &SessionState, ++ merchant_context: &domain::MerchantContext, ++ recovery_intent_from_payment_intent: &domain_revenue_recovery::RecoveryPaymentIntent, ++ business_profile: &domain::Profile, ++ intent_retry_count: u16, ++ payment_attempt_id: Option, ++ runner: storage::ProcessTrackerRunner, ++ revenue_recovery_retry: diesel_enum::RevenueRecoveryAlgorithmType, ++) -> CustomResult { ++ router_env::logger::info!("Starting calculate_job..."); ++ ++ let task = "CALCULATE_WORKFLOW"; ++ ++ let db = &*state.store; ++ let payment_id = &recovery_intent_from_payment_intent.payment_id; ++ ++ // Create process tracker ID in the format: CALCULATE_WORKFLOW_{payment_intent_id} ++ let process_tracker_id = format!("{runner}_{task}_{}", payment_id.get_string_repr()); ++ ++ // Set scheduled time to 1 hour from now ++ let schedule_time = common_utils::date_time::now() + time::Duration::hours(1); ++ ++ let payment_attempt_id = payment_attempt_id ++ .ok_or(error_stack::report!( ++ errors::RevenueRecoveryError::PaymentAttemptIdNotFound ++ )) ++ .attach_printable("payment attempt id is required for calculate workflow tracking")?; ++ ++ // Check if a process tracker entry already exists for this payment intent ++ let existing_entry = db ++ .as_scheduler() ++ .find_process_by_id(&process_tracker_id) ++ .await ++ .change_context(errors::RevenueRecoveryError::ProcessTrackerResponseError) ++ .attach_printable( ++ "Failed to check for existing calculate workflow process tracker entry", ++ )?; ++ ++ match existing_entry { ++ Some(existing_process) => { ++ router_env::logger::error!( ++ "Found existing CALCULATE_WORKFLOW task with id: {}", ++ existing_process.id ++ ); ++ } ++ None => { ++ // No entry exists - create a new one ++ router_env::logger::info!( ++ "No existing CALCULATE_WORKFLOW task found for payment_intent_id: {}, creating new entry scheduled for 1 hour from now", ++ payment_id.get_string_repr() ++ ); ++ ++ // Create tracking data ++ let calculate_workflow_tracking_data = pcr::RevenueRecoveryWorkflowTrackingData { ++ billing_mca_id: billing_connector_account.get_id(), ++ global_payment_id: payment_id.clone(), ++ merchant_id: merchant_context.get_merchant_account().get_id().to_owned(), ++ profile_id: business_profile.get_id().to_owned(), ++ payment_attempt_id, ++ revenue_recovery_retry, ++ invoice_scheduled_time: None, ++ }; ++ ++ let tag = ["PCR"]; ++ let task = "CALCULATE_WORKFLOW"; ++ let runner = storage::ProcessTrackerRunner::PassiveRecoveryWorkflow; ++ ++ let process_tracker_entry = storage::ProcessTrackerNew::new( ++ process_tracker_id, ++ task, ++ runner, ++ tag, ++ calculate_workflow_tracking_data, ++ Some(1), ++ schedule_time, ++ common_types::consts::API_VERSION, ++ ) ++ .change_context(errors::RevenueRecoveryError::ProcessTrackerCreationError) ++ .attach_printable("Failed to construct calculate workflow process tracker entry")?; ++ ++ // Insert into process tracker with status New ++ db.as_scheduler() ++ .insert_process(process_tracker_entry) ++ .await ++ .change_context(errors::RevenueRecoveryError::ProcessTrackerResponseError) ++ .attach_printable( ++ "Failed to enter calculate workflow process_tracker_entry in DB", ++ )?; ++ ++ router_env::logger::info!( ++ "Successfully created new CALCULATE_WORKFLOW task for payment_intent_id: {}", ++ payment_id.get_string_repr() ++ ); ++ ++ metrics::TASKS_ADDED_COUNT.add( ++ 1, ++ router_env::metric_attributes!(("flow", "CalculateWorkflow")), ++ ); ++ } ++ } ++ ++ Ok(webhooks::WebhookResponseTracker::Payment { ++ payment_id: payment_id.clone(), ++ status: recovery_intent_from_payment_intent.status, ++ }) ++} + + pub async fn perform_execute_payment( + state: &SessionState, + execute_task_process: &storage::ProcessTracker, ++ profile: &domain::Profile, ++ merchant_context: domain::MerchantContext, + tracking_data: &pcr::RevenueRecoveryWorkflowTrackingData, + revenue_recovery_payment_data: &pcr::RevenueRecoveryPaymentData, + payment_intent: &PaymentIntent, +@@ -74,6 +193,8 @@ pub async fn perform_execute_payment( + revenue_recovery_payment_data.merchant_account.get_id(), + payment_intent, + execute_task_process, ++ profile, ++ merchant_context, + revenue_recovery_payment_data, + &revenue_recovery_metadata, + )) +@@ -218,6 +339,7 @@ async fn insert_psync_pcr_task_to_pt( + profile_id, + payment_attempt_id, + revenue_recovery_retry, ++ invoice_scheduled_time: Some(schedule_time), + }; + let tag = ["REVENUE_RECOVERY"]; + let process_tracker_entry = storage::ProcessTrackerNew::new( +@@ -249,6 +371,8 @@ async fn insert_psync_pcr_task_to_pt( + pub async fn perform_payments_sync( + state: &SessionState, + process: &storage::ProcessTracker, ++ profile: &domain::Profile, ++ merchant_context: domain::MerchantContext, + tracking_data: &pcr::RevenueRecoveryWorkflowTrackingData, + revenue_recovery_payment_data: &pcr::RevenueRecoveryPaymentData, + payment_intent: &PaymentIntent, +@@ -274,6 +398,8 @@ pub async fn perform_payments_sync( + state, + payment_intent, + process.clone(), ++ profile, ++ merchant_context, + revenue_recovery_payment_data, + payment_attempt, + &mut revenue_recovery_metadata, +@@ -284,6 +410,416 @@ pub async fn perform_payments_sync( + Ok(()) + } + ++pub async fn perform_calculate_workflow( ++ state: &SessionState, ++ process: &storage::ProcessTracker, ++ profile: &domain::Profile, ++ merchant_context: domain::MerchantContext, ++ tracking_data: &pcr::RevenueRecoveryWorkflowTrackingData, ++ revenue_recovery_payment_data: &pcr::RevenueRecoveryPaymentData, ++ payment_intent: &PaymentIntent, ++) -> Result<(), sch_errors::ProcessTrackerError> { ++ let db = &*state.store; ++ let merchant_id = revenue_recovery_payment_data.merchant_account.get_id(); ++ let profile_id = revenue_recovery_payment_data.profile.get_id(); ++ let billing_mca_id = revenue_recovery_payment_data.billing_mca.get_id(); ++ ++ logger::info!( ++ process_id = %process.id, ++ payment_id = %tracking_data.global_payment_id.get_string_repr(), ++ "Starting CALCULATE_WORKFLOW..." ++ ); ++ ++ // 1. Extract connector_customer_id and token_list from tracking_data ++ let connector_customer_id = payment_intent ++ .extract_connector_customer_id_from_payment_intent() ++ .change_context(errors::RecoveryError::ValueNotFound) ++ .attach_printable("Failed to extract customer ID from payment intent")?; ++ ++ let merchant_context_from_revenue_recovery_payment_data = ++ domain::MerchantContext::NormalMerchant(Box::new(domain::Context( ++ revenue_recovery_payment_data.merchant_account.clone(), ++ revenue_recovery_payment_data.key_store.clone(), ++ ))); ++ ++ let retry_algorithm_type = match profile ++ .revenue_recovery_retry_algorithm_type ++ .filter(|retry_type| ++ *retry_type != common_enums::RevenueRecoveryAlgorithmType::Monitoring) // ignore Monitoring in profile ++ .unwrap_or(tracking_data.revenue_recovery_retry) // fallback to tracking_data ++ { ++ common_enums::RevenueRecoveryAlgorithmType::Smart => common_enums::RevenueRecoveryAlgorithmType::Smart, ++ common_enums::RevenueRecoveryAlgorithmType::Cascading => common_enums::RevenueRecoveryAlgorithmType::Cascading, ++ common_enums::RevenueRecoveryAlgorithmType::Monitoring => { ++ return Err(sch_errors::ProcessTrackerError::ProcessUpdateFailed); ++ } ++ }; ++ ++ // 2. Get best available token ++ let best_time_to_schedule = match workflows::revenue_recovery::get_token_with_schedule_time_based_on_retry_alogrithm_type( ++ state, ++ &connector_customer_id, ++ payment_intent, ++ retry_algorithm_type, ++ process.retry_count, ++ ) ++ .await ++ { ++ Ok(token_opt) => token_opt, ++ Err(e) => { ++ logger::error!( ++ error = ?e, ++ connector_customer_id = %connector_customer_id, ++ "Failed to get best PSP token" ++ ); ++ None ++ } ++ }; ++ ++ match best_time_to_schedule { ++ Some(scheduled_time) => { ++ logger::info!( ++ process_id = %process.id, ++ connector_customer_id = %connector_customer_id, ++ "Found best available token, creating EXECUTE_WORKFLOW task" ++ ); ++ ++ // 3. If token found: create EXECUTE_WORKFLOW task and finish CALCULATE_WORKFLOW ++ insert_execute_pcr_task_to_pt( ++ &tracking_data.billing_mca_id, ++ state, ++ &tracking_data.merchant_id, ++ payment_intent, ++ &tracking_data.profile_id, ++ &tracking_data.payment_attempt_id, ++ storage::ProcessTrackerRunner::PassiveRecoveryWorkflow, ++ tracking_data.revenue_recovery_retry, ++ scheduled_time, ++ ) ++ .await?; ++ ++ db.as_scheduler() ++ .finish_process_with_business_status( ++ process.clone(), ++ business_status::CALCULATE_WORKFLOW_SCHEDULED, ++ ) ++ .await ++ .map_err(|e| { ++ logger::error!( ++ process_id = %process.id, ++ error = ?e, ++ "Failed to update CALCULATE_WORKFLOW status to complete" ++ ); ++ sch_errors::ProcessTrackerError::ProcessUpdateFailed ++ })?; ++ ++ logger::info!( ++ process_id = %process.id, ++ connector_customer_id = %connector_customer_id, ++ "CALCULATE_WORKFLOW completed successfully" ++ ); ++ } ++ ++ None => { ++ let scheduled_token = match storage::revenue_recovery_redis_operation:: ++ RedisTokenManager::get_payment_processor_token_with_schedule_time(state, &connector_customer_id) ++ .await { ++ Ok(scheduled_token_opt) => scheduled_token_opt, ++ Err(e) => { ++ logger::error!( ++ error = ?e, ++ connector_customer_id = %connector_customer_id, ++ "Failed to get PSP token status" ++ ); ++ None ++ } ++ }; ++ ++ match scheduled_token { ++ Some(scheduled_token) => { ++ // Update scheduled time to scheduled time + 15 minutes ++ // here scheduled_time is the wait time 15 minutes is a buffer time that we are adding ++ logger::info!( ++ process_id = %process.id, ++ connector_customer_id = %connector_customer_id, ++ "No token but time available, rescheduling for scheduled time + 15 mins" ++ ); ++ ++ update_calculate_job_schedule_time( ++ db, ++ process, ++ time::Duration::minutes(15), ++ scheduled_token.scheduled_at, ++ &connector_customer_id, ++ ) ++ .await?; ++ } ++ None => { ++ let hard_decline_flag = storage::revenue_recovery_redis_operation:: ++ RedisTokenManager::are_all_tokens_hard_declined( ++ state, ++ &connector_customer_id ++ ) ++ .await ++ .ok() ++ .unwrap_or(false); ++ ++ match hard_decline_flag { ++ false => { ++ logger::info!( ++ process_id = %process.id, ++ connector_customer_id = %connector_customer_id, ++ "Hard decline flag is false, rescheduling for scheduled time + 15 mins" ++ ); ++ ++ update_calculate_job_schedule_time( ++ db, ++ process, ++ time::Duration::minutes(15), ++ Some(common_utils::date_time::now()), ++ &connector_customer_id, ++ ) ++ .await?; ++ } ++ true => { ++ // Finish calculate workflow with CALCULATE_WORKFLOW_FINISH ++ logger::info!( ++ process_id = %process.id, ++ connector_customer_id = %connector_customer_id, ++ "No token available, finishing CALCULATE_WORKFLOW" ++ ); ++ ++ db.as_scheduler() ++ .finish_process_with_business_status( ++ process.clone(), ++ business_status::CALCULATE_WORKFLOW_FINISH, ++ ) ++ .await ++ .map_err(|e| { ++ logger::error!( ++ process_id = %process.id, ++ error = ?e, ++ "Failed to finish CALCULATE_WORKFLOW" ++ ); ++ sch_errors::ProcessTrackerError::ProcessUpdateFailed ++ })?; ++ ++ logger::info!( ++ process_id = %process.id, ++ connector_customer_id = %connector_customer_id, ++ "CALCULATE_WORKFLOW finished successfully" ++ ); ++ } ++ } ++ } ++ } ++ } ++ } ++ Ok(()) ++} ++ ++/// Update the schedule time for a CALCULATE_WORKFLOW process tracker ++async fn update_calculate_job_schedule_time( ++ db: &dyn StorageInterface, ++ process: &storage::ProcessTracker, ++ additional_time: time::Duration, ++ base_time: Option, ++ connector_customer_id: &str, ++) -> Result<(), sch_errors::ProcessTrackerError> { ++ let new_schedule_time = ++ base_time.unwrap_or_else(common_utils::date_time::now) + additional_time; ++ ++ let pt_update = storage::ProcessTrackerUpdate::Update { ++ name: Some("CALCULATE_WORKFLOW".to_string()), ++ retry_count: Some(process.clone().retry_count), ++ schedule_time: Some(new_schedule_time), ++ tracking_data: Some(process.clone().tracking_data), ++ business_status: Some(String::from(business_status::PENDING)), ++ status: Some(common_enums::ProcessTrackerStatus::Pending), ++ updated_at: Some(common_utils::date_time::now()), ++ }; ++ ++ db.as_scheduler() ++ .update_process(process.clone(), pt_update) ++ .await ++ .map_err(|e| { ++ logger::error!( ++ process_id = %process.id, ++ error = ?e, ++ "Failed to reschedule CALCULATE_WORKFLOW" ++ ); ++ sch_errors::ProcessTrackerError::ProcessUpdateFailed ++ })?; ++ ++ logger::info!( ++ process_id = %process.id, ++ connector_customer_id = %connector_customer_id, ++ new_schedule_time = %new_schedule_time, ++ additional_time = ?additional_time, ++ "CALCULATE_WORKFLOW rescheduled successfully" ++ ); ++ ++ Ok(()) ++} ++ ++/// Insert Execute PCR Task to Process Tracker ++#[allow(clippy::too_many_arguments)] ++async fn insert_execute_pcr_task_to_pt( ++ billing_mca_id: &id_type::MerchantConnectorAccountId, ++ state: &SessionState, ++ merchant_id: &id_type::MerchantId, ++ payment_intent: &PaymentIntent, ++ profile_id: &id_type::ProfileId, ++ payment_attempt_id: &id_type::GlobalAttemptId, ++ runner: storage::ProcessTrackerRunner, ++ revenue_recovery_retry: diesel_enum::RevenueRecoveryAlgorithmType, ++ schedule_time: time::PrimitiveDateTime, ++) -> Result { ++ let task = "EXECUTE_WORKFLOW"; ++ ++ let payment_id = payment_intent.id.clone(); ++ ++ let process_tracker_id = format!("{runner}_{task}_{}", payment_id.get_string_repr()); ++ ++ // Check if a process tracker entry already exists for this payment intent ++ let existing_entry = state ++ .store ++ .find_process_by_id(&process_tracker_id) ++ .await ++ .map_err(|e| { ++ logger::error!( ++ payment_id = %payment_id.get_string_repr(), ++ process_tracker_id = %process_tracker_id, ++ error = ?e, ++ "Failed to check for existing execute workflow process tracker entry" ++ ); ++ sch_errors::ProcessTrackerError::ProcessUpdateFailed ++ })?; ++ ++ match existing_entry { ++ Some(existing_process) ++ if existing_process.business_status == business_status::EXECUTE_WORKFLOW_FAILURE ++ || existing_process.business_status ++ == business_status::EXECUTE_WORKFLOW_COMPLETE_FOR_PSYNC => ++ { ++ // Entry exists with EXECUTE_WORKFLOW_COMPLETE status - update it ++ logger::info!( ++ payment_id = %payment_id.get_string_repr(), ++ process_tracker_id = %process_tracker_id, ++ current_retry_count = %existing_process.retry_count, ++ "Found existing EXECUTE_WORKFLOW task with COMPLETE status, updating to PENDING with incremented retry count" ++ ); ++ ++ let pt_update = storage::ProcessTrackerUpdate::Update { ++ name: Some(task.to_string()), ++ retry_count: Some(existing_process.clone().retry_count + 1), ++ schedule_time: Some(schedule_time), ++ tracking_data: Some(existing_process.clone().tracking_data), ++ business_status: Some(String::from(business_status::PENDING)), ++ status: Some(enums::ProcessTrackerStatus::Pending), ++ updated_at: Some(common_utils::date_time::now()), ++ }; ++ ++ let updated_process = state ++ .store ++ .update_process(existing_process, pt_update) ++ .await ++ .map_err(|e| { ++ logger::error!( ++ payment_id = %payment_id.get_string_repr(), ++ process_tracker_id = %process_tracker_id, ++ error = ?e, ++ "Failed to update existing execute workflow process tracker entry" ++ ); ++ sch_errors::ProcessTrackerError::ProcessUpdateFailed ++ })?; ++ ++ logger::info!( ++ payment_id = %payment_id.get_string_repr(), ++ process_tracker_id = %process_tracker_id, ++ new_retry_count = %updated_process.retry_count, ++ "Successfully updated existing EXECUTE_WORKFLOW task" ++ ); ++ ++ Ok(updated_process) ++ } ++ Some(existing_process) => { ++ // Entry exists but business status is not EXECUTE_WORKFLOW_COMPLETE ++ logger::info!( ++ payment_id = %payment_id.get_string_repr(), ++ process_tracker_id = %process_tracker_id, ++ current_business_status = %existing_process.business_status, ++ ); ++ ++ Ok(existing_process) ++ } ++ None => { ++ // No entry exists - create a new one ++ logger::info!( ++ payment_id = %payment_id.get_string_repr(), ++ process_tracker_id = %process_tracker_id, ++ "No existing EXECUTE_WORKFLOW task found, creating new entry" ++ ); ++ ++ let execute_workflow_tracking_data = pcr::RevenueRecoveryWorkflowTrackingData { ++ billing_mca_id: billing_mca_id.clone(), ++ global_payment_id: payment_id.clone(), ++ merchant_id: merchant_id.clone(), ++ profile_id: profile_id.clone(), ++ payment_attempt_id: payment_attempt_id.clone(), ++ revenue_recovery_retry, ++ invoice_scheduled_time: Some(schedule_time), ++ }; ++ ++ let tag = ["PCR"]; ++ let process_tracker_entry = storage::ProcessTrackerNew::new( ++ process_tracker_id.clone(), ++ task, ++ runner, ++ tag, ++ execute_workflow_tracking_data, ++ Some(1), ++ schedule_time, ++ common_types::consts::API_VERSION, ++ ) ++ .map_err(|e| { ++ logger::error!( ++ payment_id = %payment_id.get_string_repr(), ++ error = ?e, ++ "Failed to construct execute workflow process tracker entry" ++ ); ++ sch_errors::ProcessTrackerError::ProcessUpdateFailed ++ })?; ++ ++ let response = state ++ .store ++ .insert_process(process_tracker_entry) ++ .await ++ .map_err(|e| { ++ logger::error!( ++ payment_id = %payment_id.get_string_repr(), ++ error = ?e, ++ "Failed to insert execute workflow process tracker entry" ++ ); ++ sch_errors::ProcessTrackerError::ProcessUpdateFailed ++ })?; ++ ++ metrics::TASKS_ADDED_COUNT.add( ++ 1, ++ router_env::metric_attributes!(("flow", "RevenueRecoveryExecute")), ++ ); ++ ++ logger::info!( ++ payment_id = %payment_id.get_string_repr(), ++ process_tracker_id = %response.id, ++ "Successfully created new EXECUTE_WORKFLOW task" ++ ); ++ ++ Ok(response) ++ } ++ } ++} ++ + pub async fn retrieve_revenue_recovery_process_tracker( + state: SessionState, + id: id_type::GlobalPaymentId, +diff --git a/crates/router/src/core/revenue_recovery/types.rs b/crates/router/src/core/revenue_recovery/types.rs +index 1bccb513..e3401baa 100644 +--- a/crates/router/src/core/revenue_recovery/types.rs ++++ b/crates/router/src/core/revenue_recovery/types.rs +@@ -31,11 +31,12 @@ use hyperswitch_domain_models::{ + }; + use time::PrimitiveDateTime; + ++use super::errors::StorageErrorExt; + use crate::{ + core::{ + errors::{self, RouterResult}, + payments::{self, helpers, operations::Operation}, +- revenue_recovery::{self as revenue_recovery_core}, ++ revenue_recovery::{self as revenue_recovery_core, perform_calculate_workflow}, + webhooks::recovery_incoming as recovery_incoming_flow, + }, + db::StorageInterface, +@@ -43,9 +44,13 @@ use crate::{ + routes::SessionState, + services::{self, connector_integration_interface::RouterDataConversion}, + types::{ +- self, api as api_types, api::payments as payments_types, storage, transformers::ForeignInto, ++ self, api as api_types, api::payments as payments_types, domain, storage, ++ transformers::ForeignInto, ++ }, ++ workflows::{ ++ payment_sync, ++ revenue_recovery::{self, get_schedule_time_to_retry_mit_payments}, + }, +- workflows::{payment_sync, revenue_recovery::get_schedule_time_to_retry_mit_payments}, + }; + + type RecoveryResult = error_stack::Result; +@@ -93,15 +98,23 @@ impl RevenueRecoveryPaymentsAttemptStatus { + Ok(()) + } + ++ #[allow(clippy::too_many_arguments)] + pub(crate) async fn update_pt_status_based_on_attempt_status_for_payments_sync( + &self, + state: &SessionState, + payment_intent: &PaymentIntent, + process_tracker: storage::ProcessTracker, ++ profile: &domain::Profile, ++ merchant_context: domain::MerchantContext, + revenue_recovery_payment_data: &storage::revenue_recovery::RevenueRecoveryPaymentData, + payment_attempt: PaymentAttempt, + revenue_recovery_metadata: &mut PaymentRevenueRecoveryMetadata, + ) -> Result<(), errors::ProcessTrackerError> { ++ let connector_customer_id = payment_intent ++ .extract_connector_customer_id_from_payment_intent() ++ .change_context(errors::RecoveryError::ValueNotFound) ++ .attach_printable("Failed to extract customer ID from payment intent")?; ++ + let db = &*state.store; + + let recovery_payment_intent = +@@ -143,6 +156,26 @@ impl RevenueRecoveryPaymentsAttemptStatus { + ); + }; + ++ let is_hard_decline = revenue_recovery::check_hard_decline(state, &payment_attempt) ++ .await ++ .ok(); ++ ++ // update the status of token in redis ++ let _update_error_code = storage::revenue_recovery_redis_operation::RedisTokenManager::update_payment_processor_token_error_code_from_process_tracker( ++ state, ++ &connector_customer_id, ++ &None, ++ &is_hard_decline ++ ) ++ .await; ++ ++ // unlocking the token ++ let _unlock_the_connector_customer_id = storage::revenue_recovery_redis_operation::RedisTokenManager::unlock_connector_customer_status( ++ state, ++ &connector_customer_id, ++ ) ++ .await; ++ + // Record a successful transaction back to Billing Connector + // TODO: Add support for retrying failed outgoing recordback webhooks + record_back_to_billing_connector( +@@ -175,26 +208,38 @@ impl RevenueRecoveryPaymentsAttemptStatus { + ); + }; + +- // get a reschedule time +- let schedule_time = get_schedule_time_to_retry_mit_payments( +- db, +- &revenue_recovery_payment_data +- .merchant_account +- .get_id() +- .clone(), +- process_tracker.retry_count + 1, ++ let error_code = recovery_payment_attempt.error_code; ++ ++ let is_hard_decline = revenue_recovery::check_hard_decline(state, &payment_attempt) ++ .await ++ .ok(); ++ ++ // update the status of token in redis ++ let _update_error_code = storage::revenue_recovery_redis_operation::RedisTokenManager::update_payment_processor_token_error_code_from_process_tracker( ++ state, ++ &connector_customer_id, ++ &error_code, ++ &is_hard_decline + ) + .await; + +- // check if retry is possible +- if let Some(schedule_time) = schedule_time { +- // schedule a retry +- // TODO: Update connecter called field and active attempt ++ // unlocking the token ++ let _unlock_the_connector_customer_id = storage::revenue_recovery_redis_operation::RedisTokenManager::unlock_connector_customer_status( ++ state, ++ &connector_customer_id, ++ ) ++ .await; + +- db.as_scheduler() +- .retry_process(process_tracker.clone(), schedule_time) +- .await?; +- } ++ // Reopen calculate workflow on payment failure ++ reopen_calculate_workflow_on_payment_failure( ++ state, ++ &process_tracker, ++ profile, ++ merchant_context, ++ payment_intent, ++ revenue_recovery_payment_data, ++ ) ++ .await?; + } + Self::Processing => { + // do a psync payment +@@ -203,6 +248,8 @@ impl RevenueRecoveryPaymentsAttemptStatus { + revenue_recovery_payment_data, + payment_intent, + &process_tracker, ++ profile, ++ merchant_context, + payment_attempt, + )) + .await?; +@@ -307,105 +354,227 @@ pub enum Action { + ManualReviewAction, + } + impl Action { ++ #[allow(clippy::too_many_arguments)] + pub async fn execute_payment( + state: &SessionState, + merchant_id: &id_type::MerchantId, + payment_intent: &PaymentIntent, + process: &storage::ProcessTracker, ++ profile: &domain::Profile, ++ merchant_context: domain::MerchantContext, + revenue_recovery_payment_data: &storage::revenue_recovery::RevenueRecoveryPaymentData, + revenue_recovery_metadata: &PaymentRevenueRecoveryMetadata, + ) -> RecoveryResult { +- let response = revenue_recovery_core::api::call_proxy_api( +- state, +- payment_intent, +- revenue_recovery_payment_data, +- revenue_recovery_metadata, +- ) +- .await; +- let recovery_payment_intent = +- hyperswitch_domain_models::revenue_recovery::RecoveryPaymentIntent::from( +- payment_intent, +- ); ++ let connector_customer_id = payment_intent ++ .extract_connector_customer_id_from_payment_intent() ++ .change_context(errors::RecoveryError::ValueNotFound) ++ .attach_printable("Failed to extract customer ID from payment intent")?; + +- // handle proxy api's response +- match response { +- Ok(payment_data) => match payment_data.payment_attempt.status.foreign_into() { +- RevenueRecoveryPaymentsAttemptStatus::Succeeded => { +- let recovery_payment_attempt = +- hyperswitch_domain_models::revenue_recovery::RecoveryPaymentAttempt::from( +- &payment_data.payment_attempt, +- ); +- +- let recovery_payment_tuple = recovery_incoming_flow::RecoveryPaymentTuple::new( +- &recovery_payment_intent, +- &recovery_payment_attempt, +- ); ++ let scheduled_token = match storage::revenue_recovery_redis_operation:: ++ RedisTokenManager::get_payment_processor_token_with_schedule_time(state, &connector_customer_id) ++ .await { ++ Ok(scheduled_token_opt) => scheduled_token_opt, ++ Err(e) => { ++ logger::error!( ++ error = ?e, ++ connector_customer_id = %connector_customer_id, ++ "Failed to get PSP token status" ++ ); ++ None ++ } ++ }; + +- // publish events to kafka +- if let Err(e) = recovery_incoming_flow::RecoveryPaymentTuple::publish_revenue_recovery_event_to_kafka( ++ match scheduled_token { ++ Some(scheduled_token) => { ++ let response = revenue_recovery_core::api::call_proxy_api( + state, +- &recovery_payment_tuple, +- Some(process.retry_count+1) ++ payment_intent, ++ revenue_recovery_payment_data, ++ revenue_recovery_metadata, + ) +- .await{ +- router_env::logger::error!( +- "Failed to publish revenue recovery event to kafka: {:?}", +- e ++ .await; ++ ++ let recovery_payment_intent = ++ hyperswitch_domain_models::revenue_recovery::RecoveryPaymentIntent::from( ++ payment_intent, + ); +- }; + +- Ok(Self::SuccessfulPayment( +- payment_data.payment_attempt.clone(), +- )) ++ // handle proxy api's response ++ match response { ++ Ok(payment_data) => match payment_data.payment_attempt.status.foreign_into() { ++ RevenueRecoveryPaymentsAttemptStatus::Succeeded => { ++ let recovery_payment_attempt = ++ hyperswitch_domain_models::revenue_recovery::RecoveryPaymentAttempt::from( ++ &payment_data.payment_attempt, ++ ); ++ ++ let recovery_payment_tuple = ++ recovery_incoming_flow::RecoveryPaymentTuple::new( ++ &recovery_payment_intent, ++ &recovery_payment_attempt, ++ ); ++ ++ // publish events to kafka ++ if let Err(e) = recovery_incoming_flow::RecoveryPaymentTuple::publish_revenue_recovery_event_to_kafka( ++ state, ++ &recovery_payment_tuple, ++ Some(process.retry_count+1) ++ ) ++ .await{ ++ router_env::logger::error!( ++ "Failed to publish revenue recovery event to kafka: {:?}", ++ e ++ ); ++ }; ++ ++ let is_hard_decline = revenue_recovery::check_hard_decline( ++ state, ++ &payment_data.payment_attempt, ++ ) ++ .await ++ .ok(); ++ ++ // update the status of token in redis ++ let _update_error_code = storage::revenue_recovery_redis_operation::RedisTokenManager::update_payment_processor_token_error_code_from_process_tracker( ++ state, ++ &connector_customer_id, ++ &None, ++ &is_hard_decline ++ ) ++ .await; ++ ++ // unlocking the token ++ let _unlock_the_connector_customer_id = storage::revenue_recovery_redis_operation::RedisTokenManager::unlock_connector_customer_status( ++ state, ++ &connector_customer_id, ++ ) ++ .await; ++ ++ Ok(Self::SuccessfulPayment( ++ payment_data.payment_attempt.clone(), ++ )) ++ } ++ RevenueRecoveryPaymentsAttemptStatus::Failed => { ++ let recovery_payment_attempt = ++ hyperswitch_domain_models::revenue_recovery::RecoveryPaymentAttempt::from( ++ &payment_data.payment_attempt, ++ ); ++ ++ let recovery_payment_tuple = ++ recovery_incoming_flow::RecoveryPaymentTuple::new( ++ &recovery_payment_intent, ++ &recovery_payment_attempt, ++ ); ++ ++ // publish events to kafka ++ if let Err(e) = recovery_incoming_flow::RecoveryPaymentTuple::publish_revenue_recovery_event_to_kafka( ++ state, ++ &recovery_payment_tuple, ++ Some(process.retry_count+1) ++ ) ++ .await{ ++ router_env::logger::error!( ++ "Failed to publish revenue recovery event to kafka: {:?}", ++ e ++ ); ++ }; ++ ++ let error_code = payment_data ++ .payment_attempt ++ .clone() ++ .error ++ .map(|error| error.code); ++ ++ let is_hard_decline = revenue_recovery::check_hard_decline( ++ state, ++ &payment_data.payment_attempt, ++ ) ++ .await ++ .ok(); ++ ++ let _update_connector_customer_id = storage::revenue_recovery_redis_operation::RedisTokenManager::update_payment_processor_token_error_code_from_process_tracker( ++ state, ++ &connector_customer_id, ++ &error_code, ++ &is_hard_decline ++ ) ++ .await; ++ ++ // unlocking the token ++ let _unlock_connector_customer_id = storage::revenue_recovery_redis_operation::RedisTokenManager::unlock_connector_customer_status( ++ state, ++ &connector_customer_id, ++ ) ++ .await; ++ ++ // Reopen calculate workflow on payment failure ++ reopen_calculate_workflow_on_payment_failure( ++ state, ++ process, ++ profile, ++ merchant_context, ++ payment_intent, ++ revenue_recovery_payment_data, ++ ) ++ .await?; ++ ++ // Return terminal failure to finish the current execute workflow ++ Ok(Self::TerminalFailure(payment_data.payment_attempt.clone())) ++ } ++ ++ RevenueRecoveryPaymentsAttemptStatus::Processing => { ++ Ok(Self::SyncPayment(payment_data.payment_attempt.clone())) ++ } ++ RevenueRecoveryPaymentsAttemptStatus::InvalidStatus(action) => { ++ logger::info!(?action, "Invalid Payment Status For PCR Payment"); ++ Ok(Self::ManualReviewAction) ++ } ++ }, ++ Err(err) => ++ // check for an active attempt being constructed or not ++ { ++ logger::error!(execute_payment_res=?err); ++ Ok(Self::ReviewPayment) ++ } + } +- RevenueRecoveryPaymentsAttemptStatus::Failed => { +- let recovery_payment_attempt = +- hyperswitch_domain_models::revenue_recovery::RecoveryPaymentAttempt::from( +- &payment_data.payment_attempt, +- ); +- +- let recovery_payment_tuple = recovery_incoming_flow::RecoveryPaymentTuple::new( +- &recovery_payment_intent, +- &recovery_payment_attempt, +- ); ++ } ++ None => { ++ let response = revenue_recovery_core::api::call_psync_api( ++ state, ++ payment_intent.get_id(), ++ revenue_recovery_payment_data, ++ ) ++ .await; + +- // publish events to kafka +- if let Err(e) = recovery_incoming_flow::RecoveryPaymentTuple::publish_revenue_recovery_event_to_kafka( +- state, +- &recovery_payment_tuple, +- Some(process.retry_count+1) +- ) +- .await{ +- router_env::logger::error!( +- "Failed to publish revenue recovery event to kafka: {:?}", +- e +- ); +- }; +- +- Self::decide_retry_failure_action( +- state, +- merchant_id, ++ let payment_status_data = response ++ .change_context(errors::RecoveryError::PaymentCallFailed) ++ .attach_printable("Error while executing the Psync call")?; ++ ++ let payment_attempt = payment_status_data.payment_attempt; ++ ++ logger::info!( ++ process_id = %process.id, ++ connector_customer_id = %connector_customer_id, ++ "No token available, finishing CALCULATE_WORKFLOW" ++ ); ++ ++ state ++ .store ++ .as_scheduler() ++ .finish_process_with_business_status( + process.clone(), +- revenue_recovery_payment_data, +- &payment_data.payment_attempt, +- payment_intent, ++ business_status::CALCULATE_WORKFLOW_FINISH, + ) + .await +- } ++ .change_context(errors::RecoveryError::ProcessTrackerFailure) ++ .attach_printable("Failed to finish CALCULATE_WORKFLOW")?; + +- RevenueRecoveryPaymentsAttemptStatus::Processing => { +- Ok(Self::SyncPayment(payment_data.payment_attempt.clone())) +- } +- RevenueRecoveryPaymentsAttemptStatus::InvalidStatus(action) => { +- logger::info!(?action, "Invalid Payment Status For PCR Payment"); +- Ok(Self::ManualReviewAction) +- } +- }, +- Err(err) => +- // check for an active attempt being constructed or not +- { +- logger::error!(execute_payment_res=?err); +- Ok(Self::ReviewPayment) ++ logger::info!( ++ process_id = %process.id, ++ connector_customer_id = %connector_customer_id, ++ "CALCULATE_WORKFLOW finished successfully" ++ ); ++ Ok(Self::TerminalFailure(payment_attempt.clone())) + } + } + } +@@ -486,16 +655,45 @@ impl Action { + Ok(()) + } + Self::TerminalFailure(payment_attempt) => { ++ // update the connector payment transmission field to Unsuccessful and unset active attempt id ++ revenue_recovery_metadata.set_payment_transmission_field_for_api_request( ++ enums::PaymentConnectorTransmission::ConnectorCallUnsuccessful, ++ ); ++ ++ let payment_update_req = ++ PaymentsUpdateIntentRequest::update_feature_metadata_and_active_attempt_with_api( ++ payment_intent ++ .feature_metadata ++ .clone() ++ .unwrap_or_default() ++ .convert_back() ++ .set_payment_revenue_recovery_metadata_using_api( ++ revenue_recovery_metadata.clone(), ++ ), ++ api_enums::UpdateActiveAttempt::Unset, ++ ); ++ logger::info!( ++ "Call made to payments update intent api , with the request body {:?}", ++ payment_update_req ++ ); ++ revenue_recovery_core::api::update_payment_intent_api( ++ state, ++ payment_intent.id.clone(), ++ revenue_recovery_payment_data, ++ payment_update_req, ++ ) ++ .await ++ .change_context(errors::RecoveryError::PaymentCallFailed)?; ++ + db.as_scheduler() + .finish_process_with_business_status( + execute_task_process.clone(), +- business_status::EXECUTE_WORKFLOW_COMPLETE, ++ business_status::EXECUTE_WORKFLOW_FAILURE, + ) + .await + .change_context(errors::RecoveryError::ProcessTrackerFailure) + .attach_printable("Failed to update the process tracker")?; + // TODO: Add support for retrying failed outgoing recordback webhooks +- + Ok(()) + } + Self::SuccessfulPayment(payment_attempt) => { +@@ -551,6 +749,8 @@ impl Action { + revenue_recovery_payment_data: &storage::revenue_recovery::RevenueRecoveryPaymentData, + payment_intent: &PaymentIntent, + process: &storage::ProcessTracker, ++ profile: &domain::Profile, ++ merchant_context: domain::MerchantContext, + payment_attempt: PaymentAttempt, + ) -> RecoveryResult { + let response = revenue_recovery_core::api::call_psync_api( +@@ -563,18 +763,74 @@ impl Action { + match response { + Ok(_payment_data) => match payment_attempt.status.foreign_into() { + RevenueRecoveryPaymentsAttemptStatus::Succeeded => { ++ let connector_customer_id = payment_intent ++ .extract_connector_customer_id_from_payment_intent() ++ .change_context(errors::RecoveryError::ValueNotFound) ++ .attach_printable("Failed to extract customer ID from payment intent")?; ++ ++ let is_hard_decline = ++ revenue_recovery::check_hard_decline(state, &payment_attempt) ++ .await ++ .ok(); ++ ++ // update the status of token in redis ++ let _update_error_code = storage::revenue_recovery_redis_operation::RedisTokenManager::update_payment_processor_token_error_code_from_process_tracker( ++ state, ++ &connector_customer_id, ++ &None, ++ &is_hard_decline ++ ) ++ .await; ++ ++ // unlocking the token ++ let _unlock_the_connector_customer_id = storage::revenue_recovery_redis_operation::RedisTokenManager::unlock_connector_customer_status( ++ state, ++ &connector_customer_id, ++ ) ++ .await; ++ + Ok(Self::SuccessfulPayment(payment_attempt)) + } + RevenueRecoveryPaymentsAttemptStatus::Failed => { +- Self::decide_retry_failure_action( ++ let connector_customer_id = payment_intent ++ .extract_connector_customer_id_from_payment_intent() ++ .change_context(errors::RecoveryError::ValueNotFound) ++ .attach_printable("Failed to extract customer ID from payment intent")?; ++ ++ let error_code = payment_attempt.clone().error.map(|error| error.code); ++ ++ let is_hard_decline = ++ revenue_recovery::check_hard_decline(state, &payment_attempt) ++ .await ++ .ok(); ++ ++ let _update_error_code = storage::revenue_recovery_redis_operation::RedisTokenManager::update_payment_processor_token_error_code_from_process_tracker( ++ state, ++ &connector_customer_id, ++ &error_code, ++ &is_hard_decline ++ ) ++ .await; ++ ++ // unlocking the token ++ let _unlock_connector_customer_id = storage::revenue_recovery_redis_operation::RedisTokenManager::unlock_connector_customer_status( + state, +- revenue_recovery_payment_data.merchant_account.get_id(), +- process.clone(), +- revenue_recovery_payment_data, +- &payment_attempt, ++ &connector_customer_id, ++ ) ++ .await; ++ ++ // Reopen calculate workflow on payment failure ++ reopen_calculate_workflow_on_payment_failure( ++ state, ++ process, ++ profile, ++ merchant_context, + payment_intent, ++ revenue_recovery_payment_data, + ) +- .await ++ .await?; ++ ++ Ok(Self::TerminalFailure(payment_attempt.clone())) + } + + RevenueRecoveryPaymentsAttemptStatus::Processing => { +@@ -684,6 +940,37 @@ impl Action { + } + + Self::TerminalFailure(payment_attempt) => { ++ // update the connector payment transmission field to Unsuccessful and unset active attempt id ++ revenue_recovery_metadata.set_payment_transmission_field_for_api_request( ++ enums::PaymentConnectorTransmission::ConnectorCallUnsuccessful, ++ ); ++ ++ let payment_update_req = ++ PaymentsUpdateIntentRequest::update_feature_metadata_and_active_attempt_with_api( ++ payment_intent ++ .feature_metadata ++ .clone() ++ .unwrap_or_default() ++ .convert_back() ++ .set_payment_revenue_recovery_metadata_using_api( ++ revenue_recovery_metadata.clone(), ++ ), ++ api_enums::UpdateActiveAttempt::Unset, ++ ); ++ logger::info!( ++ "Call made to payments update intent api , with the request body {:?}", ++ payment_update_req ++ ); ++ ++ revenue_recovery_core::api::update_payment_intent_api( ++ state, ++ payment_intent.id.clone(), ++ revenue_recovery_payment_data, ++ payment_update_req, ++ ) ++ .await ++ .change_context(errors::RecoveryError::PaymentCallFailed)?; ++ + // TODO: Add support for retrying failed outgoing recordback webhooks + // finish the current psync task + db.as_scheduler() +@@ -804,6 +1091,140 @@ impl Action { + } + } + } ++ ++/// Reopen calculate workflow when payment fails ++pub async fn reopen_calculate_workflow_on_payment_failure( ++ state: &SessionState, ++ process: &storage::ProcessTracker, ++ profile: &domain::Profile, ++ merchant_context: domain::MerchantContext, ++ payment_intent: &PaymentIntent, ++ revenue_recovery_payment_data: &storage::revenue_recovery::RevenueRecoveryPaymentData, ++) -> RecoveryResult<()> { ++ let db = &*state.store; ++ let id = payment_intent.id.clone(); ++ let task = revenue_recovery_core::CALCULATE_WORKFLOW; ++ let runner = storage::ProcessTrackerRunner::PassiveRecoveryWorkflow; ++ ++ // Construct the process tracker ID for CALCULATE_WORKFLOW ++ let process_tracker_id = format!("{}_{}_{}", runner, task, id.get_string_repr()); ++ ++ logger::info!( ++ payment_id = %id.get_string_repr(), ++ process_tracker_id = %process_tracker_id, ++ "Attempting to reopen CALCULATE_WORKFLOW on payment failure" ++ ); ++ ++ // Find the existing CALCULATE_WORKFLOW process tracker ++ let calculate_process = db ++ .find_process_by_id(&process_tracker_id) ++ .await ++ .change_context(errors::RecoveryError::ProcessTrackerFailure) ++ .attach_printable("Failed to find CALCULATE_WORKFLOW process tracker")?; ++ ++ match calculate_process { ++ Some(process) => { ++ logger::info!( ++ payment_id = %id.get_string_repr(), ++ process_tracker_id = %process_tracker_id, ++ current_status = %process.business_status, ++ current_retry_count = process.retry_count, ++ "Found existing CALCULATE_WORKFLOW, updating status and retry count" ++ ); ++ ++ // Update the process tracker to reopen the calculate workflow ++ // 1. Change status from "finish" to "pending" ++ // 2. Increase retry count by 1 ++ // 3. Set business status to QUEUED ++ // 4. Schedule for immediate execution ++ let new_retry_count = process.retry_count + 1; ++ let new_schedule_time = common_utils::date_time::now() + time::Duration::hours(1); ++ ++ let pt_update = storage::ProcessTrackerUpdate::Update { ++ name: Some(task.to_string()), ++ retry_count: Some(new_retry_count), ++ schedule_time: Some(new_schedule_time), ++ tracking_data: Some(process.clone().tracking_data), ++ business_status: Some(String::from(business_status::PENDING)), ++ status: Some(common_enums::ProcessTrackerStatus::Pending), ++ updated_at: Some(common_utils::date_time::now()), ++ }; ++ ++ db.update_process(process.clone(), pt_update) ++ .await ++ .change_context(errors::RecoveryError::ProcessTrackerFailure) ++ .attach_printable("Failed to update CALCULATE_WORKFLOW process tracker")?; ++ ++ logger::info!( ++ payment_id = %id.get_string_repr(), ++ process_tracker_id = %process_tracker_id, ++ new_retry_count = new_retry_count, ++ new_schedule_time = %new_schedule_time, ++ "Successfully reopened CALCULATE_WORKFLOW with increased retry count" ++ ); ++ } ++ None => { ++ logger::info!( ++ payment_id = %id.get_string_repr(), ++ process_tracker_id = %process_tracker_id, ++ "CALCULATE_WORKFLOW process tracker not found, creating new entry" ++ ); ++ ++ // Create tracking data for the new CALCULATE_WORKFLOW ++ let tracking_data = create_calculate_workflow_tracking_data( ++ payment_intent, ++ revenue_recovery_payment_data, ++ )?; ++ ++ // Call the existing perform_calculate_workflow function ++ perform_calculate_workflow( ++ state, ++ process, ++ profile, ++ merchant_context, ++ &tracking_data, ++ revenue_recovery_payment_data, ++ payment_intent, ++ ) ++ .await ++ .change_context(errors::RecoveryError::ProcessTrackerFailure) ++ .attach_printable("Failed to perform calculate workflow")?; ++ ++ logger::info!( ++ payment_id = %id.get_string_repr(), ++ process_tracker_id = %process_tracker_id, ++ "Successfully created new CALCULATE_WORKFLOW entry using perform_calculate_workflow" ++ ); ++ } ++ } ++ ++ Ok(()) ++} ++ ++/// Create tracking data for the CALCULATE_WORKFLOW ++fn create_calculate_workflow_tracking_data( ++ payment_intent: &PaymentIntent, ++ revenue_recovery_payment_data: &storage::revenue_recovery::RevenueRecoveryPaymentData, ++) -> RecoveryResult { ++ let tracking_data = storage::revenue_recovery::RevenueRecoveryWorkflowTrackingData { ++ merchant_id: revenue_recovery_payment_data ++ .merchant_account ++ .get_id() ++ .clone(), ++ profile_id: revenue_recovery_payment_data.profile.get_id().clone(), ++ global_payment_id: payment_intent.id.clone(), ++ payment_attempt_id: payment_intent ++ .active_attempt_id ++ .clone() ++ .ok_or(storage_impl::errors::RecoveryError::ValueNotFound)?, ++ billing_mca_id: revenue_recovery_payment_data.billing_mca.get_id().clone(), ++ revenue_recovery_retry: revenue_recovery_payment_data.retry_algorithm, ++ invoice_scheduled_time: None, // Will be set by perform_calculate_workflow ++ }; ++ ++ Ok(tracking_data) ++} ++ + // TODO: Move these to impl based functions + async fn record_back_to_billing_connector( + state: &SessionState, +diff --git a/crates/router/src/core/webhooks/recovery_incoming.rs b/crates/router/src/core/webhooks/recovery_incoming.rs +index 5f00dd0c..9238b307 100644 +--- a/crates/router/src/core/webhooks/recovery_incoming.rs ++++ b/crates/router/src/core/webhooks/recovery_incoming.rs +@@ -7,19 +7,25 @@ use common_utils::{ + }; + use diesel_models::process_tracker as storage; + use error_stack::{report, ResultExt}; ++use futures::stream::SelectNextSome; + use hyperswitch_domain_models::{ +- payments as domain_payments, revenue_recovery, router_data_v2::flow_common_types, +- router_flow_types, router_request_types::revenue_recovery as revenue_recovery_request, +- router_response_types::revenue_recovery as revenue_recovery_response, types as router_types, ++ payments as domain_payments, ++ revenue_recovery::{self, RecoveryPaymentIntent}, ++ router_data_v2::flow_common_types, ++ router_flow_types, ++ router_request_types::revenue_recovery as revenue_recovery_request, ++ router_response_types::revenue_recovery as revenue_recovery_response, ++ types as router_types, + }; + use hyperswitch_interfaces::webhooks as interface_webhooks; + use masking::{PeekInterface, Secret}; + use router_env::{instrument, logger, tracing}; + use services::kafka; ++use storage::business_status; + + use crate::{ + core::{ +- admin, ++ self, admin, + errors::{self, CustomResult}, + payments::{self, helpers}, + }, +@@ -232,6 +238,7 @@ async fn handle_monitoring_threshold( + } + Ok(webhooks::WebhookResponseTracker::NoEffect) + } ++ + #[allow(clippy::too_many_arguments)] + async fn handle_schedule_failed_payment( + billing_connector_account: &domain::MerchantConnectorAccount, +@@ -248,6 +255,8 @@ async fn handle_schedule_failed_payment( + ) -> CustomResult { + let (recovery_attempt_from_payment_attempt, recovery_intent_from_payment_attempt) = + payment_attempt_with_recovery_intent; ++ ++ // When intent_retry_count is less than or equal to threshold + (intent_retry_count <= mca_retry_threshold) + .then(|| { + logger::error!( +@@ -258,12 +267,13 @@ async fn handle_schedule_failed_payment( + Ok(webhooks::WebhookResponseTracker::NoEffect) + }) + .async_unwrap_or_else(|| async { +- RevenueRecoveryAttempt::insert_execute_pcr_task( +- &billing_connector_account.get_id(), +- &*state.store, +- merchant_context.get_merchant_account().get_id().to_owned(), +- recovery_intent_from_payment_attempt.clone(), +- business_profile.get_id().to_owned(), ++ // Call calculate_job ++ core::revenue_recovery::upsert_calculate_pcr_task( ++ billing_connector_account, ++ state, ++ merchant_context, ++ recovery_intent_from_payment_attempt, ++ business_profile, + intent_retry_count, + recovery_attempt_from_payment_attempt + .as_ref() +@@ -926,6 +936,7 @@ impl RevenueRecoveryAttempt { + profile_id, + payment_attempt_id, + revenue_recovery_retry, ++ invoice_scheduled_time: Some(schedule_time), + }; + + let tag = ["PCR"]; +diff --git a/crates/router/src/types/storage/revenue_recovery.rs b/crates/router/src/types/storage/revenue_recovery.rs +index 81a012ba..af84ed21 100644 +--- a/crates/router/src/types/storage/revenue_recovery.rs ++++ b/crates/router/src/types/storage/revenue_recovery.rs +@@ -13,7 +13,7 @@ use masking::PeekInterface; + use router_env::logger; + use serde::{Deserialize, Serialize}; + +-use crate::{db::StorageInterface, routes::SessionState, workflows::revenue_recovery}; ++use crate::{db::StorageInterface, routes::SessionState, types, workflows::revenue_recovery}; + #[derive(serde::Serialize, serde::Deserialize, Debug)] + pub struct RevenueRecoveryWorkflowTrackingData { + pub merchant_id: id_type::MerchantId, +@@ -22,6 +22,7 @@ pub struct RevenueRecoveryWorkflowTrackingData { + pub payment_attempt_id: id_type::GlobalAttemptId, + pub billing_mca_id: id_type::MerchantConnectorAccountId, + pub revenue_recovery_retry: enums::RevenueRecoveryAlgorithmType, ++ pub invoice_scheduled_time: Option, + } + + #[derive(Debug, Clone)] +diff --git a/crates/router/src/workflows/revenue_recovery.rs b/crates/router/src/workflows/revenue_recovery.rs +index 8f3b3f0e..dc1d97bc 100644 +--- a/crates/router/src/workflows/revenue_recovery.rs ++++ b/crates/router/src/workflows/revenue_recovery.rs +@@ -114,7 +114,7 @@ impl ProcessTrackerWorkflow for ExecutePcrWorkflow { + >( + state, + state.get_req_state(), +- merchant_context_from_revenue_recovery_payment_data, ++ merchant_context_from_revenue_recovery_payment_data.clone(), + revenue_recovery_payment_data.profile.clone(), + payments::operations::PaymentGetIntent, + request, +@@ -128,6 +128,8 @@ impl ProcessTrackerWorkflow for ExecutePcrWorkflow { + Box::pin(pcr::perform_execute_payment( + state, + &process, ++ &revenue_recovery_payment_data.profile.clone(), ++ merchant_context_from_revenue_recovery_payment_data.clone(), + &tracking_data, + &revenue_recovery_payment_data, + &payment_data.payment_intent, +@@ -138,6 +140,8 @@ impl ProcessTrackerWorkflow for ExecutePcrWorkflow { + Box::pin(pcr::perform_payments_sync( + state, + &process, ++ &revenue_recovery_payment_data.profile.clone(), ++ merchant_context_from_revenue_recovery_payment_data.clone(), + &tracking_data, + &revenue_recovery_payment_data, + &payment_data.payment_intent, +@@ -145,6 +149,18 @@ impl ProcessTrackerWorkflow for ExecutePcrWorkflow { + .await?; + Ok(()) + } ++ Some("CALCULATE_WORKFLOW") => { ++ Box::pin(pcr::perform_calculate_workflow( ++ state, ++ &process, ++ &revenue_recovery_payment_data.profile.clone(), ++ merchant_context_from_revenue_recovery_payment_data, ++ &tracking_data, ++ &revenue_recovery_payment_data, ++ &payment_data.payment_intent, ++ )) ++ .await ++ } + + _ => Err(errors::ProcessTrackerError::JobNotFound), + } + +----- END CHUNK ----- \ No newline at end of file diff --git a/raw/60/6016377ad8e424c58bb91af5c145741ba84e059f.txt b/raw/60/6016377ad8e424c58bb91af5c145741ba84e059f.txt new file mode 100644 index 0000000000000000000000000000000000000000..bd6ce2d39900022374df6cff38e324a93bc497a5 --- /dev/null +++ b/raw/60/6016377ad8e424c58bb91af5c145741ba84e059f.txt @@ -0,0 +1,2573 @@ +ROUTE: juspay/hyperswitch@6016377ad8e424c58bb91af5c145741ba84e059f +REPO: https://github.com/juspay/hyperswitch +COMMIT: 6016377ad8e424c58bb91af5c145741ba84e059f +AUTHOR: Ayush Anand <114248859+ayush22667@users.noreply.github.com> +DATE: 2025-08-22T13:05:09 + +=== ISSUE_AND_PR === +[PR #8978] feat(payment_methods): add payment-methods/filter endpoint to list countries and currencies for connector payment method in v2 +URL: https://github.com/juspay/hyperswitch/pull/8978 +BODY: +## Type of Change + + +- [ ] Bugfix +- [X] New feature +- [ ] Enhancement +- [ ] Refactoring +- [ ] Dependency updates +- [ ] Documentation +- [ ] CI/CD + +## Description + +Add the payment method filter route to the V2 PaymentMethods implementation which list all available countries and currencies based on connector and payment method type. + + +### Additional Changes + +- [X] This PR modifies the API contract +- [ ] This PR modifies the database schema +- [ ] This PR modifies application configuration/environment variables + + + + +## Motivation and Context + + + + +## How did you test it? + +Request: +``` +curl --location 'http://localhost:8080/v2/payment-methods/filter?connector=stripe&paymentMethodType=debit' \ +--header 'Authorization: api-key=dev_4DIYNBJfJIQ2Tr1wLavfp48BJvXLtHmBWdkkALwWj6U91DAjP7h2RfQmhnDMATmB' \ +--header 'x-profile-id: pro_9dDVfbJRfEb7o7qxBatP' \ +--header 'api-key: dev_4DIYNBJfJIQ2Tr1wLavfp48BJvXLtHmBWdkkALwWj6U91DAjP7h2RfQmhnDMATmB' \ +--data '' +``` +Response: +``` +{ + "currencies": [ + "QAR", + "BMD", + "ERN", + "ETB", + "ILS", + "MOP", + "STN", + "TND", + "SRD", + "TOP", + "JMD", + "BHD", + "SSP", + "BRL", + "COP", + "KMF", + "PEN", + "SLE", + "TZS", + "KZT", + "CUP", + "MDL", + "XCD", + "BGN", + "NIO", + "BTN", + "MXN", + "FKP", + "CLF", + "OMR", + "GHS", + "DZD", + "BSD", + "SEK", + "VND", + "ZAR", + "VES", + "DOP", + "RON", + "BND", + "PGK", + "SVC", + "HTG", + "KWD", + "TMT", + "SBD", + "AED", + "HKD", + "CRC", + "DKK", + "TTD", + "TWD", + "UGX", + "SLL", + "FJD", + "ZWL", + "ANG", + "JPY", + "CNY", + "DJF", + "PLN", + "BBD", + "WST", + "PHP", + "PKR", + "MVR", + "LSL", + "HRK", + "UZS", + "NAD", + "KRW", + "RUB", + "TJS", + "TRY", + "BWP", + "KHR", + "BZD", + "YER", + "CDF", + "NOK", + "IDR", + "MAD", + "MMK", + "MZN", + "BAM", + "JOD", + "XOF", + "NZD", + "KES", + "BIF", + "MUR", + "IRR", + "UAH", + "XPF", + "THB", + "AWG", + "GBP", + "GMD", + "INR", + "MYR", + "PAB", + "BDT", + "HNL", + "PYG", + "CZK", + "GEL", + "ISK", + "GTQ", + "CAD", + "KPW", + "MWK", + "NGN", + "SYP", + "LAK", + "RWF", + "KGS", + "MKD", + "MNT", + "HUF", + "LYD", + "SCR", + "XAF", + "AOA", + "NPR", + "CLP", + "MRU", + "SDG", + "STD", + "ARS", + "SAR", + "AUD", + "SZL", + "VUV", + "CVE", + "ALL", + "RSD", + "AFN", + "ZMW", + "AMD", + "MGA", + "LRD", + "BOB", + "AZN", + "CUC", + "KYD", + "BYN", + "USD", + "EUR", + "SGD", + "SHP", + "SOS", + "GYD", + "GIP", + "GNF", + "EGP", + "CHF", + "LBP", + "UYU", + "LKR", + "IQD" + ], + "countries": [ + { + "code": "GU", + "name": "Guam" + }, + { + "code": "AW", + "name": "Aruba" + }, + { + "code": "HR", + "name": "Croatia" + }, + { + "code": "TD", + "name": "Chad" + }, + { + "code": "TM", + "name": "Turkmenistan" + }, + { + "code": "GB", + "name": "UnitedKingdomOfGreatBritainAndNorthernIreland" + }, + { + "code": "CL", + "name": "Chile" + }, + { + "code": "LK", + "name": "SriLanka" + }, + { + "code": "SI", + "name": "Slovenia" + }, + { + "code": "PA", + "name": "Panama" + }, + { + "code": "NE", + "name": "Niger" + }, + { + "code": "AZ", + "name": "Azerbaijan" + }, + { + "code": "MQ", + "name": "Martinique" + }, + { + "code": "BY", + "name": "Belarus" + }, + { + "code": "FJ", + "name": "Fiji" + }, + { + "code": "PY", + "name": "Paraguay" + }, + { + "code": "HK", + "name": "HongKong" + }, + { + "code": "UZ", + "name": "Uzbekistan" + }, + { + "code": "DE", + "name": "Germany" + }, + { + "code": "CX", + "name": "ChristmasIsland" + }, + { + "code": "BB", + "name": "Barbados" + }, + { + "code": "DJ", + "name": "Djibouti" + }, + { + "code": "GP", + "name": "Guadeloupe" + }, + { + "code": "CR", + "name": "CostaRica" + }, + { + "code": "ZM", + "name": "Zambia" + }, + { + "code": "ST", + "name": "SaoTomeAndPrincipe" + }, + { + "code": "BA", + "name": "BosniaAndHerzegovina" + }, + { + "code": "NI", + "name": "Nicaragua" + }, + { + "code": "SO", + "name": "Somalia" + }, + { + "code": "PR", + "name": "PuertoRico" + }, + { + "code": "SC", + "name": "Seychelles" + }, + { + "code": "KR", + "name": "KoreaRepublic" + }, + { + "code": "FM", + "name": "MicronesiaFederatedStates" + }, + { + "code": "DO", + "name": "DominicanRepublic" + }, + { + "code": "MO", + "name": "Macao" + }, + { + "code": "JP", + "name": "Japan" + }, + { + "code": "MH", + "name": "MarshallIslands" + }, + { + "code": "AQ", + "name": "Antarctica" + }, + { + "code": "CD", + "name": "CongoDemocraticRepublic" + }, + { + "code": "NA", + "name": "Namibia" + }, + { + "code": "TV", + "name": "Tuvalu" + }, + { + "code": "EE", + "name": "Estonia" + }, + { + "code": "ML", + "name": "Mali" + }, + { + "code": "IS", + "name": "Iceland" + }, + { + "code": "SR", + "name": "Suriname" + }, + { + "code": "UM", + "name": "UnitedStatesMinorOutlyingIslands" + }, + { + "code": "SB", + "name": "SolomonIslands" + }, + { + "code": "RO", + "name": "Romania" + }, + { + "code": "CI", + "name": "CotedIvoire" + }, + { + "code": "MD", + "name": "MoldovaRepublic" + }, + { + "code": "GS", + "name": "SouthGeorgiaAndTheSouthSandwichIslands" + }, + { + "code": "PF", + "name": "FrenchPolynesia" + }, + { + "code": "GE", + "name": "Georgia" + }, + { + "code": "JE", + "name": "Jersey" + }, + { + "code": "SK", + "name": "Slovakia" + }, + { + "code": "ID", + "name": "Indonesia" + }, + { + "code": "NR", + "name": "Nauru" + }, + { + "code": "CO", + "name": "Colombia" + }, + { + "code": "GR", + "name": "Greece" + }, + { + "code": "KW", + "name": "Kuwait" + }, + { + "code": "TH", + "name": "Thailand" + }, + { + "code": "KI", + "name": "Kiribati" + }, + { + "code": "BN", + "name": "BruneiDarussalam" + }, + { + "code": "WS", + "name": "Samoa" + }, + { + "code": "AI", + "name": "Anguilla" + }, + { + "code": "TC", + "name": "TurksAndCaicosIslands" + }, + { + "code": "BG", + "name": "Bulgaria" + }, + { + "code": "RS", + "name": "Serbia" + }, + { + "code": "BW", + "name": "Botswana" + }, + { + "code": "KM", + "name": "Comoros" + }, + { + "code": "SN", + "name": "Senegal" + }, + { + "code": "TR", + "name": "Turkey" + }, + { + "code": "SL", + "name": "SierraLeone" + }, + { + "code": "MC", + "name": "Monaco" + }, + { + "code": "BL", + "name": "SaintBarthelemy" + }, + { + "code": "GL", + "name": "Greenland" + }, + { + "code": "KG", + "name": "Kyrgyzstan" + }, + { + "code": "MT", + "name": "Malta" + }, + { + "code": "VA", + "name": "HolySee" + }, + { + "code": "AS", + "name": "AmericanSamoa" + }, + { + "code": "TJ", + "name": "Tajikistan" + }, + { + "code": "TN", + "name": "Tunisia" + }, + { + "code": "IT", + "name": "Italy" + }, + { + "code": "CV", + "name": "CaboVerde" + }, + { + "code": "IN", + "name": "India" + }, + { + "code": "ME", + "name": "Montenegro" + }, + { + "code": "LR", + "name": "Liberia" + }, + { + "code": "AE", + "name": "UnitedArabEmirates" + }, + { + "code": "TK", + "name": "Tokelau" + }, + { + "code": "IQ", + "name": "Iraq" + }, + { + "code": "FO", + "name": "FaroeIslands" + }, + { + "code": "MW", + "name": "Malawi" + }, + { + "code": "SY", + "name": "SyrianArabRepublic" + }, + { + "code": "CA", + "name": "Canada" + }, + { + "code": "GF", + "name": "FrenchGuiana" + }, + { + "code": "ER", + "name": "Eritrea" + }, + { + "code": "MY", + "name": "Malaysia" + }, + { + "code": "VG", + "name": "VirginIslandsBritish" + }, + { + "code": "RE", + "name": "Reunion" + }, + { + "code": "JM", + "name": "Jamaica" + }, + { + "code": "AF", + "name": "Afghanistan" + }, + { + "code": "MN", + "name": "Mongolia" + }, + { + "code": "CW", + "name": "Curacao" + }, + { + "code": "IE", + "name": "Ireland" + }, + { + "code": "CG", + "name": "Congo" + }, + { + "code": "NG", + "name": "Nigeria" + }, + { + "code": "VC", + "name": "SaintVincentAndTheGrenadines" + }, + { + "code": "TO", + "name": "Tonga" + }, + { + "code": "LU", + "name": "Luxembourg" + }, + { + "code": "TL", + "name": "TimorLeste" + }, + { + "code": "MF", + "name": "SaintMartinFrenchpart" + }, + { + "code": "AT", + "name": "Austria" + }, + { + "code": "ET", + "name": "Ethiopia" + }, + { + "code": "SX", + "name": "SintMaartenDutchpart" + }, + { + "code": "GT", + "name": "Guatemala" + }, + { + "code": "TF", + "name": "FrenchSouthernTerritories" + }, + { + "code": "KP", + "name": "KoreaDemocraticPeoplesRepublic" + }, + { + "code": "LC", + "name": "SaintLucia" + }, + { + "code": "BT", + "name": "Bhutan" + }, + { + "code": "SM", + "name": "SanMarino" + }, + { + "code": "QA", + "name": "Qatar" + }, + { + "code": "DM", + "name": "Dominica" + }, + { + "code": "BJ", + "name": "Benin" + }, + { + "code": "GA", + "name": "Gabon" + }, + { + "code": "YT", + "name": "Mayotte" + }, + { + "code": "KZ", + "name": "Kazakhstan" + }, + { + "code": "LV", + "name": "Latvia" + }, + { + "code": "GG", + "name": "Guernsey" + }, + { + "code": "CH", + "name": "Switzerland" + }, + { + "code": "HM", + "name": "HeardIslandAndMcDonaldIslands" + }, + { + "code": "AG", + "name": "AntiguaAndBarbuda" + }, + { + "code": "WF", + "name": "WallisAndFutuna" + }, + { + "code": "CC", + "name": "CocosKeelingIslands" + }, + { + "code": "ZW", + "name": "Zimbabwe" + }, + { + "code": "IL", + "name": "Israel" + }, + { + "code": "TG", + "name": "Togo" + }, + { + "code": "MG", + "name": "Madagascar" + }, + { + "code": "NP", + "name": "Nepal" + }, + { + "code": "GW", + "name": "GuineaBissau" + }, + { + "code": "PW", + "name": "Palau" + }, + { + "code": "LY", + "name": "Libya" + }, + { + "code": "FI", + "name": "Finland" + }, + { + "code": "AR", + "name": "Argentina" + }, + { + "code": "TT", + "name": "TrinidadAndTobago" + }, + { + "code": "FR", + "name": "France" + }, + { + "code": "MS", + "name": "Montserrat" + }, + { + "code": "IO", + "name": "BritishIndianOceanTerritory" + }, + { + "code": "TW", + "name": "TaiwanProvinceOfChina" + }, + { + "code": "EC", + "name": "Ecuador" + }, + { + "code": "NO", + "name": "Norway" + }, + { + "code": "MZ", + "name": "Mozambique" + }, + { + "code": "GH", + "name": "Ghana" + }, + { + "code": "HU", + "name": "Hungary" + }, + { + "code": "CU", + "name": "Cuba" + }, + { + "code": "LI", + "name": "Liechtenstein" + }, + { + "code": "MU", + "name": "Mauritius" + }, + { + "code": "EG", + "name": "Egypt" + }, + { + "code": "MX", + "name": "Mexico" + }, + { + "code": "MV", + "name": "Maldives" + }, + { + "code": "BE", + "name": "Belgium" + }, + { + "code": "VN", + "name": "Vietnam" + }, + { + "code": "NU", + "name": "Niue" + }, + { + "code": "CY", + "name": "Cyprus" + }, + { + "code": "GQ", + "name": "EquatorialGuinea" + }, + { + "code": "SD", + "name": "Sudan" + }, + { + "code": "LT", + "name": "Lithuania" + }, + { + "code": "BD", + "name": "Bangladesh" + }, + { + "code": "NL", + "name": "Netherlands" + }, + { + "code": "BH", + "name": "Bahrain" + }, + { + "code": "AX", + "name": "AlandIslands" + }, + { + "code": "BR", + "name": "Brazil" + }, + { + "code": "AM", + "name": "Armenia" + }, + { + "code": "UY", + "name": "Uruguay" + }, + { + "code": "MP", + "name": "NorthernMarianaIslands" + }, + { + "code": "NZ", + "name": "NewZealand" + }, + { + "code": "GY", + "name": "Guyana" + }, + { + "code": "CZ", + "name": "Czechia" + }, + { + "code": "AU", + "name": "Australia" + }, + { + "code": "SH", + "name": "SaintHelenaAscensionAndTristandaCunha" + }, + { + "code": "HT", + "name": "Haiti" + }, + { + "code": "SA", + "name": "SaudiArabia" + }, + { + "code": "CM", + "name": "Cameroon" + }, + { + "code": "JO", + "name": "Jordan" + }, + { + "code": "UA", + "name": "Ukraine" + }, + { + "code": "BV", + "name": "BouvetIsland" + }, + { + "code": "GI", + "name": "Gibraltar" + }, + { + "code": "GD", + "name": "Grenada" + }, + { + "code": "UG", + "name": "Uganda" + }, + { + "code": "TZ", + "name": "TanzaniaUnitedRepublic" + }, + { + "code": "DZ", + "name": "Algeria" + }, + { + "code": "PM", + "name": "SaintPierreAndMiquelon" + }, + { + "code": "ZA", + "name": "SouthAfrica" + }, + { + "code": "OM", + "name": "Oman" + }, + { + "code": "KY", + "name": "CaymanIslands" + }, + { + "code": "LS", + "name": "Lesotho" + }, + { + "code": "ES", + "name": "Spain" + }, + { + "code": "MM", + "name": "Myanmar" + }, + { + "code": "AO", + "name": "Angola" + }, + { + "code": "EH", + "name": "WesternSahara" + }, + { + "code": "IR", + "name": "IranIslamicRepublic" + }, + { + "code": "HN", + "name": "Honduras" + }, + { + "code": "KH", + "name": "Cambodia" + }, + { + "code": "KE", + "name": "Kenya" + }, + { + "code": "MK", + "name": "MacedoniaTheFormerYugoslavRepublic" + }, + { + "code": "AL", + "name": "Albania" + }, + { + "code": "US", + "name": "UnitedStatesOfAmerica" + }, + { + "code": "YE", + "name": "Yemen" + }, + { + "code": "DK", + "name": "Denmark" + }, + { + "code": "MR", + "name": "Mauritania" + }, + { + "code": "SG", + "name": "Singapore" + }, + { + "code": "CN", + "name": "China" + }, + { + "code": "IM", + "name": "IsleOfMan" + }, + { + "code": "PH", + "name": "Philippines" + }, + { + "code": "SZ", + "name": "Swaziland" + }, + { + "code": "BO", + "name": "BoliviaPlurinationalState" + }, + { + "code": "CF", + "name": "CentralAfricanRepublic" + }, + { + "code": "PE", + "name": "Peru" + }, + { + "code": "BQ", + "name": "BonaireSintEustatiusAndSaba" + }, + { + "code": "SV", + "name": "ElSalvador" + }, + { + "code": "NC", + "name": "NewCaledonia" + }, + { + "code": "VU", + "name": "Vanuatu" + }, + { + "code": "MA", + "name": "Morocco" + }, + { + "code": "SS", + "name": "SouthSudan" + }, + { + "code": "BZ", + "name": "Belize" + }, + { + "code": "PS", + "name": "PalestineState" + }, + { + "code": "CK", + "name": "CookIslands" + }, + { + "code": "BF", + "name": "BurkinaFaso" + }, + { + "code": "FK", + "name": "FalklandIslandsMalvinas" + }, + { + "code": "SJ", + "name": "SvalbardAndJanMayen" + }, + { + "code": "VE", + "name": "VenezuelaBolivarianRepublic" + }, + { + "code": "BI", + "name": "Burundi" + }, + { + "code": "PT", + "name": "Portugal" + }, + { + "code": "VI", + "name": "VirginIslandsUS" + }, + { + "code": "PG", + "name": "PapuaNewGuinea" + }, + { + "code": "RU", + "name": "RussianFederation" + }, + { + "code": "AD", + "name": "Andorra" + }, + { + "code": "NF", + "name": "NorfolkIsland" + }, + { + "code": "LB", + "name": "Lebanon" + }, + { + "code": "GM", + "name": "Gambia" + }, + { + "code": "BM", + "name": "Bermuda" + }, + { + "code": "BS", + "name": "Bahamas" + }, + { + "code": "KN", + "name": "SaintKittsAndNevis" + }, + { + "code": "PN", + "name": "Pitcairn" + }, + { + "code": "PL", + "name": "Poland" + }, + { + "code": "SE", + "name": "Sweden" + }, + { + "code": "RW", + "name": "Rwanda" + }, + { + "code": "PK", + "name": "Pakistan" + }, + { + "code": "GN", + "name": "Guinea" + }, + { + "code": "LA", + "name": "LaoPeoplesDemocraticRepublic" + } + ] +} +``` +Request with JWT Authentication: +``` +curl --location 'http://localhost:8081/v2/payment-methods/filter?connector=stripe&paymentMethodType=debit' \ +--header 'x-profile-id: pro_vJRG8ITXZXHXQuoHA59p' \ +--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiNjIwY2E1NzAtY2I1Ni00YTUwLTk4MTctODEzYzEyNjljOWUwIiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzU1NTkyMzYyIiwicm9sZV9pZCI6InByb2ZpbGVfdmlld19vbmx5IiwiZXhwIjoxNzU1NzY1NjI3LCJvcmdfaWQiOiJvcmdfelFiZUprcUlPWWhMUTNmeDVMOHQiLCJwcm9maWxlX2lkIjoicHJvX3ZKUkc4SVRYWlhIWFF1b0hBNTlwIiwidGVuYW50X2lkIjoicHVibGljIn0.9DafPc6vkoO8K-JLHxetMmmDYQDek35-HV8zrVe5QTg' \ +--data '' +``` +Respone: +``` +{ + "currencies": [ + "ERN", + "LSL", + "MMK", + "LKR", + "THB", + "SHP", + "FKP", + "XCD", + "NIO", + "GIP", + "RWF", + "CUP", + "OMR", + "UYU", + "GTQ", + "GNF", + "FJD", + "GBP", + "KMF", + "ILS", + "ETB", + "SYP", + "GHS", + "GMD", + "MUR", + "BSD", + "KRW", + "MZN", + "TMT", + "TOP", + "SBD", + "KGS", + "UGX", + "UZS", + "YER", + "RUB", + "TZS", + "COP", + "PYG", + "NAD", + "SSP", + "GYD", + "CHF", + "KWD", + "MYR", + "PKR", + "SAR", + "WST", + "EGP", + "BAM", + "QAR", + "XOF", + "DZD", + "SZL", + "CZK", + "VND", + "SCR", + "IDR", + "ANG", + "LAK", + "DJF", + "TTD", + "HUF", + "PLN", + "VES", + "ALL", + "MRU", + "ZMW", + "STN", + "ZWL", + "AFN", + "NOK", + "ISK", + "AED", + "EUR", + "MVR", + "CRC", + "GEL", + "TND", + "XAF", + "KHR", + "IRR", + "JOD", + "CNY", + "CVE", + "AWG", + "CUC", + "NGN", + "STD", + "MXN", + "LYD", + "SRD", + "BWP", + "CDF", + "KPW", + "SEK", + "PGK", + "AMD", + "NZD", + "BOB", + "CAD", + "NPR", + "PEN", + "SDG", + "MNT", + "AZN", + "MOP", + "BDT", + "CLF", + "BMD", + "BTN", + "PAB", + "USD", + "BGN", + "HNL", + "DKK", + "ZAR", + "AOA", + "TJS", + "VUV", + "BHD", + "BZD", + "TRY", + "HKD", + "ARS", + "BND", + "HTG", + "LRD", + "MGA", + "SVC", + "SLL", + "KES", + "HRK", + "SLE", + "RON", + "MKD", + "MDL", + "UAH", + "BIF", + "KYD", + "BBD", + "BRL", + "CLP", + "SOS", + "JPY", + "RSD", + "INR", + "MWK", + "AUD", + "PHP", + "IQD", + "LBP", + "MAD", + "XPF", + "JMD", + "DOP", + "TWD", + "KZT", + "SGD", + "BYN" + ], + "countries": [ + { + "code": "VU", + "name": "Vanuatu" + }, + { + "code": "AI", + "name": "Anguilla" + }, + { + "code": "UA", + "name": "Ukraine" + }, + { + "code": "PW", + "name": "Palau" + }, + { + "code": "FR", + "name": "France" + }, + { + "code": "TO", + "name": "Tonga" + }, + { + "code": "JO", + "name": "Jordan" + }, + { + "code": "ZW", + "name": "Zimbabwe" + }, + { + "code": "KZ", + "name": "Kazakhstan" + }, + { + "code": "AW", + "name": "Aruba" + }, + { + "code": "GY", + "name": "Guyana" + }, + { + "code": "KE", + "name": "Kenya" + }, + { + "code": "LS", + "name": "Lesotho" + }, + { + "code": "NP", + "name": "Nepal" + }, + { + "code": "US", + "name": "UnitedStatesOfAmerica" + }, + { + "code": "ER", + "name": "Eritrea" + }, + { + "code": "LY", + "name": "Libya" + }, + { + "code": "GW", + "name": "GuineaBissau" + }, + { + "code": "GP", + "name": "Guadeloupe" + }, + { + "code": "NO", + "name": "Norway" + }, + { + "code": "TM", + "name": "Turkmenistan" + }, + { + "code": "BY", + "name": "Belarus" + }, + { + "code": "KH", + "name": "Cambodia" + }, + { + "code": "KW", + "name": "Kuwait" + }, + { + "code": "JM", + "name": "Jamaica" + }, + { + "code": "MQ", + "name": "Martinique" + }, + { + "code": "CY", + "name": "Cyprus" + }, + { + "code": "TH", + "name": "Thailand" + }, + { + "code": "CF", + "name": "CentralAfricanRepublic" + }, + { + "code": "PH", + "name": "Philippines" + }, + { + "code": "IO", + "name": "BritishIndianOceanTerritory" + }, + { + "code": "FK", + "name": "FalklandIslandsMalvinas" + }, + { + "code": "EH", + "name": "WesternSahara" + }, + { + "code": "TC", + "name": "TurksAndCaicosIslands" + }, + { + "code": "KN", + "name": "SaintKittsAndNevis" + }, + { + "code": "MW", + "name": "Malawi" + }, + { + "code": "UY", + "name": "Uruguay" + }, + { + "code": "SI", + "name": "Slovenia" + }, + { + "code": "HN", + "name": "Honduras" + }, + { + "code": "PT", + "name": "Portugal" + }, + { + "code": "RO", + "name": "Romania" + }, + { + "code": "BF", + "name": "BurkinaFaso" + }, + { + "code": "GH", + "name": "Ghana" + }, + { + "code": "KP", + "name": "KoreaDemocraticPeoplesRepublic" + }, + { + "code": "CC", + "name": "CocosKeelingIslands" + }, + { + "code": "BE", + "name": "Belgium" + }, + { + "code": "BT", + "name": "Bhutan" + }, + { + "code": "CG", + "name": "Congo" + }, + { + "code": "SX", + "name": "SintMaartenDutchpart" + }, + { + "code": "CL", + "name": "Chile" + }, + { + "code": "DM", + "name": "Dominica" + }, + { + "code": "TF", + "name": "FrenchSouthernTerritories" + }, + { + "code": "MZ", + "name": "Mozambique" + }, + { + "code": "PL", + "name": "Poland" + }, + { + "code": "YE", + "name": "Yemen" + }, + { + "code": "MX", + "name": "Mexico" + }, + { + "code": "AS", + "name": "AmericanSamoa" + }, + { + "code": "TG", + "name": "Togo" + }, + { + "code": "OM", + "name": "Oman" + }, + { + "code": "CH", + "name": "Switzerland" + }, + { + "code": "AD", + "name": "Andorra" + }, + { + "code": "WS", + "name": "Samoa" + }, + { + "code": "TN", + "name": "Tunisia" + }, + { + "code": "GG", + "name": "Guernsey" + }, + { + "code": "SD", + "name": "Sudan" + }, + { + "code": "CD", + "name": "CongoDemocraticRepublic" + }, + { + "code": "CM", + "name": "Cameroon" + }, + { + "code": "CU", + "name": "Cuba" + }, + { + "code": "SY", + "name": "SyrianArabRepublic" + }, + { + "code": "BM", + "name": "Bermuda" + }, + { + "code": "PR", + "name": "PuertoRico" + }, + { + "code": "PK", + "name": "Pakistan" + }, + { + "code": "BI", + "name": "Burundi" + }, + { + "code": "ET", + "name": "Ethiopia" + }, + { + "code": "BJ", + "name": "Benin" + }, + { + "code": "AQ", + "name": "Antarctica" + }, + { + "code": "CX", + "name": "ChristmasIsland" + }, + { + "code": "IE", + "name": "Ireland" + }, + { + "code": "VI", + "name": "VirginIslandsUS" + }, + { + "code": "PM", + "name": "SaintPierreAndMiquelon" + }, + { + "code": "GQ", + "name": "EquatorialGuinea" + }, + { + "code": "IM", + "name": "IsleOfMan" + }, + { + "code": "SA", + "name": "SaudiArabia" + }, + { + "code": "BZ", + "name": "Belize" + }, + { + "code": "CO", + "name": "Colombia" + }, + { + "code": "MT", + "name": "Malta" + }, + { + "code": "AU", + "name": "Australia" + }, + { + "code": "EE", + "name": "Estonia" + }, + { + "code": "NR", + "name": "Nauru" + }, + { + "code": "KR", + "name": "KoreaRepublic" + }, + { + "code": "AZ", + "name": "Azerbaijan" + }, + { + "code": "NG", + "name": "Nigeria" + }, + { + "code": "TW", + "name": "TaiwanProvinceOfChina" + }, + { + "code": "UZ", + "name": "Uzbekistan" + }, + { + "code": "IS", + "name": "Iceland" + }, + { + "code": "BQ", + "name": "BonaireSintEustatiusAndSaba" + }, + { + "code": "MG", + "name": "Madagascar" + }, + { + "code": "MC", + "name": "Monaco" + }, + { + "code": "LK", + "name": "SriLanka" + }, + { + "code": "NF", + "name": "NorfolkIsland" + }, + { + "code": "MM", + "name": "Myanmar" + }, + { + "code": "GS", + "name": "SouthGeorgiaAndTheSouthSandwichIslands" + }, + { + "code": "LI", + "name": "Liechtenstein" + }, + { + "code": "CZ", + "name": "Czechia" + }, + { + "code": "TK", + "name": "Tokelau" + }, + { + "code": "GI", + "name": "Gibraltar" + }, + { + "code": "PS", + "name": "PalestineState" + }, + { + "code": "SG", + "name": "Singapore" + }, + { + "code": "SM", + "name": "SanMarino" + }, + { + "code": "AG", + "name": "AntiguaAndBarbuda" + }, + { + "code": "ZA", + "name": "SouthAfrica" + }, + { + "code": "YT", + "name": "Mayotte" + }, + { + "code": "MP", + "name": "NorthernMarianaIslands" + }, + { + "code": "RW", + "name": "Rwanda" + }, + { + "code": "HK", + "name": "HongKong" + }, + { + "code": "HT", + "name": "Haiti" + }, + { + "code": "PA", + "name": "Panama" + }, + { + "code": "PN", + "name": "Pitcairn" + }, + { + "code": "LT", + "name": "Lithuania" + }, + { + "code": "VA", + "name": "HolySee" + }, + { + "code": "MF", + "name": "SaintMartinFrenchpart" + }, + { + "code": "LC", + "name": "SaintLucia" + }, + { + "code": "GE", + "name": "Georgia" + }, + { + "code": "BB", + "name": "Barbados" + }, + { + "code": "BD", + "name": "Bangladesh" + }, + { + "code": "VN", + "name": "Vietnam" + }, + { + "code": "AX", + "name": "AlandIslands" + }, + { + "code": "TJ", + "name": "Tajikistan" + }, + { + "code": "GU", + "name": "Guam" + }, + { + "code": "FJ", + "name": "Fiji" + }, + { + "code": "BS", + "name": "Bahamas" + }, + { + "code": "PG", + "name": "PapuaNewGuinea" + }, + { + "code": "IQ", + "name": "Iraq" + }, + { + "code": "UG", + "name": "Uganda" + }, + { + "code": "MN", + "name": "Mongolia" + }, + { + "code": "GM", + "name": "Gambia" + }, + { + "code": "UM", + "name": "UnitedStatesMinorOutlyingIslands" + }, + { + "code": "NZ", + "name": "NewZealand" + }, + { + "code": "JE", + "name": "Jersey" + }, + { + "code": "SC", + "name": "Seychelles" + }, + { + "code": "IT", + "name": "Italy" + }, + { + "code": "RE", + "name": "Reunion" + }, + { + "code": "GF", + "name": "FrenchGuiana" + }, + { + "code": "TD", + "name": "Chad" + }, + { + "code": "NC", + "name": "NewCaledonia" + }, + { + "code": "CV", + "name": "CaboVerde" + }, + { + "code": "SL", + "name": "SierraLeone" + }, + { + "code": "GT", + "name": "Guatemala" + }, + { + "code": "KY", + "name": "CaymanIslands" + }, + { + "code": "ID", + "name": "Indonesia" + }, + { + "code": "SR", + "name": "Suriname" + }, + { + "code": "WF", + "name": "WallisAndFutuna" + }, + { + "code": "LA", + "name": "LaoPeoplesDemocraticRepublic" + }, + { + "code": "TT", + "name": "TrinidadAndTobago" + }, + { + "code": "NA", + "name": "Namibia" + }, + { + "code": "ZM", + "name": "Zambia" + }, + { + "code": "SN", + "name": "Senegal" + }, + { + "code": "MA", + "name": "Morocco" + }, + { + "code": "NL", + "name": "Netherlands" + }, + { + "code": "NI", + "name": "Nicaragua" + }, + { + "code": "KG", + "name": "Kyrgyzstan" + }, + { + "code": "MY", + "name": "Malaysia" + }, + { + "code": "TR", + "name": "Turkey" + }, + { + "code": "NE", + "name": "Niger" + }, + { + "code": "MH", + "name": "MarshallIslands" + }, + { + "code": "LR", + "name": "Liberia" + }, + { + "code": "FI", + "name": "Finland" + }, + { + "code": "MD", + "name": "MoldovaRepublic" + }, + { + "code": "ME", + "name": "Montenegro" + }, + { + "code": "AL", + "name": "Albania" + }, + { + "code": "HM", + "name": "HeardIslandAndMcDonaldIslands" + }, + { + "code": "FM", + "name": "MicronesiaFederatedStates" + }, + { + "code": "CR", + "name": "CostaRica" + }, + { + "code": "CW", + "name": "Curacao" + }, + { + "code": "SO", + "name": "Somalia" + }, + { + "code": "MK", + "name": "MacedoniaTheFormerYugoslavRepublic" + }, + { + "code": "TZ", + "name": "TanzaniaUnitedRepublic" + }, + { + "code": "RS", + "name": "Serbia" + }, + { + "code": "KM", + "name": "Comoros" + }, + { + "code": "VG", + "name": "VirginIslandsBritish" + }, + { + "code": "AM", + "name": "Armenia" + }, + { + "code": "BH", + "name": "Bahrain" + }, + { + "code": "BL", + "name": "SaintBarthelemy" + }, + { + "code": "NU", + "name": "Niue" + }, + { + "code": "LU", + "name": "Luxembourg" + }, + { + "code": "MO", + "name": "Macao" + }, + { + "code": "BA", + "name": "BosniaAndHerzegovina" + }, + { + "code": "AF", + "name": "Afghanistan" + }, + { + "code": "EG", + "name": "Egypt" + }, + { + "code": "CK", + "name": "CookIslands" + }, + { + "code": "CA", + "name": "Canada" + }, + { + "code": "SZ", + "name": "Swaziland" + }, + { + "code": "ML", + "name": "Mali" + }, + { + "code": "BR", + "name": "Brazil" + }, + { + "code": "LV", + "name": "Latvia" + }, + { + "code": "TL", + "name": "TimorLeste" + }, + { + "code": "BG", + "name": "Bulgaria" + }, + { + "code": "AT", + "name": "Austria" + }, + { + "code": "KI", + "name": "Kiribati" + }, + { + "code": "IR", + "name": "IranIslamicRepublic" + }, + { + "code": "MV", + "name": "Maldives" + }, + { + "code": "RU", + "name": "RussianFederation" + }, + { + "code": "VE", + "name": "VenezuelaBolivarianRepublic" + }, + { + "code": "AE", + "name": "UnitedArabEmirates" + }, + { + "code": "VC", + "name": "SaintVincentAndTheGrenadines" + }, + { + "code": "MS", + "name": "Montserrat" + }, + { + "code": "AO", + "name": "Angola" + }, + { + "code": "PY", + "name": "Paraguay" + }, + { + "code": "BV", + "name": "BouvetIsland" + }, + { + "code": "DO", + "name": "DominicanRepublic" + }, + { + "code": "SH", + "name": "SaintHelenaAscensionAndTristandaCunha" + }, + { + "code": "ES", + "name": "Spain" + }, + { + "code": "AR", + "name": "Argentina" + }, + { + "code": "LB", + "name": "Lebanon" + }, + { + "code": "PF", + "name": "FrenchPolynesia" + }, + { + "code": "IL", + "name": "Israel" + }, + { + "code": "DJ", + "name": "Djibouti" + }, + { + "code": "DZ", + "name": "Algeria" + }, + { + "code": "TV", + "name": "Tuvalu" + }, + { + "code": "MU", + "name": "Mauritius" + }, + { + "code": "JP", + "name": "Japan" + }, + { + "code": "DK", + "name": "Denmark" + }, + { + "code": "SE", + "name": "Sweden" + }, + { + "code": "CN", + "name": "China" + }, + { + "code": "PE", + "name": "Peru" + }, + { + "code": "BW", + "name": "Botswana" + }, + { + "code": "SV", + "name": "ElSalvador" + }, + { + "code": "CI", + "name": "CotedIvoire" + }, + { + "code": "HR", + "name": "Croatia" + }, + { + "code": "SK", + "name": "Slovakia" + }, + { + "code": "GD", + "name": "Grenada" + }, + { + "code": "SS", + "name": "SouthSudan" + }, + { + "code": "BO", + "name": "BoliviaPlurinationalState" + }, + { + "code": "QA", + "name": "Qatar" + }, + { + "code": "HU", + "name": "Hungary" + }, + { + "code": "SB", + "name": "SolomonIslands" + }, + { + "code": "BN", + "name": "BruneiDarussalam" + }, + { + "code": "GB", + "name": "UnitedKingdomOfGreatBritainAndNorthernIreland" + }, + { + "code": "GL", + "name": "Greenland" + }, + { + "code": "ST", + "name": "SaoTomeAndPrincipe" + }, + { + "code": "GR", + "name": "Greece" + }, + { + "code": "FO", + "name": "FaroeIslands" + }, + { + "code": "SJ", + "name": "SvalbardAndJanMayen" + }, + { + "code": "IN", + "name": "India" + }, + { + "code": "EC", + "name": "Ecuador" + }, + { + "code": "MR", + "name": "Mauritania" + }, + { + "code": "GA", + "name": "Gabon" + }, + { + "code": "DE", + "name": "Germany" + }, + { + "code": "GN", + "name": "Guinea" + } + ] +} +``` +Closes #8977 + +## Checklist + + +- [X] I formatted the code `cargo +nightly fmt --all` +- [X] I addressed lints thrown by `cargo clippy` +- [X] I reviewed the submitted code +- [ ] I added unit tests for my changes where possible +COMMENTS: +- semanticdiff-com[bot]: Review changes with  SemanticDiff +
+Changed Files +
+ +| File | Status | +| :--- | :--- | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8978/changes#crates/router/src/routes/app.rs)  [crates/router/src/routes/app\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8978/changes#crates/router/src/routes/app.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8978/changes#crates/router/src/routes/app.rs)  80% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8978/changes#crates/router/src/routes/payment_methods.rs)  [crates/router/src/routes/payment\_methods\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8978/changes#crates/router/src/routes/payment_methods.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8978/changes#crates/router/src/routes/payment_methods.rs)  0% smaller | + +
+- AnuthaDev [crates/router/src/routes/payment_methods.rs:937]: Add JWT Auth here as well +- sai-harsha-vardhan [crates/router/src/routes/app.rs:1348]: We would have to modify the feature flags on `impl PaymentMethods` right? +Shouldn't it be `#[cfg(all(feature = "v2", any(feature = "olap", feature = "oltp")))]`? If someone enables olap only, the new route is not created as it is under oltp as well which is not expected + +=== COMMIT === +SUBJECT: feat(payment_methods): add payment-methods/filter endpoint to list countries and currencies for connector payment method in v2 (#8978) + +=== FILES === +Summary: 2 files changed, +79 -24 +- crates/router/src/routes/app.rs (+38 -24) +- crates/router/src/routes/payment_methods.rs (+41 -0) + +=== PATCH === +diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs +index cf684a68..1ff441c5 100644 +--- a/crates/router/src/routes/app.rs ++++ b/crates/router/src/routes/app.rs +@@ -1348,38 +1348,52 @@ impl Payouts { + } + } + +-#[cfg(all(feature = "oltp", feature = "v2"))] ++#[cfg(all(feature = "v2", any(feature = "olap", feature = "oltp")))] + impl PaymentMethods { + pub fn server(state: AppState) -> Scope { + let mut route = web::scope("/v2/payment-methods").app_data(web::Data::new(state)); +- route = route +- .service( +- web::resource("").route(web::post().to(payment_methods::create_payment_method_api)), +- ) +- .service( +- web::resource("/create-intent") +- .route(web::post().to(payment_methods::create_payment_method_intent_api)), +- ); + +- route = route.service( +- web::scope("/{id}") ++ #[cfg(feature = "olap")] ++ { ++ route = ++ route.service(web::resource("/filter").route( ++ web::get().to( ++ payment_methods::list_countries_currencies_for_connector_payment_method, ++ ), ++ )); ++ } ++ #[cfg(feature = "oltp")] ++ { ++ route = route + .service( + web::resource("") +- .route(web::get().to(payment_methods::payment_method_retrieve_api)) +- .route(web::delete().to(payment_methods::payment_method_delete_api)), +- ) +- .service(web::resource("/list-enabled-payment-methods").route( +- web::get().to(payment_methods::payment_method_session_list_payment_methods), +- )) +- .service( +- web::resource("/update-saved-payment-method") +- .route(web::put().to(payment_methods::payment_method_update_api)), ++ .route(web::post().to(payment_methods::create_payment_method_api)), + ) + .service( +- web::resource("/get-token") +- .route(web::get().to(payment_methods::get_payment_method_token_data)), +- ), +- ); ++ web::resource("/create-intent") ++ .route(web::post().to(payment_methods::create_payment_method_intent_api)), ++ ); ++ ++ route = route.service( ++ web::scope("/{id}") ++ .service( ++ web::resource("") ++ .route(web::get().to(payment_methods::payment_method_retrieve_api)) ++ .route(web::delete().to(payment_methods::payment_method_delete_api)), ++ ) ++ .service(web::resource("/list-enabled-payment-methods").route( ++ web::get().to(payment_methods::payment_method_session_list_payment_methods), ++ )) ++ .service( ++ web::resource("/update-saved-payment-method") ++ .route(web::put().to(payment_methods::payment_method_update_api)), ++ ) ++ .service( ++ web::resource("/get-token") ++ .route(web::get().to(payment_methods::get_payment_method_token_data)), ++ ), ++ ); ++ } + + route + } +diff --git a/crates/router/src/routes/payment_methods.rs b/crates/router/src/routes/payment_methods.rs +index 367ece30..08b84e40 100644 +--- a/crates/router/src/routes/payment_methods.rs ++++ b/crates/router/src/routes/payment_methods.rs +@@ -913,6 +913,47 @@ pub async fn list_countries_currencies_for_connector_payment_method( + .await + } + ++#[cfg(feature = "v2")] ++#[instrument(skip_all, fields(flow = ?Flow::ListCountriesCurrencies))] ++pub async fn list_countries_currencies_for_connector_payment_method( ++ state: web::Data, ++ req: HttpRequest, ++ query_payload: web::Query, ++) -> HttpResponse { ++ let flow = Flow::ListCountriesCurrencies; ++ let payload = query_payload.into_inner(); ++ Box::pin(api::server_wrap( ++ flow, ++ state, ++ &req, ++ payload, ++ |state, auth: auth::AuthenticationData, req, _| { ++ cards::list_countries_currencies_for_connector_payment_method( ++ state, ++ req, ++ Some(auth.profile.get_id().clone()), ++ ) ++ }, ++ #[cfg(not(feature = "release"))] ++ auth::auth_type( ++ &auth::V2ApiKeyAuth { ++ is_connected_allowed: false, ++ is_platform_allowed: false, ++ }, ++ &auth::JWTAuth { ++ permission: Permission::ProfileConnectorRead, ++ }, ++ req.headers(), ++ ), ++ #[cfg(feature = "release")] ++ &auth::JWTAuth { ++ permission: Permission::ProfileConnectorRead, ++ }, ++ api_locking::LockAction::NotApplicable, ++ )) ++ .await ++} ++ + #[cfg(feature = "v1")] + #[instrument(skip_all, fields(flow = ?Flow::DefaultPaymentMethodsSet))] + pub async fn default_payment_method_set_api( + +----- END CHUNK ----- \ No newline at end of file diff --git a/raw/6d/6d984d4859c349da8ab44914ee0ad37c94ef6e0c.txt b/raw/6d/6d984d4859c349da8ab44914ee0ad37c94ef6e0c.txt new file mode 100644 index 0000000000000000000000000000000000000000..83ac06495b55249396caf863a56e46a6db1aae3a --- /dev/null +++ b/raw/6d/6d984d4859c349da8ab44914ee0ad37c94ef6e0c.txt @@ -0,0 +1,3870 @@ +ROUTE: juspay/hyperswitch@6d984d4859c349da8ab44914ee0ad37c94ef6e0c +REPO: https://github.com/juspay/hyperswitch +COMMIT: 6d984d4859c349da8ab44914ee0ad37c94ef6e0c +AUTHOR: AkshayaFoiger <131388445+AkshayaFoiger@users.noreply.github.com> +DATE: 2025-08-21T14:42:08 + +=== ISSUE_AND_PR === +[PR #8351] feat(connector): add integration status to feature matrix +URL: https://github.com/juspay/hyperswitch/pull/8351 +BODY: +## Type of Change + + +- [ ] Bugfix +- [ ] New feature +- [x] Enhancement +- [ ] Refactoring +- [ ] Dependency updates +- [ ] Documentation +- [ ] CI/CD + +## Description + +This PR, +1. Adds integration status to feature matrix +In the response of the feature matrix query, integration status for each connector is added. + + +2. Fill stripe's feature data + Stripe's feature data is carefully filled by taking reference from https://docs.stripe.com/payments/payment-methods/payment-method-support. In case the payment method being global, all the countries and currencies supported by hyperswitch is considered supported + +3. As Description and connector category is added to the connectors. We have made the supported payment methods optional in the feature matrix response. Have updated cypress_test accordingly + +Screenshot 2025-07-30 at 2 00 42 PM + + + +## How did you test it? + + +The Cypress test case ran by default on this PR. It will help verify the supported capture and payment methods. + +Test for feature matrix. +Ensure if `integration_status` is present in the response of Feature Matrix + +``` +curl --location 'http://localhost:8080/feature_matrix' \ +--header 'Content-Type: application/json' \ +--header 'Accept: application/json' +``` + +Response +``` +{ + "connector_count": 89, + "connectors": [ + { + "name": "ACI", + "display_name": "ACI", + "description": "ACI Payments delivers secure, real-time electronic payment solutions for businesses, banks, and governments, enabling seamless transactions across channels.", + "category": "payment_gateway", + "integration_status": "alpha", + "supported_payment_methods": [ + { + "payment_method": "wallet", + .... +``` + +## Checklist + + +- [x] I formatted the code `cargo +nightly fmt --all` +- [x] I addressed lints thrown by `cargo clippy` +- [x] I reviewed the submitted code +- [ ] I added unit tests for my changes where possible + + + +## Summary by CodeRabbit + +- **New Features** + - Added an integration status indicator for connectors with statuses: "live", "sandbox", "beta", and "alpha". + - Expanded and standardized Stripe payment method filters with detailed country and currency support. + - Introduced multiple new payment methods with specific geographic and currency coverage in configuration files. + +- **Documentation** + - Updated API documentation to include the integration status field and its possible values for connectors. + +COMMENTS: +- semanticdiff-com[bot]: Review changes with  SemanticDiff +
+Changed Files +
+ +| File | Status | +| :--- | :--- | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/router/src/routes/feature_matrix.rs)  [crates/router/src/routes/feature\_matrix\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/router/src/routes/feature_matrix.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/router/src/routes/feature_matrix.rs)  84% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#cypress-tests/cypress/support/commands.js)  [cypress\-tests/cypress/support/commands\.js](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#cypress-tests/cypress/support/commands.js) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#cypress-tests/cypress/support/commands.js)  81% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/openapi/src/openapi.rs)  [crates/openapi/src/openapi\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/openapi/src/openapi.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/openapi/src/openapi.rs)  61% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/openapi/src/openapi_v2.rs)  [crates/openapi/src/openapi\_v2\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/openapi/src/openapi_v2.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/openapi/src/openapi_v2.rs)  61% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/bitpay.rs)  [crates/hyperswitch\_connectors/src/connectors/bitpay\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/bitpay.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/bitpay.rs)  60% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/digitalvirgo.rs)  [crates/hyperswitch\_connectors/src/connectors/digitalvirgo\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/digitalvirgo.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/digitalvirgo.rs)  60% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/bluecode.rs)  [crates/hyperswitch\_connectors/src/connectors/bluecode\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/bluecode.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/bluecode.rs)  60% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/coingate.rs)  [crates/hyperswitch\_connectors/src/connectors/coingate\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/coingate.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/coingate.rs)  60% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/fiuu.rs)  [crates/hyperswitch\_connectors/src/connectors/fiuu\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/fiuu.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/fiuu.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/redsys.rs)  [crates/hyperswitch\_connectors/src/connectors/redsys\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/redsys.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/redsys.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/worldpayvantiv.rs)  [crates/hyperswitch\_connectors/src/connectors/worldpayvantiv\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/worldpayvantiv.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/worldpayvantiv.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/worldpayxml.rs)  [crates/hyperswitch\_connectors/src/connectors/worldpayxml\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/worldpayxml.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/worldpayxml.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/paytm.rs)  [crates/hyperswitch\_connectors/src/connectors/paytm\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/paytm.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/paytm.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/adyen.rs)  [crates/hyperswitch\_connectors/src/connectors/adyen\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/adyen.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/adyen.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/bambora.rs)  [crates/hyperswitch\_connectors/src/connectors/bambora\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/bambora.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/bambora.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/bamboraapac.rs)  [crates/hyperswitch\_connectors/src/connectors/bamboraapac\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/bamboraapac.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/bamboraapac.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/cashtocode.rs)  [crates/hyperswitch\_connectors/src/connectors/cashtocode\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/cashtocode.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/cashtocode.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/checkout.rs)  [crates/hyperswitch\_connectors/src/connectors/checkout\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/checkout.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/checkout.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/coinbase.rs)  [crates/hyperswitch\_connectors/src/connectors/coinbase\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/coinbase.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/coinbase.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/dlocal.rs)  [crates/hyperswitch\_connectors/src/connectors/dlocal\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/dlocal.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/dlocal.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/facilitapay.rs)  [crates/hyperswitch\_connectors/src/connectors/facilitapay\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/facilitapay.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/facilitapay.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/globalpay.rs)  [crates/hyperswitch\_connectors/src/connectors/globalpay\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/globalpay.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/globalpay.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/globepay.rs)  [crates/hyperswitch\_connectors/src/connectors/globepay\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/globepay.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/globepay.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/gocardless.rs)  [crates/hyperswitch\_connectors/src/connectors/gocardless\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/gocardless.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/gocardless.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/helcim.rs)  [crates/hyperswitch\_connectors/src/connectors/helcim\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/helcim.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/helcim.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/iatapay.rs)  [crates/hyperswitch\_connectors/src/connectors/iatapay\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/iatapay.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/iatapay.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/itaubank.rs)  [crates/hyperswitch\_connectors/src/connectors/itaubank\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/itaubank.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/itaubank.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/mifinity.rs)  [crates/hyperswitch\_connectors/src/connectors/mifinity\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/mifinity.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/mifinity.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/mollie.rs)  [crates/hyperswitch\_connectors/src/connectors/mollie\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/mollie.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/mollie.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/nexinets.rs)  [crates/hyperswitch\_connectors/src/connectors/nexinets\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/nexinets.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/nexinets.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/nexixpay.rs)  [crates/hyperswitch\_connectors/src/connectors/nexixpay\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/nexixpay.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/nexixpay.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/nordea.rs)  [crates/hyperswitch\_connectors/src/connectors/nordea\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/nordea.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/nordea.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/nuvei.rs)  [crates/hyperswitch\_connectors/src/connectors/nuvei\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/nuvei.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/nuvei.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/paybox.rs)  [crates/hyperswitch\_connectors/src/connectors/paybox\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/paybox.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/paybox.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/payu.rs)  [crates/hyperswitch\_connectors/src/connectors/payu\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/payu.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/payu.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/phonepe.rs)  [crates/hyperswitch\_connectors/src/connectors/phonepe\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/phonepe.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/phonepe.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/powertranz.rs)  [crates/hyperswitch\_connectors/src/connectors/powertranz\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/powertranz.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/powertranz.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/prophetpay.rs)  [crates/hyperswitch\_connectors/src/connectors/prophetpay\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/prophetpay.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/prophetpay.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/rapyd.rs)  [crates/hyperswitch\_connectors/src/connectors/rapyd\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/rapyd.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/rapyd.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/razorpay.rs)  [crates/hyperswitch\_connectors/src/connectors/razorpay\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/razorpay.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/razorpay.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/shift4.rs)  [crates/hyperswitch\_connectors/src/connectors/shift4\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/shift4.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/shift4.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/square.rs)  [crates/hyperswitch\_connectors/src/connectors/square\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/square.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/square.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/volt.rs)  [crates/hyperswitch\_connectors/src/connectors/volt\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/volt.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/volt.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/worldline.rs)  [crates/hyperswitch\_connectors/src/connectors/worldline\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/worldline.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/worldline.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/zen.rs)  [crates/hyperswitch\_connectors/src/connectors/zen\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/zen.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/zen.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/zsl.rs)  [crates/hyperswitch\_connectors/src/connectors/zsl\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/zsl.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/zsl.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/jpmorgan.rs)  [crates/hyperswitch\_connectors/src/connectors/jpmorgan\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/jpmorgan.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/jpmorgan.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/aci.rs)  [crates/hyperswitch\_connectors/src/connectors/aci\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/aci.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/aci.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/affirm.rs)  [crates/hyperswitch\_connectors/src/connectors/affirm\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/affirm.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/affirm.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/airwallex.rs)  [crates/hyperswitch\_connectors/src/connectors/airwallex\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/airwallex.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/airwallex.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/authipay.rs)  [crates/hyperswitch\_connectors/src/connectors/authipay\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/authipay.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/authipay.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/authorizedotnet.rs)  [crates/hyperswitch\_connectors/src/connectors/authorizedotnet\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/authorizedotnet.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/authorizedotnet.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/billwerk.rs)  [crates/hyperswitch\_connectors/src/connectors/billwerk\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/billwerk.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/billwerk.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/blackhawknetwork.rs)  [crates/hyperswitch\_connectors/src/connectors/blackhawknetwork\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/blackhawknetwork.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/blackhawknetwork.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/bluesnap.rs)  [crates/hyperswitch\_connectors/src/connectors/bluesnap\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/bluesnap.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/bluesnap.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/braintree.rs)  [crates/hyperswitch\_connectors/src/connectors/braintree\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/braintree.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/braintree.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/breadpay.rs)  [crates/hyperswitch\_connectors/src/connectors/breadpay\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/breadpay.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/breadpay.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/checkbook.rs)  [crates/hyperswitch\_connectors/src/connectors/checkbook\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/checkbook.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/checkbook.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/dwolla.rs)  [crates/hyperswitch\_connectors/src/connectors/dwolla\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/dwolla.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/dwolla.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/elavon.rs)  [crates/hyperswitch\_connectors/src/connectors/elavon\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/elavon.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/elavon.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/fiserv.rs)  [crates/hyperswitch\_connectors/src/connectors/fiserv\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/fiserv.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/fiserv.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/flexiti.rs)  [crates/hyperswitch\_connectors/src/connectors/flexiti\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/flexiti.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/flexiti.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/forte.rs)  [crates/hyperswitch\_connectors/src/connectors/forte\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/forte.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/forte.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/getnet.rs)  [crates/hyperswitch\_connectors/src/connectors/getnet\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/getnet.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/getnet.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/hipay.rs)  [crates/hyperswitch\_connectors/src/connectors/hipay\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/hipay.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/hipay.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/katapult.rs)  [crates/hyperswitch\_connectors/src/connectors/katapult\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/katapult.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/katapult.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/klarna.rs)  [crates/hyperswitch\_connectors/src/connectors/klarna\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/klarna.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/klarna.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/moneris.rs)  [crates/hyperswitch\_connectors/src/connectors/moneris\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/moneris.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/moneris.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/mpgs.rs)  [crates/hyperswitch\_connectors/src/connectors/mpgs\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/mpgs.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/mpgs.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/multisafepay.rs)  [crates/hyperswitch\_connectors/src/connectors/multisafepay\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/multisafepay.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/multisafepay.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/novalnet.rs)  [crates/hyperswitch\_connectors/src/connectors/novalnet\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/novalnet.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/novalnet.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/opennode.rs)  [crates/hyperswitch\_connectors/src/connectors/opennode\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/opennode.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/opennode.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/payload.rs)  [crates/hyperswitch\_connectors/src/connectors/payload\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/payload.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/payload.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/paystack.rs)  [crates/hyperswitch\_connectors/src/connectors/paystack\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/paystack.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/paystack.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/placetopay.rs)  [crates/hyperswitch\_connectors/src/connectors/placetopay\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/placetopay.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/placetopay.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/santander.rs)  [crates/hyperswitch\_connectors/src/connectors/santander\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/santander.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/santander.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/sift.rs)  [crates/hyperswitch\_connectors/src/connectors/sift\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/sift.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/sift.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/silverflow.rs)  [crates/hyperswitch\_connectors/src/connectors/silverflow\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/silverflow.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/silverflow.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/stax.rs)  [crates/hyperswitch\_connectors/src/connectors/stax\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/stax.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/stax.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/tokenio.rs)  [crates/hyperswitch\_connectors/src/connectors/tokenio\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/tokenio.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/tokenio.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/trustpayments.rs)  [crates/hyperswitch\_connectors/src/connectors/trustpayments\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/trustpayments.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/trustpayments.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/worldpay.rs)  [crates/hyperswitch\_connectors/src/connectors/worldpay\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/worldpay.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/worldpay.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/xendit.rs)  [crates/hyperswitch\_connectors/src/connectors/xendit\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/xendit.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/xendit.rs)  59% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/barclaycard.rs)  [crates/hyperswitch\_connectors/src/connectors/barclaycard\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/barclaycard.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/barclaycard.rs)  58% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/deutschebank.rs)  [crates/hyperswitch\_connectors/src/connectors/deutschebank\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/deutschebank.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/deutschebank.rs)  58% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/fiservemea.rs)  [crates/hyperswitch\_connectors/src/connectors/fiservemea\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/fiservemea.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/fiservemea.rs)  58% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/inespay.rs)  [crates/hyperswitch\_connectors/src/connectors/inespay\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/inespay.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/inespay.rs)  58% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/tsys.rs)  [crates/hyperswitch\_connectors/src/connectors/tsys\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/tsys.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/tsys.rs)  58% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/wellsfargo.rs)  [crates/hyperswitch\_connectors/src/connectors/wellsfargo\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/wellsfargo.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/wellsfargo.rs)  58% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/celero.rs)  [crates/hyperswitch\_connectors/src/connectors/celero\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/celero.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/celero.rs)  56% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/hyperwallet.rs)  [crates/hyperswitch\_connectors/src/connectors/hyperwallet\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/hyperwallet.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/hyperwallet.rs)  45% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_domain_models/src/router_response_types.rs)  [crates/hyperswitch\_domain\_models/src/router\_response\_types\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_domain_models/src/router_response_types.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_domain_models/src/router_response_types.rs)  44% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/api_models/src/feature_matrix.rs)  [crates/api\_models/src/feature\_matrix\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/api_models/src/feature_matrix.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/api_models/src/feature_matrix.rs)  38% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/adyenplatform.rs)  [crates/hyperswitch\_connectors/src/connectors/adyenplatform\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/adyenplatform.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/adyenplatform.rs)  30% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/ebanx.rs)  [crates/hyperswitch\_connectors/src/connectors/ebanx\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/ebanx.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/ebanx.rs)  30% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/juspaythreedsserver.rs)  [crates/hyperswitch\_connectors/src/connectors/juspaythreedsserver\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/juspaythreedsserver.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/juspaythreedsserver.rs)  30% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/nomupay.rs)  [crates/hyperswitch\_connectors/src/connectors/nomupay\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/nomupay.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/nomupay.rs)  30% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/payone.rs)  [crates/hyperswitch\_connectors/src/connectors/payone\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/payone.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/payone.rs)  30% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/riskified.rs)  [crates/hyperswitch\_connectors/src/connectors/riskified\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/riskified.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/riskified.rs)  30% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/signifyd.rs)  [crates/hyperswitch\_connectors/src/connectors/signifyd\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/signifyd.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/signifyd.rs)  30% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/thunes.rs)  [crates/hyperswitch\_connectors/src/connectors/thunes\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/thunes.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/thunes.rs)  30% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/wellsfargopayout.rs)  [crates/hyperswitch\_connectors/src/connectors/wellsfargopayout\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/wellsfargopayout.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/wellsfargopayout.rs)  30% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/wise.rs)  [crates/hyperswitch\_connectors/src/connectors/wise\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/wise.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/wise.rs)  30% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/taxjar.rs)  [crates/hyperswitch\_connectors/src/connectors/taxjar\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/taxjar.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/taxjar.rs)  27% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/gpayments.rs)  [crates/hyperswitch\_connectors/src/connectors/gpayments\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/gpayments.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/gpayments.rs)  24% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#api-reference/v1/openapi_spec_v1.json)  [api\-reference/v1/openapi\_spec\_v1\.json](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#api-reference/v1/openapi_spec_v1.json) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#api-reference/v1/openapi_spec_v1.json)  19% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#api-reference/v2/openapi_spec_v2.json)  [api\-reference/v2/openapi\_spec\_v2\.json](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#api-reference/v2/openapi_spec_v2.json) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#api-reference/v2/openapi_spec_v2.json)  19% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/threedsecureio.rs)  [crates/hyperswitch\_connectors/src/connectors/threedsecureio\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/threedsecureio.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/threedsecureio.rs)  19% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/netcetera.rs)  [crates/hyperswitch\_connectors/src/connectors/netcetera\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/netcetera.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/netcetera.rs)  19% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/stripe.rs)  [crates/hyperswitch\_connectors/src/connectors/stripe\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/stripe.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/hyperswitch_connectors/src/connectors/stripe.rs)  2% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#config/deployments/integration_test.toml)  [config/deployments/integration\_test\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#config/deployments/integration_test.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#config/deployments/production.toml)  [config/deployments/production\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#config/deployments/production.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#config/deployments/sandbox.toml)  [config/deployments/sandbox\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#config/deployments/sandbox.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#config/development.toml)  [config/development\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#config/development.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#config/docker_compose.toml)  [config/docker\_compose\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#config/docker_compose.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#connector-template/mod.rs)  [connector\-template/mod\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#connector-template/mod.rs) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/common_enums/src/enums.rs)  [crates/common\_enums/src/enums\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/common_enums/src/enums.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/common_enums/src/enums.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/router/src/types/api.rs)  [crates/router/src/types/api\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/router/src/types/api.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/router/src/types/api.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/router/src/types/api/feature_matrix.rs)  [crates/router/src/types/api/feature\_matrix\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/router/src/types/api/feature_matrix.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8351/changes#crates/router/src/types/api/feature_matrix.rs)  0% smaller | + +
+- AkshayaFoiger: @coderabbitai review +- coderabbitai[bot]: +
+✅ Actions performed + +Review triggered. + +> Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused. + +
+- coderabbitai[bot]: + + +## Walkthrough + +This update introduces a new `integration_status` field to connector metadata across the codebase and API schemas. The field, represented by a new enum with values like "live", "sandbox", "beta", and "alpha", is added to connector information structures, OpenAPI specifications, and configuration files, standardizing how integration status is reported and documented. + +## Changes + +| File(s) | Change Summary | +|-----------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------| +| `crates/common_enums/src/enums.rs` | Added new enum `ConnectorIntegrationStatus` with variants: Live, Sandbox, Beta, Alpha. | +| `crates/api_models/src/feature_matrix.rs` | Added optional `integration_status` field to `ConnectorFeatureMatrixResponse` struct. | +| `crates/hyperswitch_domain_models/src/router_response_types.rs` | Added `integration_status` field to `ConnectorInfo` struct. | +| `crates/hyperswitch_connectors/src/connectors/*.rs` | Added `integration_status` field to each connector's static `*_CONNECTOR_INFO` struct, set to the appropriate enum value. | +| `crates/hyperswitch_connectors/src/connectors/stripe.rs` | Implemented detailed `ConnectorSpecifications` for Stripe, including static connector info with `integration_status: Live`. | +| `crates/router/src/routes/feature_matrix.rs` | Modified `build_connector_feature_details` to populate `integration_status` in response. | +| `crates/openapi/src/openapi.rs`, `crates/openapi/src/openapi_v2.rs` | Included `ConnectorIntegrationStatus` enum in OpenAPI schema components for documentation. | +| `api-reference/v1/openapi_spec_v1.json`, `api-reference/v2/openapi_spec_v2.json` | Added `integration_status` property to `ConnectorFeatureMatrixResponse` and defined `ConnectorIntegrationStatus` enum schema. | +| `config/deployments/integration_test.toml`, `config/deployments/production.toml`, `config/deployments/sandbox.toml` | Expanded and standardized Stripe payment method filters to include detailed country and currency lists; added new payment methods. | +| `config/development.toml`, `config/docker_compose.toml` | Restructured and expanded Stripe payment method filters with comprehensive country/currency support and new payment methods. | + +## Sequence Diagram(s) + +```mermaid +sequenceDiagram + participant Client + participant API + participant Connectors + + Client->>API: Request Connector Feature Matrix + API->>Connectors: Retrieve connector metadata + Connectors-->>API: Return metadata (includes integration_status) + API-->>Client: Respond with ConnectorFeatureMatrixResponse (integration_status included) +``` + +```mermaid +sequenceDiagram + participant Developer + participant OpenAPI Spec + + Developer->>OpenAPI Spec: Define/Update ConnectorIntegrationStatus enum + OpenAPI Spec-->>Developer: Expose enum in API schema (integration_status property) +``` + + + + +--- + +
+📜 Recent review details + +**Configuration used: CodeRabbit UI** +**Review profile: CHILL** +**Plan: Pro** + + +
+📥 Commits + +Reviewing files that changed from the base of the PR and between 251c24080b369f58adb66525a6152c587860829d and efc32eaa9469ea9dce8b57abd1ff4e6f1e1ef9f5. + +
+ +
+📒 Files selected for processing (1) + +* `crates/hyperswitch_connectors/src/connectors/stripe.rs` (3 hunks) + +
+ +
+🚧 Files skipped from review as they are similar to previous changes (1) + +* crates/hyperswitch_connectors/src/connectors/stripe.rs + +
+ +
+⏰ Context from checks skipped due to timeout of 900000ms (6) + +* GitHub Check: Run Cypress tests +* GitHub Check: Run tests on stable toolchain (ubuntu-latest) +* GitHub Check: Check compilation for V2 features +* GitHub Check: Check compilation on MSRV toolchain (ubuntu-latest) +* GitHub Check: Validate generated OpenAPI spec file +* GitHub Check: Check wasm build + +
+ +
+ + + + + + + + +
+✨ Finishing Touches + +- [ ] 📝 Generate Docstrings + +
+ + + + +--- + + + +
+🪧 Tips + +### Chat + +There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=juspay/hyperswitch&utm_content=8351): + +- Review comments: Directly reply to a review comment made by CodeRabbit. Example: + - `I pushed a fix in commit , please review it.` + - `Explain this complex logic.` + - `Open a follow-up GitHub issue for this discussion.` +- Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples: + - `@coderabbitai explain this code block.` + - `@coderabbitai modularize this function.` +- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples: + - `@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.` + - `@coderabbitai read src/utils.ts and explain its main purpose.` + - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.` + - `@coderabbitai help me debug CodeRabbit configuration file.` + +### Support + +Need help? Create a ticket on our [support page](https://www.coderabbit.ai/contact-us/support) for assistance with any issues or questions. + +Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. + +### CodeRabbit Commands (Invoked using PR comments) + +- `@coderabbitai pause` to pause the reviews on a PR. +- `@coderabbitai resume` to resume the paused reviews. +- `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository. +- `@coderabbitai full review` to do a full review from scratch and review all the files again. +- `@coderabbitai summary` to regenerate the summary of the PR. +- `@coderabbitai generate docstrings` to [generate docstrings](https://docs.coderabbit.ai/finishing-touches/docstrings) for this PR. +- `@coderabbitai generate sequence diagram` to generate a sequence diagram of the changes in this PR. +- `@coderabbitai resolve` resolve all the CodeRabbit review comments. +- `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository. +- `@coderabbitai help` to get help. + +### Other keywords and placeholders + +- Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. +- Add `@coderabbitai summary` to generate the high-level summary at a specific location in the PR description. +- Add `@coderabbitai` anywhere in the PR title to generate the title automatically. + +### CodeRabbit Configuration File (`.coderabbit.yaml`) + +- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository. +- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information. +- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json` + +### Documentation and Community + +- Visit our [Documentation](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit. +- Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback. +- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements. + +
+ + +- AkshayaFoiger: @coderabbitai review +- coderabbitai[bot]: +
+✅ Actions performed + +Review triggered. + +> Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused. + +
+- coderabbitai[bot] [crates/hyperswitch_connectors/src/connectors/stripe.rs:3156]: _⚠️ Potential issue_ + +
+🧩 Verification correct + +**Remove duplicate payment method entries to avoid configuration conflicts.** + +The following payment methods have duplicate entries in the static initialization: + +1. **AmazonPay** (lines 2858-2878): Identical duplicate entries +2. **WeChatPay** (lines 2902-2911, 2936-2944): Different mandate support (NotSupported vs Supported) +3. **Multibanco** (lines 3045-3065): Identical duplicate entries +4. **Giropay** (lines 3067-3087): Different refund support (NotSupported vs Supported) +5. **OnlineBankingFpx** (lines 3122-3142): Identical duplicate entries + +These duplicates could lead to undefined behavior or configuration conflicts. For payment methods with different feature support, it's unclear which configuration will take precedence. + + + + +Let me verify the behavior of the `SupportedPaymentMethods::add` method to understand how it handles duplicates: + +--- + +🏁 Script executed: + +```shell +#!/bin/bash +# Search for the SupportedPaymentMethods type and its add method implementation +ast-grep --pattern 'struct SupportedPaymentMethods { + $$$ +}' + +# Search for the add method implementation +ast-grep --pattern 'impl $_ for SupportedPaymentMethods { + $$$ + fn add($$$) { + $$$ + } + $$$ +}' + +# Alternative search for add method +rg -A 10 "impl.*SupportedPaymentMethods" +rg -A 5 "fn add.*PaymentMethod.*PaymentMethodType" +``` + +Length of output: 3314 + +--- + + + +
+ +**Remove duplicate payment method entries to avoid configuration conflicts.** + +The following payment methods have duplicate entries in the static initialization: + +1. **AmazonPay** (lines 2858-2878): Identical duplicate entries +2. **WeChatPay** (lines 2902-2911, 2936-2944): Different mandate support (NotSupported vs Supported) +3. **Multibanco** (lines 3045-3065): Identical duplicate entries +4. **Giropay** (lines 3067-3087): Different refund support (NotSupported vs Supported) +5. **OnlineBankingFpx** (lines 3122-3142): Identical duplicate entries + +These duplicates could lead to undefined behavior or configuration conflicts. For payment methods with different feature support, it's unclear which configuration will take precedence. + + + + +Let me verify the behavior of the `SupportedPaymentMethods::add` method to understand how it handles duplicates: + +```shell +#!/bin/bash +# Search for the SupportedPaymentMethods type and its add method implementation +ast-grep --pattern 'struct SupportedPaymentMethods { + $$$ +}' + +# Search for the add method implementation +ast-grep --pattern 'impl $_ for SupportedPaymentMethods { + $$$ + fn add($$$) { + $$$ + } + $$$ +}' + +# Alternative search for add method +rg -A 10 "impl.*SupportedPaymentMethods" +rg -A 5 "fn add.*PaymentMethod.*PaymentMethodType" +``` + +
+🤖 Prompt for AI Agents + +``` +In crates/hyperswitch_connectors/src/connectors/stripe.rs between lines 2754 and +3156, there are duplicate entries for several payment methods such as AmazonPay, +WeChatPay, Multibanco, Giropay, and OnlineBankingFpx, some with conflicting +feature support. To fix this, remove the duplicate entries entirely and for +those with conflicting configurations, consolidate them into a single entry that +accurately reflects the intended feature support. Ensure each payment method and +type combination appears only once in the SupportedPaymentMethods initialization +to prevent configuration conflicts. +``` + +
+ + +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/stripe.rs:2780]: We support mandates in stripe ? +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/stripe.rs:2787]: We support non 3ds transactions as well +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/stripe.rs:2787]: Same for debit cards +- AkshayaFoiger [crates/hyperswitch_connectors/src/connectors/stripe.rs:2780]: Yes, we support mandates in stripe. I will update it +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/wise.rs:703]: Wrong description. Can we please check for all psp's in this pr + +=== COMMIT === +SUBJECT: feat(connector): add integration status to feature matrix (#8351) +BODY: +Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> + +=== FILES === +Summary: 119 files changed, +1499 -213 +- api-reference/v1/openapi_spec_v1.json (+35 -21) +- api-reference/v2/openapi_spec_v2.json (+35 -21) +- config/deployments/integration_test.toml (+15 -1) +- config/deployments/production.toml (+14 -1) +- config/deployments/sandbox.toml (+14 -1) +- config/development.toml (+16 -3) +- config/docker_compose.toml (+24 -0) +- connector-template/mod.rs (+1 -1) +- crates/api_models/src/feature_matrix.rs (+8 -5) +- crates/common_enums/src/enums.rs (+31 -1) +- crates/hyperswitch_connectors/src/connectors/aci.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/adyen.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/adyenplatform.rs (+23 -2) +- crates/hyperswitch_connectors/src/connectors/affirm.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/airwallex.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/authipay.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/authorizedotnet.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/bambora.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/bamboraapac.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/barclaycard.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/billwerk.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/bitpay.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/blackhawknetwork.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/bluecode.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/bluesnap.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/braintree.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/breadpay.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/cashtocode.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/celero.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/checkbook.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/checkout.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/coinbase.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/coingate.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/deutschebank.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/digitalvirgo.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/dlocal.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/dwolla.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/ebanx.rs (+23 -2) +- crates/hyperswitch_connectors/src/connectors/elavon.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/facilitapay.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/fiserv.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/fiservemea.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/fiuu.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/flexiti.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/forte.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/getnet.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/globalpay.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/globepay.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/gocardless.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/gpayments.rs (+22 -2) +- crates/hyperswitch_connectors/src/connectors/helcim.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/hipay.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/hyperwallet.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/iatapay.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/inespay.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/itaubank.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/jpmorgan.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/juspaythreedsserver.rs (+23 -2) +- crates/hyperswitch_connectors/src/connectors/katapult.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/klarna.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/mifinity.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/mollie.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/moneris.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/mpgs.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/multisafepay.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/netcetera.rs (+22 -2) +- crates/hyperswitch_connectors/src/connectors/nexinets.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/nexixpay.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/nomupay.rs (+23 -2) +- crates/hyperswitch_connectors/src/connectors/nordea.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/novalnet.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/nuvei.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/opennode.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/paybox.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/payload.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/payone.rs (+23 -2) +- crates/hyperswitch_connectors/src/connectors/paystack.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/paytm.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/payu.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/phonepe.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/placetopay.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/powertranz.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/prophetpay.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/rapyd.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/razorpay.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/redsys.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/riskified.rs (+23 -2) +- crates/hyperswitch_connectors/src/connectors/santander.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/shift4.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/sift.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/signifyd.rs (+23 -2) +- crates/hyperswitch_connectors/src/connectors/silverflow.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/square.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/stax.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/stripe.rs (+379 -4) +- crates/hyperswitch_connectors/src/connectors/taxjar.rs (+22 -2) +- crates/hyperswitch_connectors/src/connectors/threedsecureio.rs (+22 -2) +- crates/hyperswitch_connectors/src/connectors/thunes.rs (+23 -2) +- crates/hyperswitch_connectors/src/connectors/tokenio.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/trustpayments.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/tsys.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/volt.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/wellsfargo.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/wellsfargopayout.rs (+23 -2) +- crates/hyperswitch_connectors/src/connectors/wise.rs (+23 -2) +- crates/hyperswitch_connectors/src/connectors/worldline.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/worldpay.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/worldpayvantiv.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/worldpayxml.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/xendit.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/zen.rs (+2 -1) +- crates/hyperswitch_connectors/src/connectors/zsl.rs (+2 -1) +- crates/hyperswitch_domain_models/src/router_response_types.rs (+3 -1) +- crates/openapi/src/openapi.rs (+2 -1) +- crates/openapi/src/openapi_v2.rs (+2 -1) +- crates/router/src/routes/feature_matrix.rs (+36 -34) +- crates/router/src/types/api.rs (+1 -0) +- crates/router/src/types/api/feature_matrix.rs (+390 -0) +- cypress-tests/cypress/support/commands.js (+1 -2) + +=== PATCH === +diff --git a/api-reference/v1/openapi_spec_v1.json b/api-reference/v1/openapi_spec_v1.json +index eaab79a7..83ec5821 100644 +--- a/api-reference/v1/openapi_spec_v1.json ++++ b/api-reference/v1/openapi_spec_v1.json +@@ -11957,7 +11957,10 @@ + "type": "object", + "required": [ + "name", +- "supported_payment_methods" ++ "display_name", ++ "description", ++ "category", ++ "integration_status" + ], + "properties": { + "name": { +@@ -11966,28 +11969,25 @@ + }, + "display_name": { + "type": "string", +- "description": "The display name of the connector", +- "nullable": true ++ "description": "The display name of the connector" + }, + "description": { + "type": "string", +- "description": "The description of the connector", +- "nullable": true ++ "description": "The description of the connector" + }, + "category": { +- "allOf": [ +- { +- "$ref": "#/components/schemas/PaymentConnectorCategory" +- } +- ], +- "nullable": true ++ "$ref": "#/components/schemas/HyperswitchConnectorCategory" ++ }, ++ "integration_status": { ++ "$ref": "#/components/schemas/ConnectorIntegrationStatus" + }, + "supported_payment_methods": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SupportedPaymentMethod" + }, +- "description": "The list of payment methods supported by the connector" ++ "description": "The list of payment methods supported by the connector", ++ "nullable": true + }, + "supported_webhook_flows": { + "type": "array", +@@ -11999,6 +11999,16 @@ + } + } + }, ++ "ConnectorIntegrationStatus": { ++ "type": "string", ++ "description": "Connector Integration Status", ++ "enum": [ ++ "live", ++ "sandbox", ++ "beta", ++ "alpha" ++ ] ++ }, + "ConnectorMetadata": { + "type": "object", + "description": "Some connectors like Apple Pay, Airwallex and Noon might require some additional information, find specific details in the child attributes below.", +@@ -16600,6 +16610,19 @@ + } + } + }, ++ "HyperswitchConnectorCategory": { ++ "type": "string", ++ "description": "Connector Access Method", ++ "enum": [ ++ "payment_gateway", ++ "alternative_payment_method", ++ "bank_acquirer", ++ "payout_processor", ++ "authentication_provider", ++ "fraud_and_risk_management_provider", ++ "tax_calculation_provider" ++ ] ++ }, + "IfStatement": { + "type": "object", + "description": "Represents an IF statement with conditions and optional nested IF statements\n\n```text\npayment.method = card {\npayment.method.cardtype = (credit, debit) {\npayment.method.network = (amex, rupay, diners)\n}\n}\n```", +@@ -20362,15 +20385,6 @@ + } + ] + }, +- "PaymentConnectorCategory": { +- "type": "string", +- "description": "Connector Access Method", +- "enum": [ +- "payment_gateway", +- "alternative_payment_method", +- "bank_acquirer" +- ] +- }, + "PaymentCreatePaymentLinkConfig": { + "allOf": [ + { +diff --git a/api-reference/v2/openapi_spec_v2.json b/api-reference/v2/openapi_spec_v2.json +index 5d302db6..d7d67a6d 100644 +--- a/api-reference/v2/openapi_spec_v2.json ++++ b/api-reference/v2/openapi_spec_v2.json +@@ -8501,7 +8501,10 @@ + "type": "object", + "required": [ + "name", +- "supported_payment_methods" ++ "display_name", ++ "description", ++ "category", ++ "integration_status" + ], + "properties": { + "name": { +@@ -8510,28 +8513,25 @@ + }, + "display_name": { + "type": "string", +- "description": "The display name of the connector", +- "nullable": true ++ "description": "The display name of the connector" + }, + "description": { + "type": "string", +- "description": "The description of the connector", +- "nullable": true ++ "description": "The description of the connector" + }, + "category": { +- "allOf": [ +- { +- "$ref": "#/components/schemas/PaymentConnectorCategory" +- } +- ], +- "nullable": true ++ "$ref": "#/components/schemas/HyperswitchConnectorCategory" ++ }, ++ "integration_status": { ++ "$ref": "#/components/schemas/ConnectorIntegrationStatus" + }, + "supported_payment_methods": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SupportedPaymentMethod" + }, +- "description": "The list of payment methods supported by the connector" ++ "description": "The list of payment methods supported by the connector", ++ "nullable": true + }, + "supported_webhook_flows": { + "type": "array", +@@ -8543,6 +8543,16 @@ + } + } + }, ++ "ConnectorIntegrationStatus": { ++ "type": "string", ++ "description": "Connector Integration Status", ++ "enum": [ ++ "live", ++ "sandbox", ++ "beta", ++ "alpha" ++ ] ++ }, + "ConnectorMetadata": { + "type": "object", + "description": "Some connectors like Apple Pay, Airwallex and Noon might require some additional information, find specific details in the child attributes below.", +@@ -12746,6 +12756,19 @@ + } + } + }, ++ "HyperswitchConnectorCategory": { ++ "type": "string", ++ "description": "Connector Access Method", ++ "enum": [ ++ "payment_gateway", ++ "alternative_payment_method", ++ "bank_acquirer", ++ "payout_processor", ++ "authentication_provider", ++ "fraud_and_risk_management_provider", ++ "tax_calculation_provider" ++ ] ++ }, + "HyperswitchVaultSessionDetails": { + "type": "object", + "required": [ +@@ -16391,15 +16414,6 @@ + } + ] + }, +- "PaymentConnectorCategory": { +- "type": "string", +- "description": "Connector Access Method", +- "enum": [ +- "payment_gateway", +- "alternative_payment_method", +- "bank_acquirer" +- ] +- }, + "PaymentConnectorTransmission": { + "type": "string", + "enum": [ +diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml +index e1d1b477..a8c1fcfd 100644 +--- a/config/deployments/integration_test.toml ++++ b/config/deployments/integration_test.toml +@@ -485,6 +485,8 @@ debit = { country = "US", currency = "USD" } + ach = { country = "US", currency = "USD" } + + [pm_filters.stripe] ++credit = { country = "AF,AX,AL,DZ,AS,AD,AO,AI,AQ,AG,AR,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BY,BE,BZ,BJ,BM,BT,BO,BQ,BA,BW,BV,BR,IO,BN,BG,BF,BI,KH,CM,CA,CV,KY,CF,TD,CL,CN,CX,CC,CO,KM,CG,CD,CK,CR,CI,HR,CU,CW,CY,CZ,DK,DJ,DM,DO,EC,EG,SV,GQ,ER,EE,ET,FK,FO,FJ,FI,FR,GF,PF,TF,GA,GM,GE,DE,GH,GI,GR,GL,GD,GP,GU,GT,GG,GN,GW,GY,HT,HM,VA,HN,HK,HU,IS,IN,ID,IR,IQ,IE,IM,IL,IT,JM,JP,JE,JO,KZ,KE,KI,KP,KR,KW,KG,LA,LV,LB,LS,LR,LY,LI,LT,LU,MO,MK,MG,MW,MY,MV,ML,MT,MH,MQ,MR,MU,YT,MX,FM,MD,MC,MN,ME,MS,MA,MZ,MM,NA,NR,NP,NL,NC,NZ,NI,NE,NG,NU,NF,MP,NO,OM,PK,PW,PS,PA,PG,PY,PE,PH,PN,PL,PT,PR,QA,RE,RO,RU,RW,BL,SH,KN,LC,MF,PM,VC,WS,SM,ST,SA,SN,RS,SC,SL,SG,SX,SK,SI,SB,SO,ZA,GS,SS,ES,LK,SD,SR,SJ,SZ,SE,CH,SY,TW,TJ,TZ,TH,TL,TG,TK,TO,TT,TN,TR,TM,TC,TV,UG,UA,AE,GB,UM,UY,UZ,VU,VE,VN,VG,VI,WF,EH,YE,ZM,ZW,US", currency = "AED,AFN,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,BYN,BZD,CAD,CDF,CHF,CLF,CLP,CNY,COP,CRC,CUC,CUP,CVE,CZK,DJF,DKK,DOP,DZD,EGP,ERN,ETB,EUR,FJD,FKP,GBP,GEL,GHS,GIP,GMD,GNF,GTQ,GYD,HKD,HNL,HRK,HTG,HUF,IDR,ILS,INR,IQD,IRR,ISK,JMD,JOD,JPY,KES,KGS,KHR,KMF,KPW,KRW,KWD,KYD,KZT,LAK,LBP,LKR,LRD,LSL,LYD,MAD,MDL,MGA,MKD,MMK,MNT,MOP,MRU,MUR,MVR,MWK,MXN,MYR,MZN,NAD,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SDG,SEK,SGD,SHP,SLE,SLL,SOS,SRD,SSP,STD,STN,SVC,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW,ZWL"} ++debit = { country = "AF,AX,AL,DZ,AS,AD,AO,AI,AQ,AG,AR,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BY,BE,BZ,BJ,BM,BT,BO,BQ,BA,BW,BV,BR,IO,BN,BG,BF,BI,KH,CM,CA,CV,KY,CF,TD,CL,CN,CX,CC,CO,KM,CG,CD,CK,CR,CI,HR,CU,CW,CY,CZ,DK,DJ,DM,DO,EC,EG,SV,GQ,ER,EE,ET,FK,FO,FJ,FI,FR,GF,PF,TF,GA,GM,GE,DE,GH,GI,GR,GL,GD,GP,GU,GT,GG,GN,GW,GY,HT,HM,VA,HN,HK,HU,IS,IN,ID,IR,IQ,IE,IM,IL,IT,JM,JP,JE,JO,KZ,KE,KI,KP,KR,KW,KG,LA,LV,LB,LS,LR,LY,LI,LT,LU,MO,MK,MG,MW,MY,MV,ML,MT,MH,MQ,MR,MU,YT,MX,FM,MD,MC,MN,ME,MS,MA,MZ,MM,NA,NR,NP,NL,NC,NZ,NI,NE,NG,NU,NF,MP,NO,OM,PK,PW,PS,PA,PG,PY,PE,PH,PN,PL,PT,PR,QA,RE,RO,RU,RW,BL,SH,KN,LC,MF,PM,VC,WS,SM,ST,SA,SN,RS,SC,SL,SG,SX,SK,SI,SB,SO,ZA,GS,SS,ES,LK,SD,SR,SJ,SZ,SE,CH,SY,TW,TJ,TZ,TH,TL,TG,TK,TO,TT,TN,TR,TM,TC,TV,UG,UA,AE,GB,UM,UY,UZ,VU,VE,VN,VG,VI,WF,EH,YE,ZM,ZW,US", currency = "AED,AFN,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,BYN,BZD,CAD,CDF,CHF,CLF,CLP,CNY,COP,CRC,CUC,CUP,CVE,CZK,DJF,DKK,DOP,DZD,EGP,ERN,ETB,EUR,FJD,FKP,GBP,GEL,GHS,GIP,GMD,GNF,GTQ,GYD,HKD,HNL,HRK,HTG,HUF,IDR,ILS,INR,IQD,IRR,ISK,JMD,JOD,JPY,KES,KGS,KHR,KMF,KPW,KRW,KWD,KYD,KZT,LAK,LBP,LKR,LRD,LSL,LYD,MAD,MDL,MGA,MKD,MMK,MNT,MOP,MRU,MUR,MVR,MWK,MXN,MYR,MZN,NAD,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SDG,SEK,SGD,SHP,SLE,SLL,SOS,SRD,SSP,STD,STN,SVC,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW,ZWL"} + affirm = { country = "US", currency = "USD" } + afterpay_clearpay = { country = "US,CA,GB,AU,NZ,FR,ES", currency = "USD,CAD,GBP,AUD,NZD" } + apple_pay.country = "AU, AT, BE, BR, BG, CA, HR, CY, CZ, DK, EE, FI, FR, DE, GR, HU, HK, IE, IT, JP, LV, LI, LT, LU, MT, MY, MX, NL, NZ, NO, PL, PT, RO, SK, SG, SI, ZA, ES, SE, CH, GB, AE, US" +@@ -494,8 +496,20 @@ giropay = { country = "DE", currency = "EUR" } + google_pay.country = "AU, AT, BE, BR, BG, CA, HR, CZ, DK, EE, FI, FR, DE, GR, HK, HU, IN, ID, IE, IT, JP, LV, KE, LT, LU, MY, MX, NL, NZ, NO, PL, PT, RO, SG, SK, ZA, ES, SE, CH, TH, AE, GB, US" + ideal = { country = "NL", currency = "EUR" } + klarna = { country = "AU,AT,BE,CA,CZ,DK,FI,FR,DE,GR,IE,IT,NL,NZ,NO,PL,PT,ES,SE,CH,GB,US", currency = "AUD,CAD,CHF,CZK,DKK,EUR,GBP,NOK,NZD,PLN,SEK,USD" } +-multibanco = { country = "PT", currency = "EUR" } ++multibanco = { country = "AT,BE,BG,HR,CY,CZ,DK,EE,FI,FR,DE,GI,GR,HU,IE,IT,LV,LI,LT,LU,MT,NL,NO,PL,PT,RO,SK,SI,ES,SE,CH,GB", currency = "EUR" } + ach = { country = "US", currency = "USD" } ++revolut_pay = { currency = "EUR,GBP" } ++sepa = {country = "AT,BE,BG,HR,CY,CZ,DK,EE,FI,FR,DE,GI,GR,HU,IE,IT,LV,LI,LT,LU,MT,NL,NO,PL,PT,RO,SK,SI,ES,SE,CH,GB,IS,LI", currency="EUR"} ++bacs = { country = "GB", currency = "GBP" } ++becs = { country = "AU", currency = "AUD" } ++sofort = {country = "AT,BE,BG,HR,CY,CZ,DK,EE,FI,FR,DE,GR,HU,IS,IE,IT,LV,LI,LT,LU,MT,NL,NO,PL,PT,RO,SK,SI,ES,SE", currency = "EUR" } ++blik = {country="PL", currency = "PLN"} ++bancontact_card = { country = "BE", currency = "EUR" } ++przelewy24 = { country = "PL", currency = "EUR,PLN" } ++online_banking_fpx = { country = "MY", currency = "MYR" } ++amazon_pay = { country = "AF,AX,AL,DZ,AS,AD,AO,AI,AQ,AG,AR,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BY,BE,BZ,BJ,BM,BT,BO,BQ,BA,BW,BV,BR,IO,BN,BG,BF,BI,KH,CM,CA,CV,KY,CF,TD,CL,CN,CX,CC,CO,KM,CG,CD,CK,CR,CI,HR,CU,CW,CY,CZ,DK,DJ,DM,DO,EC,EG,SV,GQ,ER,EE,ET,FK,FO,FJ,FI,FR,GF,PF,TF,GA,GM,GE,DE,GH,GI,GR,GL,GD,GP,GU,GT,GG,GN,GW,GY,HT,HM,VA,HN,HK,HU,IS,IN,ID,IR,IQ,IE,IM,IL,IT,JM,JP,JE,JO,KZ,KE,KI,KP,KR,KW,KG,LA,LV,LB,LS,LR,LY,LI,LT,LU,MO,MK,MG,MW,MY,MV,ML,MT,MH,MQ,MR,MU,YT,MX,FM,MD,MC,MN,ME,MS,MA,MZ,MM,NA,NR,NP,NL,NC,NZ,NI,NE,NG,NU,NF,MP,NO,OM,PK,PW,PS,PA,PG,PY,PE,PH,PN,PL,PT,PR,QA,RE,RO,RU,RW,BL,SH,KN,LC,MF,PM,VC,WS,SM,ST,SA,SN,RS,SC,SL,SG,SX,SK,SI,SB,SO,ZA,GS,SS,ES,LK,SD,SR,SJ,SZ,SE,CH,SY,TW,TJ,TZ,TH,TL,TG,TK,TO,TT,TN,TR,TM,TC,TV,UG,UA,AE,GB,UM,UY,UZ,VU,VE,VN,VG,VI,WF,EH,YE,ZM,ZW,US", currency = "USD,AUD,GBP,DKK,EUR,HKD,JPY,NZD,NOK,ZAR,SEK,CHF" } ++we_chat_pay = { country = "CN", currency = "CNY,AUD,CAD,EUR,GBP,HKD,JPY,SGD,USD,DKK,NOK,SEK,CHF" } ++ali_pay = {country = "CN", currency = "AUD,CAD,CNY,EUR,GBP,HKD,JPY,MYR,NZD,SGD,USD"} + + [pm_filters.cybersource] + credit = { currency = "USD,GBP,EUR,PLN,SEK,XOF" } +diff --git a/config/deployments/production.toml b/config/deployments/production.toml +index 595143f0..1900a06f 100644 +--- a/config/deployments/production.toml ++++ b/config/deployments/production.toml +@@ -594,6 +594,8 @@ debit = { country = "US", currency = "USD" } + ach = { country = "US", currency = "USD" } + + [pm_filters.stripe] ++credit = { country = "AF,AX,AL,DZ,AS,AD,AO,AI,AQ,AG,AR,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BY,BE,BZ,BJ,BM,BT,BO,BQ,BA,BW,BV,BR,IO,BN,BG,BF,BI,KH,CM,CA,CV,KY,CF,TD,CL,CN,CX,CC,CO,KM,CG,CD,CK,CR,CI,HR,CU,CW,CY,CZ,DK,DJ,DM,DO,EC,EG,SV,GQ,ER,EE,ET,FK,FO,FJ,FI,FR,GF,PF,TF,GA,GM,GE,DE,GH,GI,GR,GL,GD,GP,GU,GT,GG,GN,GW,GY,HT,HM,VA,HN,HK,HU,IS,IN,ID,IR,IQ,IE,IM,IL,IT,JM,JP,JE,JO,KZ,KE,KI,KP,KR,KW,KG,LA,LV,LB,LS,LR,LY,LI,LT,LU,MO,MK,MG,MW,MY,MV,ML,MT,MH,MQ,MR,MU,YT,MX,FM,MD,MC,MN,ME,MS,MA,MZ,MM,NA,NR,NP,NL,NC,NZ,NI,NE,NG,NU,NF,MP,NO,OM,PK,PW,PS,PA,PG,PY,PE,PH,PN,PL,PT,PR,QA,RE,RO,RU,RW,BL,SH,KN,LC,MF,PM,VC,WS,SM,ST,SA,SN,RS,SC,SL,SG,SX,SK,SI,SB,SO,ZA,GS,SS,ES,LK,SD,SR,SJ,SZ,SE,CH,SY,TW,TJ,TZ,TH,TL,TG,TK,TO,TT,TN,TR,TM,TC,TV,UG,UA,AE,GB,UM,UY,UZ,VU,VE,VN,VG,VI,WF,EH,YE,ZM,ZW,US", currency = "AED,AFN,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,BYN,BZD,CAD,CDF,CHF,CLF,CLP,CNY,COP,CRC,CUC,CUP,CVE,CZK,DJF,DKK,DOP,DZD,EGP,ERN,ETB,EUR,FJD,FKP,GBP,GEL,GHS,GIP,GMD,GNF,GTQ,GYD,HKD,HNL,HRK,HTG,HUF,IDR,ILS,INR,IQD,IRR,ISK,JMD,JOD,JPY,KES,KGS,KHR,KMF,KPW,KRW,KWD,KYD,KZT,LAK,LBP,LKR,LRD,LSL,LYD,MAD,MDL,MGA,MKD,MMK,MNT,MOP,MRU,MUR,MVR,MWK,MXN,MYR,MZN,NAD,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SDG,SEK,SGD,SHP,SLE,SLL,SOS,SRD,SSP,STD,STN,SVC,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW,ZWL"} ++debit = { country = "AF,AX,AL,DZ,AS,AD,AO,AI,AQ,AG,AR,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BY,BE,BZ,BJ,BM,BT,BO,BQ,BA,BW,BV,BR,IO,BN,BG,BF,BI,KH,CM,CA,CV,KY,CF,TD,CL,CN,CX,CC,CO,KM,CG,CD,CK,CR,CI,HR,CU,CW,CY,CZ,DK,DJ,DM,DO,EC,EG,SV,GQ,ER,EE,ET,FK,FO,FJ,FI,FR,GF,PF,TF,GA,GM,GE,DE,GH,GI,GR,GL,GD,GP,GU,GT,GG,GN,GW,GY,HT,HM,VA,HN,HK,HU,IS,IN,ID,IR,IQ,IE,IM,IL,IT,JM,JP,JE,JO,KZ,KE,KI,KP,KR,KW,KG,LA,LV,LB,LS,LR,LY,LI,LT,LU,MO,MK,MG,MW,MY,MV,ML,MT,MH,MQ,MR,MU,YT,MX,FM,MD,MC,MN,ME,MS,MA,MZ,MM,NA,NR,NP,NL,NC,NZ,NI,NE,NG,NU,NF,MP,NO,OM,PK,PW,PS,PA,PG,PY,PE,PH,PN,PL,PT,PR,QA,RE,RO,RU,RW,BL,SH,KN,LC,MF,PM,VC,WS,SM,ST,SA,SN,RS,SC,SL,SG,SX,SK,SI,SB,SO,ZA,GS,SS,ES,LK,SD,SR,SJ,SZ,SE,CH,SY,TW,TJ,TZ,TH,TL,TG,TK,TO,TT,TN,TR,TM,TC,TV,UG,UA,AE,GB,UM,UY,UZ,VU,VE,VN,VG,VI,WF,EH,YE,ZM,ZW,US", currency = "AED,AFN,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,BYN,BZD,CAD,CDF,CHF,CLF,CLP,CNY,COP,CRC,CUC,CUP,CVE,CZK,DJF,DKK,DOP,DZD,EGP,ERN,ETB,EUR,FJD,FKP,GBP,GEL,GHS,GIP,GMD,GNF,GTQ,GYD,HKD,HNL,HRK,HTG,HUF,IDR,ILS,INR,IQD,IRR,ISK,JMD,JOD,JPY,KES,KGS,KHR,KMF,KPW,KRW,KWD,KYD,KZT,LAK,LBP,LKR,LRD,LSL,LYD,MAD,MDL,MGA,MKD,MMK,MNT,MOP,MRU,MUR,MVR,MWK,MXN,MYR,MZN,NAD,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SDG,SEK,SGD,SHP,SLE,SLL,SOS,SRD,SSP,STD,STN,SVC,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW,ZWL"} + affirm = { country = "US", currency = "USD" } + afterpay_clearpay = { country = "US,CA,GB,AU,NZ,FR,ES", currency = "USD,CAD,GBP,AUD,NZD" } + apple_pay.country = "AU, AT, BE, BR, BG, CA, HR, CY, CZ, DK, EE, FI, FR, DE, GR, HU, HK, IE, IT, JP, LV, LI, LT, LU, MT, MY, MX, NL, NZ, NO, PL, PT, RO, SK, SG, SI, ZA, ES, SE, CH, GB, AE, US" +@@ -603,9 +605,20 @@ giropay = { country = "DE", currency = "EUR" } + google_pay.country = "AU, AT, BE, BR, BG, CA, HR, CZ, DK, EE, FI, FR, DE, GR, HK, HU, IN, ID, IE, IT, JP, LV, KE, LT, LU, MY, MX, NL, NZ, NO, PL, PT, RO, SG, SK, ZA, ES, SE, CH, TH, AE, GB, US" + ideal = { country = "NL", currency = "EUR" } + klarna = { country = "AU,AT,BE,CA,CZ,DK,FI,FR,DE,GR,IE,IT,NL,NZ,NO,PL,PT,ES,SE,CH,GB,US", currency = "AUD,CAD,CHF,CZK,DKK,EUR,GBP,NOK,NZD,PLN,SEK,USD" } +-multibanco = { country = "PT", currency = "EUR" } ++multibanco = { country = "AT,BE,BG,HR,CY,CZ,DK,EE,FI,FR,DE,GI,GR,HU,IE,IT,LV,LI,LT,LU,MT,NL,NO,PL,PT,RO,SK,SI,ES,SE,CH,GB", currency = "EUR" } + ach = { country = "US", currency = "USD" } + revolut_pay = { currency = "EUR,GBP" } ++sepa = {country = "AT,BE,BG,HR,CY,CZ,DK,EE,FI,FR,DE,GI,GR,HU,IE,IT,LV,LI,LT,LU,MT,NL,NO,PL,PT,RO,SK,SI,ES,SE,CH,GB,IS,LI", currency="EUR"} ++bacs = { country = "GB", currency = "GBP" } ++becs = { country = "AU", currency = "AUD" } ++sofort = {country = "AT,BE,BG,HR,CY,CZ,DK,EE,FI,FR,DE,GR,HU,IS,IE,IT,LV,LI,LT,LU,MT,NL,NO,PL,PT,RO,SK,SI,ES,SE", currency = "EUR" } ++blik = {country="PL", currency = "PLN"} ++bancontact_card = { country = "BE", currency = "EUR" } ++przelewy24 = { country = "PL", currency = "EUR,PLN" } ++online_banking_fpx = { country = "MY", currency = "MYR" } ++amazon_pay = { country = "AF,AX,AL,DZ,AS,AD,AO,AI,AQ,AG,AR,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BY,BE,BZ,BJ,BM,BT,BO,BQ,BA,BW,BV,BR,IO,BN,BG,BF,BI,KH,CM,CA,CV,KY,CF,TD,CL,CN,CX,CC,CO,KM,CG,CD,CK,CR,CI,HR,CU,CW,CY,CZ,DK,DJ,DM,DO,EC,EG,SV,GQ,ER,EE,ET,FK,FO,FJ,FI,FR,GF,PF,TF,GA,GM,GE,DE,GH,GI,GR,GL,GD,GP,GU,GT,GG,GN,GW,GY,HT,HM,VA,HN,HK,HU,IS,IN,ID,IR,IQ,IE,IM,IL,IT,JM,JP,JE,JO,KZ,KE,KI,KP,KR,KW,KG,LA,LV,LB,LS,LR,LY,LI,LT,LU,MO,MK,MG,MW,MY,MV,ML,MT,MH,MQ,MR,MU,YT,MX,FM,MD,MC,MN,ME,MS,MA,MZ,MM,NA,NR,NP,NL,NC,NZ,NI,NE,NG,NU,NF,MP,NO,OM,PK,PW,PS,PA,PG,PY,PE,PH,PN,PL,PT,PR,QA,RE,RO,RU,RW,BL,SH,KN,LC,MF,PM,VC,WS,SM,ST,SA,SN,RS,SC,SL,SG,SX,SK,SI,SB,SO,ZA,GS,SS,ES,LK,SD,SR,SJ,SZ,SE,CH,SY,TW,TJ,TZ,TH,TL,TG,TK,TO,TT,TN,TR,TM,TC,TV,UG,UA,AE,GB,UM,UY,UZ,VU,VE,VN,VG,VI,WF,EH,YE,ZM,ZW,US", currency = "USD,AUD,GBP,DKK,EUR,HKD,JPY,NZD,NOK,ZAR,SEK,CHF" } ++we_chat_pay = { country = "CN", currency = "CNY,AUD,CAD,EUR,GBP,HKD,JPY,SGD,USD,DKK,NOK,SEK,CHF" } ++ali_pay = {country = "CN", currency = "AUD,CAD,CNY,EUR,GBP,HKD,JPY,MYR,NZD,SGD,USD"} + + [pm_filters.volt] + open_banking_uk = {country = "DE,GB,AT,BE,CY,EE,ES,FI,FR,GR,HR,IE,IT,LT,LU,LV,MT,NL,PT,SI,SK,BG,CZ,DK,HU,NO,PL,RO,SE,AU,BR", currency = "EUR,GBP,DKK,NOK,PLN,SEK,AUD,BRL"} +diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml +index 1e8005a6..3c707087 100644 +--- a/config/deployments/sandbox.toml ++++ b/config/deployments/sandbox.toml +@@ -602,6 +602,8 @@ debit = { country = "US", currency = "USD" } + ach = { country = "US", currency = "USD" } + + [pm_filters.stripe] ++credit = { country = "AF,AX,AL,DZ,AS,AD,AO,AI,AQ,AG,AR,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BY,BE,BZ,BJ,BM,BT,BO,BQ,BA,BW,BV,BR,IO,BN,BG,BF,BI,KH,CM,CA,CV,KY,CF,TD,CL,CN,CX,CC,CO,KM,CG,CD,CK,CR,CI,HR,CU,CW,CY,CZ,DK,DJ,DM,DO,EC,EG,SV,GQ,ER,EE,ET,FK,FO,FJ,FI,FR,GF,PF,TF,GA,GM,GE,DE,GH,GI,GR,GL,GD,GP,GU,GT,GG,GN,GW,GY,HT,HM,VA,HN,HK,HU,IS,IN,ID,IR,IQ,IE,IM,IL,IT,JM,JP,JE,JO,KZ,KE,KI,KP,KR,KW,KG,LA,LV,LB,LS,LR,LY,LI,LT,LU,MO,MK,MG,MW,MY,MV,ML,MT,MH,MQ,MR,MU,YT,MX,FM,MD,MC,MN,ME,MS,MA,MZ,MM,NA,NR,NP,NL,NC,NZ,NI,NE,NG,NU,NF,MP,NO,OM,PK,PW,PS,PA,PG,PY,PE,PH,PN,PL,PT,PR,QA,RE,RO,RU,RW,BL,SH,KN,LC,MF,PM,VC,WS,SM,ST,SA,SN,RS,SC,SL,SG,SX,SK,SI,SB,SO,ZA,GS,SS,ES,LK,SD,SR,SJ,SZ,SE,CH,SY,TW,TJ,TZ,TH,TL,TG,TK,TO,TT,TN,TR,TM,TC,TV,UG,UA,AE,GB,UM,UY,UZ,VU,VE,VN,VG,VI,WF,EH,YE,ZM,ZW,US", currency = "AED,AFN,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,BYN,BZD,CAD,CDF,CHF,CLF,CLP,CNY,COP,CRC,CUC,CUP,CVE,CZK,DJF,DKK,DOP,DZD,EGP,ERN,ETB,EUR,FJD,FKP,GBP,GEL,GHS,GIP,GMD,GNF,GTQ,GYD,HKD,HNL,HRK,HTG,HUF,IDR,ILS,INR,IQD,IRR,ISK,JMD,JOD,JPY,KES,KGS,KHR,KMF,KPW,KRW,KWD,KYD,KZT,LAK,LBP,LKR,LRD,LSL,LYD,MAD,MDL,MGA,MKD,MMK,MNT,MOP,MRU,MUR,MVR,MWK,MXN,MYR,MZN,NAD,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SDG,SEK,SGD,SHP,SLE,SLL,SOS,SRD,SSP,STD,STN,SVC,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW,ZWL"} ++debit = { country = "AF,AX,AL,DZ,AS,AD,AO,AI,AQ,AG,AR,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BY,BE,BZ,BJ,BM,BT,BO,BQ,BA,BW,BV,BR,IO,BN,BG,BF,BI,KH,CM,CA,CV,KY,CF,TD,CL,CN,CX,CC,CO,KM,CG,CD,CK,CR,CI,HR,CU,CW,CY,CZ,DK,DJ,DM,DO,EC,EG,SV,GQ,ER,EE,ET,FK,FO,FJ,FI,FR,GF,PF,TF,GA,GM,GE,DE,GH,GI,GR,GL,GD,GP,GU,GT,GG,GN,GW,GY,HT,HM,VA,HN,HK,HU,IS,IN,ID,IR,IQ,IE,IM,IL,IT,JM,JP,JE,JO,KZ,KE,KI,KP,KR,KW,KG,LA,LV,LB,LS,LR,LY,LI,LT,LU,MO,MK,MG,MW,MY,MV,ML,MT,MH,MQ,MR,MU,YT,MX,FM,MD,MC,MN,ME,MS,MA,MZ,MM,NA,NR,NP,NL,NC,NZ,NI,NE,NG,NU,NF,MP,NO,OM,PK,PW,PS,PA,PG,PY,PE,PH,PN,PL,PT,PR,QA,RE,RO,RU,RW,BL,SH,KN,LC,MF,PM,VC,WS,SM,ST,SA,SN,RS,SC,SL,SG,SX,SK,SI,SB,SO,ZA,GS,SS,ES,LK,SD,SR,SJ,SZ,SE,CH,SY,TW,TJ,TZ,TH,TL,TG,TK,TO,TT,TN,TR,TM,TC,TV,UG,UA,AE,GB,UM,UY,UZ,VU,VE,VN,VG,VI,WF,EH,YE,ZM,ZW,US", currency = "AED,AFN,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,BYN,BZD,CAD,CDF,CHF,CLF,CLP,CNY,COP,CRC,CUC,CUP,CVE,CZK,DJF,DKK,DOP,DZD,EGP,ERN,ETB,EUR,FJD,FKP,GBP,GEL,GHS,GIP,GMD,GNF,GTQ,GYD,HKD,HNL,HRK,HTG,HUF,IDR,ILS,INR,IQD,IRR,ISK,JMD,JOD,JPY,KES,KGS,KHR,KMF,KPW,KRW,KWD,KYD,KZT,LAK,LBP,LKR,LRD,LSL,LYD,MAD,MDL,MGA,MKD,MMK,MNT,MOP,MRU,MUR,MVR,MWK,MXN,MYR,MZN,NAD,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SDG,SEK,SGD,SHP,SLE,SLL,SOS,SRD,SSP,STD,STN,SVC,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW,ZWL"} + affirm = { country = "US", currency = "USD" } + afterpay_clearpay = { country = "US,CA,GB,AU,NZ,FR,ES", currency = "USD,CAD,GBP,AUD,NZD" } + apple_pay.country = "AU, AT, BE, BR, BG, CA, HR, CY, CZ, DK, EE, FI, FR, DE, GR, HU, HK, IE, IT, JP, LV, LI, LT, LU, MT, MY, MX, NL, NZ, NO, PL, PT, RO, SK, SG, SI, ZA, ES, SE, CH, GB, AE, US" +@@ -611,9 +613,20 @@ giropay = { country = "DE", currency = "EUR" } + google_pay.country = "AU, AT, BE, BR, BG, CA, HR, CZ, DK, EE, FI, FR, DE, GR, HK, HU, IN, ID, IE, IT, JP, LV, KE, LT, LU, MY, MX, NL, NZ, NO, PL, PT, RO, SG, SK, ZA, ES, SE, CH, TH, AE, GB, US" + ideal = { country = "NL", currency = "EUR" } + klarna = { country = "AU,AT,BE,CA,CZ,DK,FI,FR,DE,GR,IE,IT,NL,NZ,NO,PL,PT,ES,SE,CH,GB,US", currency = "AUD,CAD,CHF,CZK,DKK,EUR,GBP,NOK,NZD,PLN,SEK,USD" } +-multibanco = { country = "PT", currency = "EUR" } ++multibanco = { country = "AT,BE,BG,HR,CY,CZ,DK,EE,FI,FR,DE,GI,GR,HU,IE,IT,LV,LI,LT,LU,MT,NL,NO,PL,PT,RO,SK,SI,ES,SE,CH,GB", currency = "EUR" } + ach = { country = "US", currency = "USD" } + revolut_pay = { currency = "EUR,GBP" } ++sepa = {country = "AT,BE,BG,HR,CY,CZ,DK,EE,FI,FR,DE,GI,GR,HU,IE,IT,LV,LI,LT,LU,MT,NL,NO,PL,PT,RO,SK,SI,ES,SE,CH,GB,IS,LI", currency="EUR"} ++bacs = { country = "GB", currency = "GBP" } ++becs = { country = "AU", currency = "AUD" } ++sofort = {country = "AT,BE,BG,HR,CY,CZ,DK,EE,FI,FR,DE,GR,HU,IS,IE,IT,LV,LI,LT,LU,MT,NL,NO,PL,PT,RO,SK,SI,ES,SE", currency = "EUR" } ++blik = {country="PL", currency = "PLN"} ++bancontact_card = { country = "BE", currency = "EUR" } ++przelewy24 = { country = "PL", currency = "EUR,PLN" } ++online_banking_fpx = { country = "MY", currency = "MYR" } ++amazon_pay = { country = "AF,AX,AL,DZ,AS,AD,AO,AI,AQ,AG,AR,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BY,BE,BZ,BJ,BM,BT,BO,BQ,BA,BW,BV,BR,IO,BN,BG,BF,BI,KH,CM,CA,CV,KY,CF,TD,CL,CN,CX,CC,CO,KM,CG,CD,CK,CR,CI,HR,CU,CW,CY,CZ,DK,DJ,DM,DO,EC,EG,SV,GQ,ER,EE,ET,FK,FO,FJ,FI,FR,GF,PF,TF,GA,GM,GE,DE,GH,GI,GR,GL,GD,GP,GU,GT,GG,GN,GW,GY,HT,HM,VA,HN,HK,HU,IS,IN,ID,IR,IQ,IE,IM,IL,IT,JM,JP,JE,JO,KZ,KE,KI,KP,KR,KW,KG,LA,LV,LB,LS,LR,LY,LI,LT,LU,MO,MK,MG,MW,MY,MV,ML,MT,MH,MQ,MR,MU,YT,MX,FM,MD,MC,MN,ME,MS,MA,MZ,MM,NA,NR,NP,NL,NC,NZ,NI,NE,NG,NU,NF,MP,NO,OM,PK,PW,PS,PA,PG,PY,PE,PH,PN,PL,PT,PR,QA,RE,RO,RU,RW,BL,SH,KN,LC,MF,PM,VC,WS,SM,ST,SA,SN,RS,SC,SL,SG,SX,SK,SI,SB,SO,ZA,GS,SS,ES,LK,SD,SR,SJ,SZ,SE,CH,SY,TW,TJ,TZ,TH,TL,TG,TK,TO,TT,TN,TR,TM,TC,TV,UG,UA,AE,GB,UM,UY,UZ,VU,VE,VN,VG,VI,WF,EH,YE,ZM,ZW,US", currency = "USD,AUD,GBP,DKK,EUR,HKD,JPY,NZD,NOK,ZAR,SEK,CHF" } ++we_chat_pay = { country = "CN", currency = "CNY,AUD,CAD,EUR,GBP,HKD,JPY,SGD,USD,DKK,NOK,SEK,CHF" } ++ali_pay = {country = "CN", currency = "AUD,CAD,CNY,EUR,GBP,HKD,JPY,MYR,NZD,SGD,USD"} + + [pm_filters.volt] + open_banking_uk = { country = "DE,GB,AT,BE,CY,EE,ES,FI,FR,GR,HR,IE,IT,LT,LU,LV,MT,NL,PT,SI,SK,BG,CZ,DK,HU,NO,PL,RO,SE,AU,BR", currency = "EUR,GBP,DKK,NOK,PLN,SEK,AUD,BRL" } +diff --git a/config/development.toml b/config/development.toml +index 2dae99e6..9380fa7e 100644 +--- a/config/development.toml ++++ b/config/development.toml +@@ -449,15 +449,28 @@ ideal = { country = "NL", currency = "EUR" } + google_pay = { country = "AU, AT, BE, BR, BG, CA, HR, CZ, DK, EE, FI, FR, DE, GR, HK, HU, IN, ID, IE, IT, JP, LV, KE, LT, LU, MY, MX, NL, NZ, NO, PL, PT, RO, SG, SK, ZA, ES, SE, CH, TH, AE, GB, US" } + apple_pay = { country = "AU, AT, BE, BR, BG, CA, HR, CY, CZ, DK, EE, FI, FR, DE, GR, HU, HK, IE, IT, JP, LV, LI, LT, LU, MT, MY, MX, NL, NZ, NO, PL, PT, RO, SK, SG, SI, ZA, ES, SE, CH, GB, AE, US" } + klarna = { country = "AU,AT,BE,CA,CZ,DK,FI,FR,DE,GR,IE,IT,NL,NZ,NO,PL,PT,ES,SE,CH,GB,US", currency = "AUD,CAD,CHF,CZK,DKK,EUR,GBP,NOK,NZD,PLN,SEK,USD" } ++credit = { country = "AF,AX,AL,DZ,AS,AD,AO,AI,AQ,AG,AR,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BY,BE,BZ,BJ,BM,BT,BO,BQ,BA,BW,BV,BR,IO,BN,BG,BF,BI,KH,CM,CA,CV,KY,CF,TD,CL,CN,CX,CC,CO,KM,CG,CD,CK,CR,CI,HR,CU,CW,CY,CZ,DK,DJ,DM,DO,EC,EG,SV,GQ,ER,EE,ET,FK,FO,FJ,FI,FR,GF,PF,TF,GA,GM,GE,DE,GH,GI,GR,GL,GD,GP,GU,GT,GG,GN,GW,GY,HT,HM,VA,HN,HK,HU,IS,IN,ID,IR,IQ,IE,IM,IL,IT,JM,JP,JE,JO,KZ,KE,KI,KP,KR,KW,KG,LA,LV,LB,LS,LR,LY,LI,LT,LU,MO,MK,MG,MW,MY,MV,ML,MT,MH,MQ,MR,MU,YT,MX,FM,MD,MC,MN,ME,MS,MA,MZ,MM,NA,NR,NP,NL,NC,NZ,NI,NE,NG,NU,NF,MP,NO,OM,PK,PW,PS,PA,PG,PY,PE,PH,PN,PL,PT,PR,QA,RE,RO,RU,RW,BL,SH,KN,LC,MF,PM,VC,WS,SM,ST,SA,SN,RS,SC,SL,SG,SX,SK,SI,SB,SO,ZA,GS,SS,ES,LK,SD,SR,SJ,SZ,SE,CH,SY,TW,TJ,TZ,TH,TL,TG,TK,TO,TT,TN,TR,TM,TC,TV,UG,UA,AE,GB,UM,UY,UZ,VU,VE,VN,VG,VI,WF,EH,YE,ZM,ZW,US", currency = "AED,AFN,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,BYN,BZD,CAD,CDF,CHF,CLF,CLP,CNY,COP,CRC,CUC,CUP,CVE,CZK,DJF,DKK,DOP,DZD,EGP,ERN,ETB,EUR,FJD,FKP,GBP,GEL,GHS,GIP,GMD,GNF,GTQ,GYD,HKD,HNL,HRK,HTG,HUF,IDR,ILS,INR,IQD,IRR,ISK,JMD,JOD,JPY,KES,KGS,KHR,KMF,KPW,KRW,KWD,KYD,KZT,LAK,LBP,LKR,LRD,LSL,LYD,MAD,MDL,MGA,MKD,MMK,MNT,MOP,MRU,MUR,MVR,MWK,MXN,MYR,MZN,NAD,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SDG,SEK,SGD,SHP,SLE,SLL,SOS,SRD,SSP,STD,STN,SVC,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW,ZWL"} ++debit = { country = "AF,AX,AL,DZ,AS,AD,AO,AI,AQ,AG,AR,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BY,BE,BZ,BJ,BM,BT,BO,BQ,BA,BW,BV,BR,IO,BN,BG,BF,BI,KH,CM,CA,CV,KY,CF,TD,CL,CN,CX,CC,CO,KM,CG,CD,CK,CR,CI,HR,CU,CW,CY,CZ,DK,DJ,DM,DO,EC,EG,SV,GQ,ER,EE,ET,FK,FO,FJ,FI,FR,GF,PF,TF,GA,GM,GE,DE,GH,GI,GR,GL,GD,GP,GU,GT,GG,GN,GW,GY,HT,HM,VA,HN,HK,HU,IS,IN,ID,IR,IQ,IE,IM,IL,IT,JM,JP,JE,JO,KZ,KE,KI,KP,KR,KW,KG,LA,LV,LB,LS,LR,LY,LI,LT,LU,MO,MK,MG,MW,MY,MV,ML,MT,MH,MQ,MR,MU,YT,MX,FM,MD,MC,MN,ME,MS,MA,MZ,MM,NA,NR,NP,NL,NC,NZ,NI,NE,NG,NU,NF,MP,NO,OM,PK,PW,PS,PA,PG,PY,PE,PH,PN,PL,PT,PR,QA,RE,RO,RU,RW,BL,SH,KN,LC,MF,PM,VC,WS,SM,ST,SA,SN,RS,SC,SL,SG,SX,SK,SI,SB,SO,ZA,GS,SS,ES,LK,SD,SR,SJ,SZ,SE,CH,SY,TW,TJ,TZ,TH,TL,TG,TK,TO,TT,TN,TR,TM,TC,TV,UG,UA,AE,GB,UM,UY,UZ,VU,VE,VN,VG,VI,WF,EH,YE,ZM,ZW,US", currency = "AED,AFN,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,BYN,BZD,CAD,CDF,CHF,CLF,CLP,CNY,COP,CRC,CUC,CUP,CVE,CZK,DJF,DKK,DOP,DZD,EGP,ERN,ETB,EUR,FJD,FKP,GBP,GEL,GHS,GIP,GMD,GNF,GTQ,GYD,HKD,HNL,HRK,HTG,HUF,IDR,ILS,INR,IQD,IRR,ISK,JMD,JOD,JPY,KES,KGS,KHR,KMF,KPW,KRW,KWD,KYD,KZT,LAK,LBP,LKR,LRD,LSL,LYD,MAD,MDL,MGA,MKD,MMK,MNT,MOP,MRU,MUR,MVR,MWK,MXN,MYR,MZN,NAD,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SDG,SEK,SGD,SHP,SLE,SLL,SOS,SRD,SSP,STD,STN,SVC,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW,ZWL"} + affirm = { country = "US", currency = "USD" } + afterpay_clearpay = { country = "US,CA,GB,AU,NZ,FR,ES", currency = "USD,CAD,GBP,AUD,NZD" } +-giropay = { country = "DE", currency = "EUR" } ++cashapp = { country = "US", currency = "USD" } + eps = { country = "AT", currency = "EUR" } ++giropay = { country = "DE", currency = "EUR" } + ideal = { country = "NL", currency = "EUR" } +-cashapp = { country = "US", currency = "USD" } +-multibanco = { country = "PT", currency = "EUR" } ++multibanco = { country = "AT,BE,BG,HR,CY,CZ,DK,EE,FI,FR,DE,GI,GR,HU,IE,IT,LV,LI,LT,LU,MT,NL,NO,PL,PT,RO,SK,SI,ES,SE,CH,GB", currency = "EUR" } + ach = { country = "US", currency = "USD" } + revolut_pay = { currency = "EUR,GBP" } ++sepa = {country = "AT,BE,BG,HR,CY,CZ,DK,EE,FI,FR,DE,GI,GR,HU,IE,IT,LV,LI,LT,LU,MT,NL,NO,PL,PT,RO,SK,SI,ES,SE,CH,GB,IS,LI", currency="EUR"} ++bacs = { country = "GB", currency = "GBP" } ++becs = { country = "AU", currency = "AUD" } ++sofort = {country = "AT,BE,BG,HR,CY,CZ,DK,EE,FI,FR,DE,GR,HU,IS,IE,IT,LV,LI,LT,LU,MT,NL,NO,PL,PT,RO,SK,SI,ES,SE", currency = "EUR" } ++blik = {country="PL", currency = "PLN"} ++bancontact_card = { country = "BE", currency = "EUR" } ++przelewy24 = { country = "PL", currency = "EUR,PLN" } ++online_banking_fpx = { country = "MY", currency = "MYR" } ++amazon_pay = { country = "AF,AX,AL,DZ,AS,AD,AO,AI,AQ,AG,AR,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BY,BE,BZ,BJ,BM,BT,BO,BQ,BA,BW,BV,BR,IO,BN,BG,BF,BI,KH,CM,CA,CV,KY,CF,TD,CL,CN,CX,CC,CO,KM,CG,CD,CK,CR,CI,HR,CU,CW,CY,CZ,DK,DJ,DM,DO,EC,EG,SV,GQ,ER,EE,ET,FK,FO,FJ,FI,FR,GF,PF,TF,GA,GM,GE,DE,GH,GI,GR,GL,GD,GP,GU,GT,GG,GN,GW,GY,HT,HM,VA,HN,HK,HU,IS,IN,ID,IR,IQ,IE,IM,IL,IT,JM,JP,JE,JO,KZ,KE,KI,KP,KR,KW,KG,LA,LV,LB,LS,LR,LY,LI,LT,LU,MO,MK,MG,MW,MY,MV,ML,MT,MH,MQ,MR,MU,YT,MX,FM,MD,MC,MN,ME,MS,MA,MZ,MM,NA,NR,NP,NL,NC,NZ,NI,NE,NG,NU,NF,MP,NO,OM,PK,PW,PS,PA,PG,PY,PE,PH,PN,PL,PT,PR,QA,RE,RO,RU,RW,BL,SH,KN,LC,MF,PM,VC,WS,SM,ST,SA,SN,RS,SC,SL,SG,SX,SK,SI,SB,SO,ZA,GS,SS,ES,LK,SD,SR,SJ,SZ,SE,CH,SY,TW,TJ,TZ,TH,TL,TG,TK,TO,TT,TN,TR,TM,TC,TV,UG,UA,AE,GB,UM,UY,UZ,VU,VE,VN,VG,VI,WF,EH,YE,ZM,ZW,US", currency = "USD,AUD,GBP,DKK,EUR,HKD,JPY,NZD,NOK,ZAR,SEK,CHF" } ++we_chat_pay = { country = "CN", currency = "CNY,AUD,CAD,EUR,GBP,HKD,JPY,SGD,USD,DKK,NOK,SEK,CHF" } ++ali_pay = {country = "CN", currency = "AUD,CAD,CNY,EUR,GBP,HKD,JPY,MYR,NZD,SGD,USD"} + + [pm_filters.volt] + open_banking_uk = { country = "DE,GB,AT,BE,CY,EE,ES,FI,FR,GR,HR,IE,IT,LT,LU,LV,MT,NL,PT,SI,SK,BG,CZ,DK,HU,NO,PL,RO,SE,AU,BR", currency = "EUR,GBP,DKK,NOK,PLN,SEK,AUD,BRL" } +diff --git a/config/docker_compose.toml b/config/docker_compose.toml +index c8cb4632..dcf86bbc 100644 +--- a/config/docker_compose.toml ++++ b/config/docker_compose.toml +@@ -618,7 +618,31 @@ red_pagos = { country = "UY", currency = "UYU" } + local_bank_transfer = { country = "CN", currency = "CNY" } + + [pm_filters.stripe] ++credit = { country = "AF,AX,AL,DZ,AS,AD,AO,AI,AQ,AG,AR,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BY,BE,BZ,BJ,BM,BT,BO,BQ,BA,BW,BV,BR,IO,BN,BG,BF,BI,KH,CM,CA,CV,KY,CF,TD,CL,CN,CX,CC,CO,KM,CG,CD,CK,CR,CI,HR,CU,CW,CY,CZ,DK,DJ,DM,DO,EC,EG,SV,GQ,ER,EE,ET,FK,FO,FJ,FI,FR,GF,PF,TF,GA,GM,GE,DE,GH,GI,GR,GL,GD,GP,GU,GT,GG,GN,GW,GY,HT,HM,VA,HN,HK,HU,IS,IN,ID,IR,IQ,IE,IM,IL,IT,JM,JP,JE,JO,KZ,KE,KI,KP,KR,KW,KG,LA,LV,LB,LS,LR,LY,LI,LT,LU,MO,MK,MG,MW,MY,MV,ML,MT,MH,MQ,MR,MU,YT,MX,FM,MD,MC,MN,ME,MS,MA,MZ,MM,NA,NR,NP,NL,NC,NZ,NI,NE,NG,NU,NF,MP,NO,OM,PK,PW,PS,PA,PG,PY,PE,PH,PN,PL,PT,PR,QA,RE,RO,RU,RW,BL,SH,KN,LC,MF,PM,VC,WS,SM,ST,SA,SN,RS,SC,SL,SG,SX,SK,SI,SB,SO,ZA,GS,SS,ES,LK,SD,SR,SJ,SZ,SE,CH,SY,TW,TJ,TZ,TH,TL,TG,TK,TO,TT,TN,TR,TM,TC,TV,UG,UA,AE,GB,UM,UY,UZ,VU,VE,VN,VG,VI,WF,EH,YE,ZM,ZW,US", currency = "AED,AFN,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,BYN,BZD,CAD,CDF,CHF,CLF,CLP,CNY,COP,CRC,CUC,CUP,CVE,CZK,DJF,DKK,DOP,DZD,EGP,ERN,ETB,EUR,FJD,FKP,GBP,GEL,GHS,GIP,GMD,GNF,GTQ,GYD,HKD,HNL,HRK,HTG,HUF,IDR,ILS,INR,IQD,IRR,ISK,JMD,JOD,JPY,KES,KGS,KHR,KMF,KPW,KRW,KWD,KYD,KZT,LAK,LBP,LKR,LRD,LSL,LYD,MAD,MDL,MGA,MKD,MMK,MNT,MOP,MRU,MUR,MVR,MWK,MXN,MYR,MZN,NAD,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SDG,SEK,SGD,SHP,SLE,SLL,SOS,SRD,SSP,STD,STN,SVC,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW,ZWL"} ++debit = { country = "AF,AX,AL,DZ,AS,AD,AO,AI,AQ,AG,AR,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BY,BE,BZ,BJ,BM,BT,BO,BQ,BA,BW,BV,BR,IO,BN,BG,BF,BI,KH,CM,CA,CV,KY,CF,TD,CL,CN,CX,CC,CO,KM,CG,CD,CK,CR,CI,HR,CU,CW,CY,CZ,DK,DJ,DM,DO,EC,EG,SV,GQ,ER,EE,ET,FK,FO,FJ,FI,FR,GF,PF,TF,GA,GM,GE,DE,GH,GI,GR,GL,GD,GP,GU,GT,GG,GN,GW,GY,HT,HM,VA,HN,HK,HU,IS,IN,ID,IR,IQ,IE,IM,IL,IT,JM,JP,JE,JO,KZ,KE,KI,KP,KR,KW,KG,LA,LV,LB,LS,LR,LY,LI,LT,LU,MO,MK,MG,MW,MY,MV,ML,MT,MH,MQ,MR,MU,YT,MX,FM,MD,MC,MN,ME,MS,MA,MZ,MM,NA,NR,NP,NL,NC,NZ,NI,NE,NG,NU,NF,MP,NO,OM,PK,PW,PS,PA,PG,PY,PE,PH,PN,PL,PT,PR,QA,RE,RO,RU,RW,BL,SH,KN,LC,MF,PM,VC,WS,SM,ST,SA,SN,RS,SC,SL,SG,SX,SK,SI,SB,SO,ZA,GS,SS,ES,LK,SD,SR,SJ,SZ,SE,CH,SY,TW,TJ,TZ,TH,TL,TG,TK,TO,TT,TN,TR,TM,TC,TV,UG,UA,AE,GB,UM,UY,UZ,VU,VE,VN,VG,VI,WF,EH,YE,ZM,ZW,US", currency = "AED,AFN,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,BYN,BZD,CAD,CDF,CHF,CLF,CLP,CNY,COP,CRC,CUC,CUP,CVE,CZK,DJF,DKK,DOP,DZD,EGP,ERN,ETB,EUR,FJD,FKP,GBP,GEL,GHS,GIP,GMD,GNF,GTQ,GYD,HKD,HNL,HRK,HTG,HUF,IDR,ILS,INR,IQD,IRR,ISK,JMD,JOD,JPY,KES,KGS,KHR,KMF,KPW,KRW,KWD,KYD,KZT,LAK,LBP,LKR,LRD,LSL,LYD,MAD,MDL,MGA,MKD,MMK,MNT,MOP,MRU,MUR,MVR,MWK,MXN,MYR,MZN,NAD,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SDG,SEK,SGD,SHP,SLE,SLL,SOS,SRD,SSP,STD,STN,SVC,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW,ZWL"} ++affirm = { country = "US", currency = "USD" } ++afterpay_clearpay = { country = "US,CA,GB,AU,NZ,FR,ES", currency = "USD,CAD,GBP,AUD,NZD" } ++apple_pay = {country = "AU,CN,HK,JP,MO,MY,NZ,SG,TW,AM,AT,AZ,BY,BE,BG,HR,CY,CZ,DK,EE,FO,FI,FR,GE,DE,GR,GL,GG,HU,IS,IE,IM,IT,KZ,JE,LV,LI,LT,LU,MT,MD,MC,ME,NL,NO,PL,PT,RO,SM,RS,SK,SI,ES,SE,CH,UA,GB,AR,CO,CR,BR,MX,PE,BH,IL,JO,KW,PS,QA,SA,AE,CA,UM,US,KR,VN,MA,ZA,VA,CL,SV,GT,HN,PA", currency = "AED,AFN,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,BYN,BZD,CAD,CDF,CHF,CLF,CLP,CNY,COP,CRC,CUC,CUP,CVE,CZK,DJF,DKK,DOP,DZD,EGP,ERN,ETB,EUR,FJD,FKP,GBP,GEL,GHS,GIP,GMD,GNF,GTQ,GYD,HKD,HNL,HRK,HTG,HUF,IDR,ILS,INR,IQD,IRR,ISK,JMD,JOD,JPY,KES,KGS,KHR,KMF,KPW,KRW,KWD,KYD,KZT,LAK,LBP,LKR,LRD,LSL,LYD,MAD,MDL,MGA,MKD,MMK,MNT,MOP,MRU,MUR,MVR,MWK,MXN,MYR,MZN,NAD,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SDG,SEK,SGD,SHP,SLE,SLL,SOS,SRD,SSP,STD,STN,SVC,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW,ZWL" } + cashapp = { country = "US", currency = "USD" } ++eps = { country = "AT", currency = "EUR" } ++giropay = { country = "DE", currency = "EUR" } ++google_pay = {country = "AL,DZ,AS,AO,AG,AR,AU,AT,AZ,BH,BY,BE,BR,BG,CA,CL,CO,HR,CZ,DK,DO,EG,EE,FI,FR,DE,GR,HK,HU,IN,ID,IE,IL,IT,JP,JO,KZ,KE,KW,LV,LB,LT,LU,MY,MX,NL,NZ,NO,OM,PK,PA,PE,PH,PL,PT,QA,RO,RU,SA,SG,SK,ZA,ES,LK,SE,CH,TW,TH,TR,UA,AE,GB,US,UY,VN", currency = "AED,AFN,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,BYN,BZD,CAD,CDF,CHF,CLF,CLP,CNY,COP,CRC,CUC,CUP,CVE,CZK,DJF,DKK,DOP,DZD,EGP,ERN,ETB,EUR,FJD,FKP,GBP,GEL,GHS,GIP,GMD,GNF,GTQ,GYD,HKD,HNL,HRK,HTG,HUF,IDR,ILS,INR,IQD,IRR,ISK,JMD,JOD,JPY,KES,KGS,KHR,KMF,KPW,KRW,KWD,KYD,KZT,LAK,LBP,LKR,LRD,LSL,LYD,MAD,MDL,MGA,MKD,MMK,MNT,MOP,MRU,MUR,MVR,MWK,MXN,MYR,MZN,NAD,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SDG,SEK,SGD,SHP,SLE,SLL,SOS,SRD,SSP,STD,STN,SVC,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW,ZWL"} ++ideal = { country = "NL", currency = "EUR" } ++klarna = { country = "AU,AT,BE,CA,CZ,DK,FI,FR,DE,GR,IE,IT,NL,NZ,NO,PL,PT,ES,SE,CH,GB,US", currency = "AUD,CAD,CHF,CZK,DKK,EUR,GBP,NOK,NZD,PLN,SEK,USD" } ++multibanco = { country = "AT,BE,BG,HR,CY,CZ,DK,EE,FI,FR,DE,GI,GR,HU,IE,IT,LV,LI,LT,LU,MT,NL,NO,PL,PT,RO,SK,SI,ES,SE,CH,GB", currency = "EUR" } ++ach = { country = "US", currency = "USD" } ++revolut_pay = { currency = "EUR,GBP" } ++sepa = {country = "AT,BE,BG,HR,CY,CZ,DK,EE,FI,FR,DE,GI,GR,HU,IE,IT,LV,LI,LT,LU,MT,NL,NO,PL,PT,RO,SK,SI,ES,SE,CH,GB,IS,LI", currency="EUR"} ++bacs = { country = "GB", currency = "GBP" } ++becs = { country = "AU", currency = "AUD" } ++sofort = {country = "AT,BE,BG,HR,CY,CZ,DK,EE,FI,FR,DE,GR,HU,IS,IE,IT,LV,LI,LT,LU,MT,NL,NO,PL,PT,RO,SK,SI,ES,SE", currency = "EUR" } ++blik = {country="PL", currency = "PLN"} ++bancontact_card = { country = "BE", currency = "EUR" } ++przelewy24 = { country = "PL", currency = "EUR,PLN" } ++online_banking_fpx = { country = "MY", currency = "MYR" } ++amazon_pay = { country = "AF,AX,AL,DZ,AS,AD,AO,AI,AQ,AG,AR,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BY,BE,BZ,BJ,BM,BT,BO,BQ,BA,BW,BV,BR,IO,BN,BG,BF,BI,KH,CM,CA,CV,KY,CF,TD,CL,CN,CX,CC,CO,KM,CG,CD,CK,CR,CI,HR,CU,CW,CY,CZ,DK,DJ,DM,DO,EC,EG,SV,GQ,ER,EE,ET,FK,FO,FJ,FI,FR,GF,PF,TF,GA,GM,GE,DE,GH,GI,GR,GL,GD,GP,GU,GT,GG,GN,GW,GY,HT,HM,VA,HN,HK,HU,IS,IN,ID,IR,IQ,IE,IM,IL,IT,JM,JP,JE,JO,KZ,KE,KI,KP,KR,KW,KG,LA,LV,LB,LS,LR,LY,LI,LT,LU,MO,MK,MG,MW,MY,MV,ML,MT,MH,MQ,MR,MU,YT,MX,FM,MD,MC,MN,ME,MS,MA,MZ,MM,NA,NR,NP,NL,NC,NZ,NI,NE,NG,NU,NF,MP,NO,OM,PK,PW,PS,PA,PG,PY,PE,PH,PN,PL,PT,PR,QA,RE,RO,RU,RW,BL,SH,KN,LC,MF,PM,VC,WS,SM,ST,SA,SN,RS,SC,SL,SG,SX,SK,SI,SB,SO,ZA,GS,SS,ES,LK,SD,SR,SJ,SZ,SE,CH,SY,TW,TJ,TZ,TH,TL,TG,TK,TO,TT,TN,TR,TM,TC,TV,UG,UA,AE,GB,UM,UY,UZ,VU,VE,VN,VG,VI,WF,EH,YE,ZM,ZW,US", currency = "USD,AUD,GBP,DKK,EUR,HKD,JPY,NZD,NOK,ZAR,SEK,CHF" } ++we_chat_pay = { country = "CN", currency = "CNY,AUD,CAD,EUR,GBP,HKD,JPY,SGD,USD,DKK,NOK,SEK,CHF" } ++ali_pay = {country = "CN", currency = "AUD,CAD,CNY,EUR,GBP,HKD,JPY,MYR,NZD,SGD,USD"} + + [pm_filters.prophetpay] + card_redirect = { country = "US", currency = "USD" } +diff --git a/connector-template/mod.rs b/connector-template/mod.rs +index 56b2b5bc..d4e95787 100644 +--- a/connector-template/mod.rs ++++ b/connector-template/mod.rs +@@ -598,7 +598,7 @@ static {{project-name | upcase}}_SUPPORTED_PAYMENT_METHODS: LazyLock, ++ pub display_name: String, + /// The description of the connector +- pub description: Option, ++ pub description: String, + /// The category of the connector +- #[schema(value_type = Option, example = "payment_gateway")] +- pub category: Option, ++ #[schema(value_type = HyperswitchConnectorCategory, example = "payment_gateway")] ++ pub category: common_enums::HyperswitchConnectorCategory, ++ /// The integration status of the connector ++ #[schema(value_type = ConnectorIntegrationStatus, example = "live")] ++ pub integration_status: common_enums::ConnectorIntegrationStatus, + /// The list of payment methods supported by the connector +- pub supported_payment_methods: Vec, ++ pub supported_payment_methods: Option>, + /// The list of webhook flows supported by the connector + #[schema(value_type = Option>)] + pub supported_webhook_flows: Option>, +diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs +index 8fbc29c6..56170159 100644 +--- a/crates/common_enums/src/enums.rs ++++ b/crates/common_enums/src/enums.rs +@@ -8471,10 +8471,40 @@ pub enum AuthenticationProduct { + )] + #[strum(serialize_all = "snake_case")] + #[serde(rename_all = "snake_case")] +-pub enum PaymentConnectorCategory { ++pub enum HyperswitchConnectorCategory { + PaymentGateway, + AlternativePaymentMethod, + BankAcquirer, ++ PayoutProcessor, ++ AuthenticationProvider, ++ FraudAndRiskManagementProvider, ++ TaxCalculationProvider, ++} ++ ++/// Connector Integration Status ++#[derive( ++ Clone, ++ Copy, ++ Debug, ++ Eq, ++ Hash, ++ PartialEq, ++ serde::Deserialize, ++ serde::Serialize, ++ strum::Display, ++ ToSchema, ++)] ++#[strum(serialize_all = "snake_case")] ++#[serde(rename_all = "snake_case")] ++pub enum ConnectorIntegrationStatus { ++ /// Connector is integrated and live on production ++ Live, ++ /// Connector is integrated and fully tested on sandbox ++ Sandbox, ++ /// Connector is integrated and partially tested on sandbox ++ Beta, ++ /// Connector is integrated using the online documentation but not tested yet ++ Alpha, + } + + /// The status of the feature +diff --git a/crates/hyperswitch_connectors/src/connectors/aci.rs b/crates/hyperswitch_connectors/src/connectors/aci.rs +index ebd20edb..59c89ae9 100644 +--- a/crates/hyperswitch_connectors/src/connectors/aci.rs ++++ b/crates/hyperswitch_connectors/src/connectors/aci.rs +@@ -1068,7 +1068,8 @@ static ACI_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "ACI", + description: + "ACI Payments delivers secure, real-time electronic payment solutions for businesses, banks, and governments, enabling seamless transactions across channels.", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Beta, + }; + + static ACI_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 0] = []; +diff --git a/crates/hyperswitch_connectors/src/connectors/adyen.rs b/crates/hyperswitch_connectors/src/connectors/adyen.rs +index 256e6578..fffef7fd 100644 +--- a/crates/hyperswitch_connectors/src/connectors/adyen.rs ++++ b/crates/hyperswitch_connectors/src/connectors/adyen.rs +@@ -3017,7 +3017,8 @@ static ADYEN_SUPPORTED_PAYMENT_METHODS: LazyLock = Lazy + static ADYEN_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Adyen", + description: "Adyen is a Dutch payment company with the status of an acquiring bank that allows businesses to accept e-commerce, mobile, and point-of-sale payments. It is listed on the stock exchange Euronext Amsterdam", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Live, + }; + + static ADYEN_SUPPORTED_WEBHOOK_FLOWS: &[enums::EventClass] = &[ +diff --git a/crates/hyperswitch_connectors/src/connectors/adyenplatform.rs b/crates/hyperswitch_connectors/src/connectors/adyenplatform.rs +index 2158fece..71feb122 100644 +--- a/crates/hyperswitch_connectors/src/connectors/adyenplatform.rs ++++ b/crates/hyperswitch_connectors/src/connectors/adyenplatform.rs +@@ -38,7 +38,9 @@ use hyperswitch_domain_models::{ + PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData, + RefundsData, SetupMandateRequestData, + }, +- router_response_types::{PaymentsResponseData, RefundsResponseData}, ++ router_response_types::{ ++ ConnectorInfo, PaymentsResponseData, RefundsResponseData, SupportedPaymentMethods, ++ }, + }; + #[cfg(feature = "payouts")] + use hyperswitch_interfaces::events::connector_api_logs::ConnectorEvent; +@@ -431,4 +433,23 @@ impl IncomingWebhook for Adyenplatform { + } + } + +-impl ConnectorSpecifications for Adyenplatform {} ++static ADYENPLATFORM_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { ++ display_name: "Adyen Platform", ++ description: "Adyen Platform for marketplace payouts and disbursements", ++ connector_type: common_enums::HyperswitchConnectorCategory::PayoutProcessor, ++ integration_status: common_enums::ConnectorIntegrationStatus::Sandbox, ++}; ++ ++impl ConnectorSpecifications for Adyenplatform { ++ fn get_connector_about(&self) -> Option<&'static ConnectorInfo> { ++ Some(&ADYENPLATFORM_CONNECTOR_INFO) ++ } ++ ++ fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> { ++ None ++ } ++ ++ fn get_supported_webhook_flows(&self) -> Option<&'static [common_enums::enums::EventClass]> { ++ None ++ } ++} +diff --git a/crates/hyperswitch_connectors/src/connectors/affirm.rs b/crates/hyperswitch_connectors/src/connectors/affirm.rs +index 9d1b1df2..30735dcf 100644 +--- a/crates/hyperswitch_connectors/src/connectors/affirm.rs ++++ b/crates/hyperswitch_connectors/src/connectors/affirm.rs +@@ -603,7 +603,8 @@ static AFFIRM_SUPPORTED_PAYMENT_METHODS: LazyLock = + static AFFIRM_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Affirm", + description: "Affirm connector", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Alpha, + }; + + static AFFIRM_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 0] = []; +diff --git a/crates/hyperswitch_connectors/src/connectors/airwallex.rs b/crates/hyperswitch_connectors/src/connectors/airwallex.rs +index e18f798f..750ebdf8 100644 +--- a/crates/hyperswitch_connectors/src/connectors/airwallex.rs ++++ b/crates/hyperswitch_connectors/src/connectors/airwallex.rs +@@ -1305,7 +1305,8 @@ static AIRWALLEX_SUPPORTED_PAYMENT_METHODS: LazyLock = + static AIRWALLEX_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Airwallex", + description: "Airwallex is a multinational financial technology company offering financial services and software as a service (SaaS)", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Sandbox, + }; + + static AIRWALLEX_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 3] = [ +diff --git a/crates/hyperswitch_connectors/src/connectors/authipay.rs b/crates/hyperswitch_connectors/src/connectors/authipay.rs +index 5a5179ef..b5332dba 100644 +--- a/crates/hyperswitch_connectors/src/connectors/authipay.rs ++++ b/crates/hyperswitch_connectors/src/connectors/authipay.rs +@@ -829,7 +829,8 @@ static AUTHIPAY_SUPPORTED_PAYMENT_METHODS: LazyLock = + static AUTHIPAY_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Authipay", + description: "Authipay is a Fiserv-powered payment gateway for the EMEA region supporting Visa and Mastercard transactions. Features include flexible capture methods (automatic, manual, sequential), partial captures/refunds, payment tokenization, and secure HMAC SHA256 authentication.", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Sandbox, + }; + + static AUTHIPAY_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 0] = []; +diff --git a/crates/hyperswitch_connectors/src/connectors/authorizedotnet.rs b/crates/hyperswitch_connectors/src/connectors/authorizedotnet.rs +index d8ddf71a..536a2d2a 100644 +--- a/crates/hyperswitch_connectors/src/connectors/authorizedotnet.rs ++++ b/crates/hyperswitch_connectors/src/connectors/authorizedotnet.rs +@@ -1263,7 +1263,8 @@ static AUTHORIZEDOTNET_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Authorize.net", + description: + " Authorize.net supports payment processing by helping small businesses accept credit card and eCheck payments online, in person on the go.", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Live, + }; + + static AUTHORIZEDOTNET_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 2] = +diff --git a/crates/hyperswitch_connectors/src/connectors/bambora.rs b/crates/hyperswitch_connectors/src/connectors/bambora.rs +index ed67d9b2..49a3faef 100644 +--- a/crates/hyperswitch_connectors/src/connectors/bambora.rs ++++ b/crates/hyperswitch_connectors/src/connectors/bambora.rs +@@ -875,7 +875,8 @@ lazy_static! { + static ref BAMBORA_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Bambora", + description: "Bambora is a leading online payment provider in Canada and United States.", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Sandbox, + }; + static ref BAMBORA_SUPPORTED_WEBHOOK_FLOWS: Vec = Vec::new(); + } +diff --git a/crates/hyperswitch_connectors/src/connectors/bamboraapac.rs b/crates/hyperswitch_connectors/src/connectors/bamboraapac.rs +index 43a90be1..5cdbcf88 100644 +--- a/crates/hyperswitch_connectors/src/connectors/bamboraapac.rs ++++ b/crates/hyperswitch_connectors/src/connectors/bamboraapac.rs +@@ -798,7 +798,8 @@ lazy_static! { + static ref BAMBORAAPAC_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Bambora Asia-Pacific", + description: "Bambora Asia-Pacific, provides comprehensive payment solutions, offering merchants smart and smooth payment processing capabilities.", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Sandbox, + }; + + static ref BAMBORAAPAC_SUPPORTED_WEBHOOK_FLOWS: Vec = Vec::new(); +diff --git a/crates/hyperswitch_connectors/src/connectors/barclaycard.rs b/crates/hyperswitch_connectors/src/connectors/barclaycard.rs +index 9327f8ec..98843a06 100644 +--- a/crates/hyperswitch_connectors/src/connectors/barclaycard.rs ++++ b/crates/hyperswitch_connectors/src/connectors/barclaycard.rs +@@ -1329,7 +1329,8 @@ static BARCLAYCARD_SUPPORTED_PAYMENT_METHODS: LazyLock + static BARCLAYCARD_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "BarclayCard SmartPay Fuse", + description: "Barclaycard, part of Barclays Bank UK PLC, is a leading global payment business that helps consumers, retailers and businesses to make and take payments flexibly, and to access short-term credit and point of sale finance.", +- connector_type: enums::PaymentConnectorCategory::BankAcquirer, ++ connector_type: enums::HyperswitchConnectorCategory::BankAcquirer, ++ integration_status: enums::ConnectorIntegrationStatus::Sandbox, + }; + + static BARCLAYCARD_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 0] = []; +diff --git a/crates/hyperswitch_connectors/src/connectors/billwerk.rs b/crates/hyperswitch_connectors/src/connectors/billwerk.rs +index e5931f92..96428700 100644 +--- a/crates/hyperswitch_connectors/src/connectors/billwerk.rs ++++ b/crates/hyperswitch_connectors/src/connectors/billwerk.rs +@@ -876,7 +876,8 @@ static BILLWERK_SUPPORTED_PAYMENT_METHODS: LazyLock = + static BILLWERK_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Billwerk", + description: "Billwerk+ Pay is an acquirer independent payment gateway that's easy to setup with more than 50 recurring and non-recurring payment methods.", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Sandbox, + }; + + static BILLWERK_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 0] = []; +diff --git a/crates/hyperswitch_connectors/src/connectors/bitpay.rs b/crates/hyperswitch_connectors/src/connectors/bitpay.rs +index bb59ffe3..ecacb618 100644 +--- a/crates/hyperswitch_connectors/src/connectors/bitpay.rs ++++ b/crates/hyperswitch_connectors/src/connectors/bitpay.rs +@@ -447,7 +447,8 @@ static BITPAY_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Bitpay", + description: + "BitPay is a cryptocurrency payment processor that enables businesses to accept Bitcoin and other digital currencies ", +- connector_type: enums::PaymentConnectorCategory::AlternativePaymentMethod, ++ connector_type: enums::HyperswitchConnectorCategory::AlternativePaymentMethod, ++ integration_status: enums::ConnectorIntegrationStatus::Sandbox, + }; + + static BITPAY_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 1] = [enums::EventClass::Payments]; +diff --git a/crates/hyperswitch_connectors/src/connectors/blackhawknetwork.rs b/crates/hyperswitch_connectors/src/connectors/blackhawknetwork.rs +index fd29946c..60ebf16f 100644 +--- a/crates/hyperswitch_connectors/src/connectors/blackhawknetwork.rs ++++ b/crates/hyperswitch_connectors/src/connectors/blackhawknetwork.rs +@@ -615,7 +615,8 @@ static BLACKHAWKNETWORK_SUPPORTED_PAYMENT_METHODS: LazyLock = + static BLUECODE_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Bluecode", + description: "Bluecode is building a global payment network that combines Alipay+, Discover and EMPSA and enables seamless payments in 75 countries. With over 160 million acceptance points, payments are processed according to the highest European security and data protection standards to make Europe less dependent on international players.", +- connector_type: enums::PaymentConnectorCategory::AlternativePaymentMethod, ++ connector_type: enums::HyperswitchConnectorCategory::AlternativePaymentMethod, ++ integration_status: enums::ConnectorIntegrationStatus::Alpha, + }; + + static BLUECODE_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 1] = [enums::EventClass::Payments]; +diff --git a/crates/hyperswitch_connectors/src/connectors/bluesnap.rs b/crates/hyperswitch_connectors/src/connectors/bluesnap.rs +index ed52b931..2438cebe 100644 +--- a/crates/hyperswitch_connectors/src/connectors/bluesnap.rs ++++ b/crates/hyperswitch_connectors/src/connectors/bluesnap.rs +@@ -1482,7 +1482,8 @@ static BLUESNAP_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "BlueSnap", + description: + "BlueSnap is a payment platform that helps businesses accept payments from customers in over 200 regions ", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Live, + }; + + static BLUESNAP_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 3] = [ +diff --git a/crates/hyperswitch_connectors/src/connectors/braintree.rs b/crates/hyperswitch_connectors/src/connectors/braintree.rs +index 24c9a9af..acd56ab7 100644 +--- a/crates/hyperswitch_connectors/src/connectors/braintree.rs ++++ b/crates/hyperswitch_connectors/src/connectors/braintree.rs +@@ -1309,7 +1309,8 @@ static BRAINTREE_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Braintree", + description: + "Braintree, a PayPal service, offers a full-stack payment platform that simplifies accepting payments in your app or website, supporting various payment methods including credit cards and PayPal.", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Live, + }; + + static BRAINTREE_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 2] = +diff --git a/crates/hyperswitch_connectors/src/connectors/breadpay.rs b/crates/hyperswitch_connectors/src/connectors/breadpay.rs +index f9f040a0..a35734fd 100644 +--- a/crates/hyperswitch_connectors/src/connectors/breadpay.rs ++++ b/crates/hyperswitch_connectors/src/connectors/breadpay.rs +@@ -827,7 +827,8 @@ static BREADPAY_SUPPORTED_PAYMENT_METHODS: LazyLock = + static BREADPAY_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Breadpay", + description: "Breadpay connector", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Alpha, + }; + + static BREADPAY_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 0] = []; +diff --git a/crates/hyperswitch_connectors/src/connectors/cashtocode.rs b/crates/hyperswitch_connectors/src/connectors/cashtocode.rs +index b40c6db4..c47cb8d7 100644 +--- a/crates/hyperswitch_connectors/src/connectors/cashtocode.rs ++++ b/crates/hyperswitch_connectors/src/connectors/cashtocode.rs +@@ -489,7 +489,8 @@ static CASHTOCODE_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "CashToCode", + description: + "CashToCode is a payment solution that enables users to convert cash into digital vouchers for online transactions", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Live, + }; + + static CASHTOCODE_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 1] = [enums::EventClass::Payments]; +diff --git a/crates/hyperswitch_connectors/src/connectors/celero.rs b/crates/hyperswitch_connectors/src/connectors/celero.rs +index 726791a7..ee5320bd 100644 +--- a/crates/hyperswitch_connectors/src/connectors/celero.rs ++++ b/crates/hyperswitch_connectors/src/connectors/celero.rs +@@ -780,7 +780,8 @@ static CELERO_SUPPORTED_PAYMENT_METHODS: LazyLock = Laz + static CELERO_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Celero", + description: "Celero is your trusted provider for payment processing technology and solutions, with a commitment to helping small to mid-sized businesses thrive", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: common_enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: common_enums::ConnectorIntegrationStatus::Alpha, + }; + + impl ConnectorSpecifications for Celero { +diff --git a/crates/hyperswitch_connectors/src/connectors/checkbook.rs b/crates/hyperswitch_connectors/src/connectors/checkbook.rs +index 5c4411c6..90c1fd91 100644 +--- a/crates/hyperswitch_connectors/src/connectors/checkbook.rs ++++ b/crates/hyperswitch_connectors/src/connectors/checkbook.rs +@@ -640,7 +640,8 @@ static CHECKBOOK_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Checkbook", + description: + "Checkbook is a payment platform that allows users to send and receive digital checks.", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: common_enums::ConnectorIntegrationStatus::Beta, + }; + + static CHECKBOOK_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 1] = [enums::EventClass::Payments]; +diff --git a/crates/hyperswitch_connectors/src/connectors/checkout.rs b/crates/hyperswitch_connectors/src/connectors/checkout.rs +index 7fc205a0..8f13ed1e 100644 +--- a/crates/hyperswitch_connectors/src/connectors/checkout.rs ++++ b/crates/hyperswitch_connectors/src/connectors/checkout.rs +@@ -1553,7 +1553,8 @@ static CHECKOUT_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Checkout", + description: + "Checkout.com is a British multinational financial technology company that processes payments for other companies.", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Live, + }; + + static CHECKOUT_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 3] = [ +diff --git a/crates/hyperswitch_connectors/src/connectors/coinbase.rs b/crates/hyperswitch_connectors/src/connectors/coinbase.rs +index e776a2d3..09e4a61e 100644 +--- a/crates/hyperswitch_connectors/src/connectors/coinbase.rs ++++ b/crates/hyperswitch_connectors/src/connectors/coinbase.rs +@@ -461,7 +461,8 @@ lazy_static! { + display_name: "Coinbase", + description: + "Coinbase is a place for people and businesses to buy, sell, and manage crypto.", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Beta, + }; + static ref COINBASE_SUPPORTED_PAYMENT_METHODS: SupportedPaymentMethods = { + let supported_capture_methods = vec![ +diff --git a/crates/hyperswitch_connectors/src/connectors/coingate.rs b/crates/hyperswitch_connectors/src/connectors/coingate.rs +index 1c50c4fc..a7c14e96 100644 +--- a/crates/hyperswitch_connectors/src/connectors/coingate.rs ++++ b/crates/hyperswitch_connectors/src/connectors/coingate.rs +@@ -641,7 +641,8 @@ static COINGATE_SUPPORTED_PAYMENT_METHODS: LazyLock = + static COINGATE_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Coingate", + description: "CoinGate's online payment solution makes it easy for businesses to accept Bitcoin, Ethereum, stablecoins and other cryptocurrencies for payments on any website.", +- connector_type: enums::PaymentConnectorCategory::AlternativePaymentMethod, ++ connector_type: enums::HyperswitchConnectorCategory::AlternativePaymentMethod, ++ integration_status: enums::ConnectorIntegrationStatus::Sandbox, + }; + + static COINGATE_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 1] = [enums::EventClass::Payments]; +diff --git a/crates/hyperswitch_connectors/src/connectors/deutschebank.rs b/crates/hyperswitch_connectors/src/connectors/deutschebank.rs +index c0fb5e9a..5eb8881a 100644 +--- a/crates/hyperswitch_connectors/src/connectors/deutschebank.rs ++++ b/crates/hyperswitch_connectors/src/connectors/deutschebank.rs +@@ -1076,7 +1076,8 @@ static DEUTSCHEBANK_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Deutsche Bank", + description: + "Deutsche Bank is a German multinational investment bank and financial services company ", +- connector_type: enums::PaymentConnectorCategory::BankAcquirer, ++ connector_type: enums::HyperswitchConnectorCategory::BankAcquirer, ++ integration_status: enums::ConnectorIntegrationStatus::Sandbox, + }; + + static DEUTSCHEBANK_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 0] = []; +diff --git a/crates/hyperswitch_connectors/src/connectors/digitalvirgo.rs b/crates/hyperswitch_connectors/src/connectors/digitalvirgo.rs +index e0e1263c..efc5c5de 100644 +--- a/crates/hyperswitch_connectors/src/connectors/digitalvirgo.rs ++++ b/crates/hyperswitch_connectors/src/connectors/digitalvirgo.rs +@@ -556,7 +556,8 @@ static DIGITALVIRGO_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Digital Virgo", + description: + "Digital Virgo is an alternative payment provider specializing in carrier billing and mobile payments ", +- connector_type: enums::PaymentConnectorCategory::AlternativePaymentMethod, ++ connector_type: enums::HyperswitchConnectorCategory::AlternativePaymentMethod, ++ integration_status: enums::ConnectorIntegrationStatus::Alpha, + }; + + static DIGITALVIRGO_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 0] = []; +diff --git a/crates/hyperswitch_connectors/src/connectors/dlocal.rs b/crates/hyperswitch_connectors/src/connectors/dlocal.rs +index fdf3ceb8..69873cd5 100644 +--- a/crates/hyperswitch_connectors/src/connectors/dlocal.rs ++++ b/crates/hyperswitch_connectors/src/connectors/dlocal.rs +@@ -763,7 +763,8 @@ lazy_static! { + display_name: "DLOCAL", + description: + "Dlocal is a cross-border payment processor enabling businesses to accept and send payments in emerging markets worldwide.", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Sandbox, + }; + + static ref DLOCAL_SUPPORTED_WEBHOOK_FLOWS: Vec = Vec::new(); +diff --git a/crates/hyperswitch_connectors/src/connectors/dwolla.rs b/crates/hyperswitch_connectors/src/connectors/dwolla.rs +index e6bd12ea..a66e05e7 100644 +--- a/crates/hyperswitch_connectors/src/connectors/dwolla.rs ++++ b/crates/hyperswitch_connectors/src/connectors/dwolla.rs +@@ -983,7 +983,8 @@ static DWOLLA_SUPPORTED_PAYMENT_METHODS: LazyLock = Laz + static DWOLLA_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Dwolla", + description: "Dwolla is a multinational financial technology company offering financial services and software as a service (SaaS)", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Beta, + }; + + static DWOLLA_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 2] = +diff --git a/crates/hyperswitch_connectors/src/connectors/ebanx.rs b/crates/hyperswitch_connectors/src/connectors/ebanx.rs +index f0727a2c..0ffcd4c2 100644 +--- a/crates/hyperswitch_connectors/src/connectors/ebanx.rs ++++ b/crates/hyperswitch_connectors/src/connectors/ebanx.rs +@@ -26,7 +26,9 @@ use hyperswitch_domain_models::{ + PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData, + RefundsData, SetupMandateRequestData, + }, +- router_response_types::{PaymentsResponseData, RefundsResponseData}, ++ router_response_types::{ ++ ConnectorInfo, PaymentsResponseData, RefundsResponseData, SupportedPaymentMethods, ++ }, + }; + #[cfg(feature = "payouts")] + use hyperswitch_interfaces::types::{PayoutCancelType, PayoutCreateType, PayoutFulfillType}; +@@ -449,4 +451,23 @@ impl IncomingWebhook for Ebanx { + } + } + +-impl ConnectorSpecifications for Ebanx {} ++static EBANX_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { ++ display_name: "Ebanx", ++ description: "EBANX payout connector for cross-border disbursements and local currency payouts across Latin America, Africa, and emerging markets", ++ connector_type: common_enums::HyperswitchConnectorCategory::PayoutProcessor, ++ integration_status: common_enums::ConnectorIntegrationStatus::Sandbox, ++}; ++ ++impl ConnectorSpecifications for Ebanx { ++ fn get_connector_about(&self) -> Option<&'static ConnectorInfo> { ++ Some(&EBANX_CONNECTOR_INFO) ++ } ++ ++ fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> { ++ None ++ } ++ ++ fn get_supported_webhook_flows(&self) -> Option<&'static [common_enums::enums::EventClass]> { ++ None ++ } ++} +diff --git a/crates/hyperswitch_connectors/src/connectors/elavon.rs b/crates/hyperswitch_connectors/src/connectors/elavon.rs +index ee8f5cde..e66354c6 100644 +--- a/crates/hyperswitch_connectors/src/connectors/elavon.rs ++++ b/crates/hyperswitch_connectors/src/connectors/elavon.rs +@@ -661,7 +661,8 @@ static ELAVON_SUPPORTED_PAYMENT_METHODS: LazyLock = Laz + static ELAVON_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Elavon", + description: "Elavon, a wholly owned subsidiary of U.S. Bank, has been a global leader in payment processing for more than 30 years.", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Sandbox, + }; + + static ELAVON_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 0] = []; +diff --git a/crates/hyperswitch_connectors/src/connectors/facilitapay.rs b/crates/hyperswitch_connectors/src/connectors/facilitapay.rs +index ffb74cc3..19f4c878 100644 +--- a/crates/hyperswitch_connectors/src/connectors/facilitapay.rs ++++ b/crates/hyperswitch_connectors/src/connectors/facilitapay.rs +@@ -920,7 +920,8 @@ lazy_static! { + "Facilitapay", + description: + "FacilitaPay, the best and most reliable payment provider for your international business.", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Sandbox, + }; + static ref FACILITAPAY_SUPPORTED_PAYMENT_METHODS: SupportedPaymentMethods = { + let facilitapay_supported_capture_methods = vec![ +diff --git a/crates/hyperswitch_connectors/src/connectors/fiserv.rs b/crates/hyperswitch_connectors/src/connectors/fiserv.rs +index 79af6650..b662d1cf 100644 +--- a/crates/hyperswitch_connectors/src/connectors/fiserv.rs ++++ b/crates/hyperswitch_connectors/src/connectors/fiserv.rs +@@ -1019,7 +1019,8 @@ static FISERV_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Fiserv", + description: + "Fiserv is a global fintech and payments company with solutions for banking, global commerce, merchant acquiring, billing and payments, and point-of-sale ", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Sandbox, + }; + + static FISERV_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 0] = []; +diff --git a/crates/hyperswitch_connectors/src/connectors/fiservemea.rs b/crates/hyperswitch_connectors/src/connectors/fiservemea.rs +index 54be88d0..4c4500a3 100644 +--- a/crates/hyperswitch_connectors/src/connectors/fiservemea.rs ++++ b/crates/hyperswitch_connectors/src/connectors/fiservemea.rs +@@ -853,7 +853,8 @@ static FISERVEMEA_SUPPORTED_PAYMENT_METHODS: LazyLock = + static FISERVEMEA_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Fiservemea", + description: "Fiserv powers over 6+ million merchants and 10,000+ financial institutions enabling them to accept billions of payments a year.", +- connector_type: enums::PaymentConnectorCategory::BankAcquirer, ++ connector_type: enums::HyperswitchConnectorCategory::BankAcquirer, ++ integration_status: enums::ConnectorIntegrationStatus::Sandbox, + }; + + static FISERVEMEA_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 0] = []; +diff --git a/crates/hyperswitch_connectors/src/connectors/fiuu.rs b/crates/hyperswitch_connectors/src/connectors/fiuu.rs +index 50dde63f..3b41ebdd 100644 +--- a/crates/hyperswitch_connectors/src/connectors/fiuu.rs ++++ b/crates/hyperswitch_connectors/src/connectors/fiuu.rs +@@ -1115,7 +1115,8 @@ static FIUU_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Fiuu", + description: + "Fiuu, formerly known as Razer Merchant Services, is a leading online payment gateway in Southeast Asia, offering secure and seamless payment solutions for businesses of all sizes, including credit and debit cards, e-wallets, and bank transfers.", +- connector_type: common_enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: common_enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: common_enums::ConnectorIntegrationStatus::Live, + }; + + static FIUU_SUPPORTED_WEBHOOK_FLOWS: [common_enums::EventClass; 2] = [ +diff --git a/crates/hyperswitch_connectors/src/connectors/flexiti.rs b/crates/hyperswitch_connectors/src/connectors/flexiti.rs +index 7516cfad..16a664bf 100644 +--- a/crates/hyperswitch_connectors/src/connectors/flexiti.rs ++++ b/crates/hyperswitch_connectors/src/connectors/flexiti.rs +@@ -749,7 +749,8 @@ static FLEXITI_SUPPORTED_PAYMENT_METHODS: LazyLock = La + static FLEXITI_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Flexiti", + description: "Flexiti connector", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Alpha, + }; + + static FLEXITI_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 0] = []; +diff --git a/crates/hyperswitch_connectors/src/connectors/forte.rs b/crates/hyperswitch_connectors/src/connectors/forte.rs +index f190ab82..cabfc43b 100644 +--- a/crates/hyperswitch_connectors/src/connectors/forte.rs ++++ b/crates/hyperswitch_connectors/src/connectors/forte.rs +@@ -783,7 +783,8 @@ static FORTE_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Forte", + description: + "CSG Forte offers a unified payments platform, enabling businesses to securely process credit cards, debit cards, ACH/eCheck transactions, and more, with advanced fraud prevention and seamless integration.", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Sandbox, + }; + + static FORTE_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 0] = []; +diff --git a/crates/hyperswitch_connectors/src/connectors/getnet.rs b/crates/hyperswitch_connectors/src/connectors/getnet.rs +index bf5bd83c..12a7393f 100644 +--- a/crates/hyperswitch_connectors/src/connectors/getnet.rs ++++ b/crates/hyperswitch_connectors/src/connectors/getnet.rs +@@ -864,7 +864,8 @@ static GETNET_SUPPORTED_PAYMENT_METHODS: LazyLock = Laz + static GETNET_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Getnet", + description: "Getnet is a high-tech global payment platform that helps businesses accept payments securely while providing the best frictionless experience for customers everywhere.", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Alpha, + }; + + static GETNET_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 2] = +diff --git a/crates/hyperswitch_connectors/src/connectors/globalpay.rs b/crates/hyperswitch_connectors/src/connectors/globalpay.rs +index 29d033c3..4009d16f 100644 +--- a/crates/hyperswitch_connectors/src/connectors/globalpay.rs ++++ b/crates/hyperswitch_connectors/src/connectors/globalpay.rs +@@ -1226,7 +1226,8 @@ static GLOBALPAY_SUPPORTED_PAYMENT_METHODS: LazyLock = + static GLOBALPAY_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Globalpay", + description: "Global Payments is an American multinational financial technology company that provides payment technology and services to merchants, issuers and consumers.", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Sandbox, + }; + + static GLOBALPAY_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 1] = [enums::EventClass::Payments]; +diff --git a/crates/hyperswitch_connectors/src/connectors/globepay.rs b/crates/hyperswitch_connectors/src/connectors/globepay.rs +index 0e19e686..d5a208dc 100644 +--- a/crates/hyperswitch_connectors/src/connectors/globepay.rs ++++ b/crates/hyperswitch_connectors/src/connectors/globepay.rs +@@ -602,7 +602,8 @@ static GLOBEPAY_SUPPORTED_PAYMENT_METHODS: LazyLock = + static GLOBEPAY_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Globepay", + description: "GlobePay Limited is a professional cross-border payment solution provider (WeChat Pay & Alipay) in the UK", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Sandbox, + }; + + static GLOBEPAY_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 0] = []; +diff --git a/crates/hyperswitch_connectors/src/connectors/gocardless.rs b/crates/hyperswitch_connectors/src/connectors/gocardless.rs +index f0dd07cf..2ded0f53 100644 +--- a/crates/hyperswitch_connectors/src/connectors/gocardless.rs ++++ b/crates/hyperswitch_connectors/src/connectors/gocardless.rs +@@ -923,7 +923,8 @@ lazy_static! { + static ref GOCARDLESS_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "GoCardless", + description: "GoCardless is a fintech company that specialises in bank payments including recurring payments.", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Sandbox, + }; + static ref GOCARDLESS_SUPPORTED_WEBHOOK_FLOWS: Vec = vec![enums::EventClass::Payments, enums::EventClass::Refunds, enums::EventClass::Mandates]; + } +diff --git a/crates/hyperswitch_connectors/src/connectors/gpayments.rs b/crates/hyperswitch_connectors/src/connectors/gpayments.rs +index 4db7eace..18d211ac 100644 +--- a/crates/hyperswitch_connectors/src/connectors/gpayments.rs ++++ b/crates/hyperswitch_connectors/src/connectors/gpayments.rs +@@ -29,7 +29,8 @@ use hyperswitch_domain_models::{ + RefundsData, SetupMandateRequestData, + }, + router_response_types::{ +- AuthenticationResponseData, PaymentsResponseData, RefundsResponseData, ++ AuthenticationResponseData, ConnectorInfo, PaymentsResponseData, RefundsResponseData, ++ SupportedPaymentMethods, + }, + }; + use hyperswitch_interfaces::{ +@@ -590,4 +591,23 @@ impl + } + } + +-impl ConnectorSpecifications for Gpayments {} ++static GPAYMENTS_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { ++ display_name: "GPayments", ++ description: "GPayments authentication connector for 3D Secure MPI/ACS services supporting Visa Secure, Mastercard SecureCode, and global card authentication standards", ++ connector_type: common_enums::HyperswitchConnectorCategory::AuthenticationProvider, ++ integration_status: common_enums::ConnectorIntegrationStatus::Alpha, ++}; ++ ++impl ConnectorSpecifications for Gpayments { ++ fn get_connector_about(&self) -> Option<&'static ConnectorInfo> { ++ Some(&GPAYMENTS_CONNECTOR_INFO) ++ } ++ ++ fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> { ++ None ++ } ++ ++ fn get_supported_webhook_flows(&self) -> Option<&'static [common_enums::enums::EventClass]> { ++ None ++ } ++} +diff --git a/crates/hyperswitch_connectors/src/connectors/helcim.rs b/crates/hyperswitch_connectors/src/connectors/helcim.rs +index bfa78cfd..ebcda89b 100644 +--- a/crates/hyperswitch_connectors/src/connectors/helcim.rs ++++ b/crates/hyperswitch_connectors/src/connectors/helcim.rs +@@ -902,7 +902,8 @@ static HELCIM_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Helcim", + description: + "Helcim is a payment processing company that offers transparent, affordable merchant services for businesses of all sizes", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Sandbox, + }; + + static HELCIM_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 0] = []; +diff --git a/crates/hyperswitch_connectors/src/connectors/hipay.rs b/crates/hyperswitch_connectors/src/connectors/hipay.rs +index dc3aba65..033e89eb 100644 +--- a/crates/hyperswitch_connectors/src/connectors/hipay.rs ++++ b/crates/hyperswitch_connectors/src/connectors/hipay.rs +@@ -818,7 +818,8 @@ static HIPAY_SUPPORTED_PAYMENT_METHODS: LazyLock = Lazy + static HIPAY_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Hipay", + description: "HiPay is an independent global payment service provider that is based in France.", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Sandbox, + }; + + static HIPAY_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 0] = []; +diff --git a/crates/hyperswitch_connectors/src/connectors/hyperwallet.rs b/crates/hyperswitch_connectors/src/connectors/hyperwallet.rs +index 55485d57..6f9069e9 100644 +--- a/crates/hyperswitch_connectors/src/connectors/hyperwallet.rs ++++ b/crates/hyperswitch_connectors/src/connectors/hyperwallet.rs +@@ -605,7 +605,8 @@ static HYPERWALLET_SUPPORTED_PAYMENT_METHODS: LazyLock + static HYPERWALLET_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Hyperwallet", + description: "Hyperwallet connector", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PayoutProcessor, ++ integration_status: enums::ConnectorIntegrationStatus::Alpha, + }; + + static HYPERWALLET_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 0] = []; +diff --git a/crates/hyperswitch_connectors/src/connectors/iatapay.rs b/crates/hyperswitch_connectors/src/connectors/iatapay.rs +index 70dddc7c..7bc89727 100644 +--- a/crates/hyperswitch_connectors/src/connectors/iatapay.rs ++++ b/crates/hyperswitch_connectors/src/connectors/iatapay.rs +@@ -765,7 +765,8 @@ lazy_static! { + display_name: "Iatapay", + description: + "IATA Pay is a payment method for travellers to pay for air tickets purchased online by directly debiting their bank account.", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Live, + }; + + static ref IATAPAY_SUPPORTED_PAYMENT_METHODS: SupportedPaymentMethods = { +diff --git a/crates/hyperswitch_connectors/src/connectors/inespay.rs b/crates/hyperswitch_connectors/src/connectors/inespay.rs +index 9d655c16..08a7b3b8 100644 +--- a/crates/hyperswitch_connectors/src/connectors/inespay.rs ++++ b/crates/hyperswitch_connectors/src/connectors/inespay.rs +@@ -740,7 +740,8 @@ static INESPAY_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Inespay", + description: + "INESPAY is a payment method system that allows online shops to receive money in their bank accounts through a SEPA bank transfer ", +- connector_type: enums::PaymentConnectorCategory::BankAcquirer, ++ connector_type: enums::HyperswitchConnectorCategory::BankAcquirer, ++ integration_status: enums::ConnectorIntegrationStatus::Sandbox, + }; + + static INESPAY_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 2] = +diff --git a/crates/hyperswitch_connectors/src/connectors/itaubank.rs b/crates/hyperswitch_connectors/src/connectors/itaubank.rs +index b259a890..00cf3a01 100644 +--- a/crates/hyperswitch_connectors/src/connectors/itaubank.rs ++++ b/crates/hyperswitch_connectors/src/connectors/itaubank.rs +@@ -819,7 +819,8 @@ static ITAUBANK_SUPPORTED_PAYMENT_METHODS: LazyLock = + static ITAUBANK_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Itaubank", + description: "Itau Bank is a leading Brazilian financial institution offering a wide range of banking services, including retail banking, loans, and investment solutions.", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Sandbox, + }; + + static ITAUBANK_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 0] = []; +diff --git a/crates/hyperswitch_connectors/src/connectors/jpmorgan.rs b/crates/hyperswitch_connectors/src/connectors/jpmorgan.rs +index a9c26f6a..d0b6677b 100644 +--- a/crates/hyperswitch_connectors/src/connectors/jpmorgan.rs ++++ b/crates/hyperswitch_connectors/src/connectors/jpmorgan.rs +@@ -888,7 +888,8 @@ static JPMORGAN_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Jpmorgan", + description: + "J.P. Morgan is a global financial services firm and investment bank, offering banking, asset management, and payment processing solutions", +- connector_type: enums::PaymentConnectorCategory::BankAcquirer, ++ connector_type: enums::HyperswitchConnectorCategory::BankAcquirer, ++ integration_status: enums::ConnectorIntegrationStatus::Beta, + }; + + static JPMORGAN_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 0] = []; +diff --git a/crates/hyperswitch_connectors/src/connectors/juspaythreedsserver.rs b/crates/hyperswitch_connectors/src/connectors/juspaythreedsserver.rs +index 314c892e..91fe1d81 100644 +--- a/crates/hyperswitch_connectors/src/connectors/juspaythreedsserver.rs ++++ b/crates/hyperswitch_connectors/src/connectors/juspaythreedsserver.rs +@@ -25,7 +25,9 @@ use hyperswitch_domain_models::{ + PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData, + RefundsData, SetupMandateRequestData, + }, +- router_response_types::{PaymentsResponseData, RefundsResponseData}, ++ router_response_types::{ ++ ConnectorInfo, PaymentsResponseData, RefundsResponseData, SupportedPaymentMethods, ++ }, + types::{ + PaymentsAuthorizeRouterData, PaymentsCaptureRouterData, PaymentsSyncRouterData, + RefundSyncRouterData, RefundsRouterData, +@@ -630,4 +632,23 @@ impl webhooks::IncomingWebhook for Juspaythreedsserver { + } + } + +-impl ConnectorSpecifications for Juspaythreedsserver {} ++static JUSPAYTHREEDSSERVER_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { ++ display_name: "Juspay 3Ds Server", ++ description: "Juspay 3DS Server provider for comprehensive 3-Domain Secure authentication, cardholder verification, and fraud prevention across card networks", ++ connector_type: common_enums::HyperswitchConnectorCategory::AuthenticationProvider, ++ integration_status: common_enums::ConnectorIntegrationStatus::Alpha, ++}; ++ ++impl ConnectorSpecifications for Juspaythreedsserver { ++ fn get_connector_about(&self) -> Option<&'static ConnectorInfo> { ++ Some(&JUSPAYTHREEDSSERVER_CONNECTOR_INFO) ++ } ++ ++ fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> { ++ None ++ } ++ ++ fn get_supported_webhook_flows(&self) -> Option<&'static [common_enums::enums::EventClass]> { ++ None ++ } ++} +diff --git a/crates/hyperswitch_connectors/src/connectors/katapult.rs b/crates/hyperswitch_connectors/src/connectors/katapult.rs +index 37c18588..d7908776 100644 +--- a/crates/hyperswitch_connectors/src/connectors/katapult.rs ++++ b/crates/hyperswitch_connectors/src/connectors/katapult.rs +@@ -606,7 +606,8 @@ static KATAPULT_SUPPORTED_PAYMENT_METHODS: LazyLock = + static KATAPULT_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Katapult", + description: "Katapult connector", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Alpha, + }; + + static KATAPULT_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 0] = []; +diff --git a/crates/hyperswitch_connectors/src/connectors/klarna.rs b/crates/hyperswitch_connectors/src/connectors/klarna.rs +index 070382ce..b106576b 100644 +--- a/crates/hyperswitch_connectors/src/connectors/klarna.rs ++++ b/crates/hyperswitch_connectors/src/connectors/klarna.rs +@@ -1422,7 +1422,8 @@ static KLARNA_SUPPORTED_PAYMENT_METHODS: LazyLock = Laz + static KLARNA_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Klarna", + description: "Klarna provides payment processing services for the e-commerce industry, managing store claims and customer payments.", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Live, + }; + + static KLARNA_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 0] = []; +diff --git a/crates/hyperswitch_connectors/src/connectors/mifinity.rs b/crates/hyperswitch_connectors/src/connectors/mifinity.rs +index 00919688..ce58e69e 100644 +--- a/crates/hyperswitch_connectors/src/connectors/mifinity.rs ++++ b/crates/hyperswitch_connectors/src/connectors/mifinity.rs +@@ -536,7 +536,8 @@ lazy_static! { + display_name: "MIFINITY", + description: + "Mifinity is a payment gateway empowering you to pay online, receive funds, and send money globally, the MiFinity eWallet supports super-low fees, offering infinite possibilities to do more of the things you love.", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Live, + }; + + static ref MIFINITY_SUPPORTED_WEBHOOK_FLOWS: Vec = Vec::new(); +diff --git a/crates/hyperswitch_connectors/src/connectors/mollie.rs b/crates/hyperswitch_connectors/src/connectors/mollie.rs +index 4bc7b112..fa5617af 100644 +--- a/crates/hyperswitch_connectors/src/connectors/mollie.rs ++++ b/crates/hyperswitch_connectors/src/connectors/mollie.rs +@@ -798,7 +798,8 @@ lazy_static! { + display_name: "MOLLIE", + description: + "Mollie is a Developer-friendly processor providing simple and customizable payment solutions for businesses of all sizes.", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Sandbox, + }; + + static ref MOLLIE_SUPPORTED_WEBHOOK_FLOWS: Vec = Vec::new(); +diff --git a/crates/hyperswitch_connectors/src/connectors/moneris.rs b/crates/hyperswitch_connectors/src/connectors/moneris.rs +index 5c902281..e2d25eb4 100644 +--- a/crates/hyperswitch_connectors/src/connectors/moneris.rs ++++ b/crates/hyperswitch_connectors/src/connectors/moneris.rs +@@ -873,7 +873,8 @@ static MONERIS_SUPPORTED_PAYMENT_METHODS: LazyLock = La + static MONERIS_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Moneris", + description: "Moneris is Canada's top payment solutions provider, empowering businesses with innovative mobile, online & in-store solutions.", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Sandbox, + }; + + static MONERIS_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 0] = []; +diff --git a/crates/hyperswitch_connectors/src/connectors/mpgs.rs b/crates/hyperswitch_connectors/src/connectors/mpgs.rs +index 8f1cca83..432b1fa2 100644 +--- a/crates/hyperswitch_connectors/src/connectors/mpgs.rs ++++ b/crates/hyperswitch_connectors/src/connectors/mpgs.rs +@@ -603,7 +603,8 @@ static MPGS_SUPPORTED_PAYMENT_METHODS: LazyLock = + static MPGS_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Mpgs", + description: "Mpgs connector", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Alpha, + }; + + static MPGS_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 0] = []; +diff --git a/crates/hyperswitch_connectors/src/connectors/multisafepay.rs b/crates/hyperswitch_connectors/src/connectors/multisafepay.rs +index 0213f59c..a2410036 100644 +--- a/crates/hyperswitch_connectors/src/connectors/multisafepay.rs ++++ b/crates/hyperswitch_connectors/src/connectors/multisafepay.rs +@@ -736,7 +736,8 @@ static MULTISAFEPAY_SUPPORTED_PAYMENT_METHODS: LazyLock + static MULTISAFEPAY_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Multisafepay", + description: "MultiSafePay is a payment gateway and PSP enabling secure online transactions", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Sandbox, + }; + + static MULTISAFEPAY_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 0] = []; +diff --git a/crates/hyperswitch_connectors/src/connectors/netcetera.rs b/crates/hyperswitch_connectors/src/connectors/netcetera.rs +index 7a333a28..6c7e9ac1 100644 +--- a/crates/hyperswitch_connectors/src/connectors/netcetera.rs ++++ b/crates/hyperswitch_connectors/src/connectors/netcetera.rs +@@ -29,7 +29,8 @@ use hyperswitch_domain_models::{ + RefundsData, SetupMandateRequestData, + }, + router_response_types::{ +- AuthenticationResponseData, PaymentsResponseData, RefundsResponseData, ++ AuthenticationResponseData, ConnectorInfo, PaymentsResponseData, RefundsResponseData, ++ SupportedPaymentMethods, + }, + }; + use hyperswitch_interfaces::{ +@@ -465,4 +466,23 @@ impl + { + } + +-impl ConnectorSpecifications for Netcetera {} ++static NETCETERA_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { ++ display_name: "Netcetera", ++ description: "Netcetera authentication provider for comprehensive 3D Secure solutions including certified ACS, Directory Server, and multi-protocol EMV 3DS supports", ++ connector_type: common_enums::HyperswitchConnectorCategory::AuthenticationProvider, ++ integration_status: common_enums::ConnectorIntegrationStatus::Sandbox, ++}; ++ ++impl ConnectorSpecifications for Netcetera { ++ fn get_connector_about(&self) -> Option<&'static ConnectorInfo> { ++ Some(&NETCETERA_CONNECTOR_INFO) ++ } ++ ++ fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> { ++ None ++ } ++ ++ fn get_supported_webhook_flows(&self) -> Option<&'static [common_enums::enums::EventClass]> { ++ None ++ } ++} +diff --git a/crates/hyperswitch_connectors/src/connectors/nexinets.rs b/crates/hyperswitch_connectors/src/connectors/nexinets.rs +index 64cecb7d..a90e0d8f 100644 +--- a/crates/hyperswitch_connectors/src/connectors/nexinets.rs ++++ b/crates/hyperswitch_connectors/src/connectors/nexinets.rs +@@ -864,7 +864,8 @@ static NEXINETS_SUPPORTED_PAYMENT_METHODS: LazyLock = + static NEXINETS_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Nexinets", + description: "Nexi and Nets join forces to create The European PayTech leader, a strategic combination to offer future-proof innovative payment solutions.", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Sandbox, + }; + + static NEXINETS_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 0] = []; +diff --git a/crates/hyperswitch_connectors/src/connectors/nexixpay.rs b/crates/hyperswitch_connectors/src/connectors/nexixpay.rs +index 82702d09..e5b04a71 100644 +--- a/crates/hyperswitch_connectors/src/connectors/nexixpay.rs ++++ b/crates/hyperswitch_connectors/src/connectors/nexixpay.rs +@@ -1080,7 +1080,8 @@ lazy_static! { + static ref NEXIXPAY_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Nexixpay", + description: "Nexixpay is an Italian bank that specialises in payment systems such as Nexi Payments (formerly known as CartaSi).", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Sandbox, + }; + + static ref NEXIXPAY_SUPPORTED_PAYMENT_METHODS: SupportedPaymentMethods = { +diff --git a/crates/hyperswitch_connectors/src/connectors/nomupay.rs b/crates/hyperswitch_connectors/src/connectors/nomupay.rs +index 69bacb8a..e5e90250 100644 +--- a/crates/hyperswitch_connectors/src/connectors/nomupay.rs ++++ b/crates/hyperswitch_connectors/src/connectors/nomupay.rs +@@ -26,7 +26,9 @@ use hyperswitch_domain_models::{ + PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData, + RefundsData, SetupMandateRequestData, + }, +- router_response_types::{PaymentsResponseData, RefundsResponseData}, ++ router_response_types::{ ++ ConnectorInfo, PaymentsResponseData, RefundsResponseData, SupportedPaymentMethods, ++ }, + }; + #[cfg(feature = "payouts")] + use hyperswitch_domain_models::{ +@@ -765,4 +767,23 @@ impl webhooks::IncomingWebhook for Nomupay { + } + } + +-impl ConnectorSpecifications for Nomupay {} ++static NOMUPAY_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { ++ display_name: "Nomupay", ++ description: "Nomupay payouts connector for disbursements to recipients' bank accounts and alternative payment methods in Southeast Asia and the Pacific Islands", ++ connector_type: common_enums::HyperswitchConnectorCategory::PayoutProcessor, ++ integration_status: common_enums::ConnectorIntegrationStatus::Sandbox, ++}; ++ ++impl ConnectorSpecifications for Nomupay { ++ fn get_connector_about(&self) -> Option<&'static ConnectorInfo> { ++ Some(&NOMUPAY_CONNECTOR_INFO) ++ } ++ ++ fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> { ++ None ++ } ++ ++ fn get_supported_webhook_flows(&self) -> Option<&'static [common_enums::enums::EventClass]> { ++ None ++ } ++} +diff --git a/crates/hyperswitch_connectors/src/connectors/nordea.rs b/crates/hyperswitch_connectors/src/connectors/nordea.rs +index 60f3fd40..8eb29c3f 100644 +--- a/crates/hyperswitch_connectors/src/connectors/nordea.rs ++++ b/crates/hyperswitch_connectors/src/connectors/nordea.rs +@@ -1123,7 +1123,8 @@ lazy_static! { + "Nordea", + description: + "Nordea is one of the leading financial services group in the Nordics and the preferred choice for millions across the region.", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: common_enums::ConnectorIntegrationStatus::Beta, + }; + static ref NORDEA_SUPPORTED_PAYMENT_METHODS: SupportedPaymentMethods = { + let nordea_supported_capture_methods = vec![ +diff --git a/crates/hyperswitch_connectors/src/connectors/novalnet.rs b/crates/hyperswitch_connectors/src/connectors/novalnet.rs +index 453e31ad..8914d84a 100644 +--- a/crates/hyperswitch_connectors/src/connectors/novalnet.rs ++++ b/crates/hyperswitch_connectors/src/connectors/novalnet.rs +@@ -1088,7 +1088,8 @@ static NOVALNET_SUPPORTED_PAYMENT_METHODS: LazyLock = + static NOVALNET_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Novalnet", + description: "Novalnet provides tailored, data-driven payment solutions that maximize acceptance, boost conversions, and deliver seamless customer experiences worldwide.", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Live, + }; + + static NOVALNET_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 4] = [ +diff --git a/crates/hyperswitch_connectors/src/connectors/nuvei.rs b/crates/hyperswitch_connectors/src/connectors/nuvei.rs +index e02168e1..3701a814 100644 +--- a/crates/hyperswitch_connectors/src/connectors/nuvei.rs ++++ b/crates/hyperswitch_connectors/src/connectors/nuvei.rs +@@ -1237,7 +1237,8 @@ static NUVEI_SUPPORTED_PAYMENT_METHODS: LazyLock = Lazy + static NUVEI_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Nuvei", + description: "Nuvei is the Canadian fintech company accelerating the business of clients around the world.", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Beta, + }; + + static NUVEI_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 1] = [enums::EventClass::Payments]; +diff --git a/crates/hyperswitch_connectors/src/connectors/opennode.rs b/crates/hyperswitch_connectors/src/connectors/opennode.rs +index 17c46577..203535db 100644 +--- a/crates/hyperswitch_connectors/src/connectors/opennode.rs ++++ b/crates/hyperswitch_connectors/src/connectors/opennode.rs +@@ -483,7 +483,8 @@ static OPENNODE_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Opennode", + description: + "OpenNode offers accessible way for e-commerce businesses to process bitcoin payments.", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Beta, + }; + + static OPENNODE_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 1] = [enums::EventClass::Payments]; +diff --git a/crates/hyperswitch_connectors/src/connectors/paybox.rs b/crates/hyperswitch_connectors/src/connectors/paybox.rs +index d626f7c0..2213e4b1 100644 +--- a/crates/hyperswitch_connectors/src/connectors/paybox.rs ++++ b/crates/hyperswitch_connectors/src/connectors/paybox.rs +@@ -760,7 +760,8 @@ static PAYBOX_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Paybox", + description: + "Paybox is a payment gateway that enables businesses to process online transactions securely ", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Sandbox, + }; + + static PAYBOX_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 0] = []; +diff --git a/crates/hyperswitch_connectors/src/connectors/payload.rs b/crates/hyperswitch_connectors/src/connectors/payload.rs +index 663e0e3e..792fa493 100644 +--- a/crates/hyperswitch_connectors/src/connectors/payload.rs ++++ b/crates/hyperswitch_connectors/src/connectors/payload.rs +@@ -854,7 +854,8 @@ static PAYLOAD_SUPPORTED_PAYMENT_METHODS: LazyLock = La + static PAYLOAD_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Payload", + description: "Payload is an embedded finance solution for modern platforms and businesses, automating inbound and outbound payments with an industry-leading platform and driving innovation into the future.", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Alpha, + }; + + static PAYLOAD_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 3] = [ +diff --git a/crates/hyperswitch_connectors/src/connectors/payone.rs b/crates/hyperswitch_connectors/src/connectors/payone.rs +index 21f44f8c..f1a5c7b9 100644 +--- a/crates/hyperswitch_connectors/src/connectors/payone.rs ++++ b/crates/hyperswitch_connectors/src/connectors/payone.rs +@@ -28,7 +28,9 @@ use hyperswitch_domain_models::{ + PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData, + RefundsData, SetupMandateRequestData, + }, +- router_response_types::{PaymentsResponseData, RefundsResponseData}, ++ router_response_types::{ ++ ConnectorInfo, PaymentsResponseData, RefundsResponseData, SupportedPaymentMethods, ++ }, + }; + use hyperswitch_interfaces::{ + api::{ +@@ -432,4 +434,23 @@ impl ConnectorErrorTypeMapping for Payone { + } + } + +-impl ConnectorSpecifications for Payone {} ++static PAYONE_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { ++ display_name: "Payone", ++ description: "Payone payout connector for European market disbursements and automated fund distribution with comprehensive compliance support", ++ connector_type: common_enums::HyperswitchConnectorCategory::PayoutProcessor, ++ integration_status: common_enums::ConnectorIntegrationStatus::Sandbox, ++}; ++ ++impl ConnectorSpecifications for Payone { ++ fn get_connector_about(&self) -> Option<&'static ConnectorInfo> { ++ Some(&PAYONE_CONNECTOR_INFO) ++ } ++ ++ fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> { ++ None ++ } ++ ++ fn get_supported_webhook_flows(&self) -> Option<&'static [common_enums::enums::EventClass]> { ++ None ++ } ++} +diff --git a/crates/hyperswitch_connectors/src/connectors/paystack.rs b/crates/hyperswitch_connectors/src/connectors/paystack.rs +index c2012124..96daba75 100644 +--- a/crates/hyperswitch_connectors/src/connectors/paystack.rs ++++ b/crates/hyperswitch_connectors/src/connectors/paystack.rs +@@ -684,7 +684,8 @@ static PAYSTACK_SUPPORTED_PAYMENT_METHODS: LazyLock = + static PAYSTACK_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Paystack", + description: "Paystack is a Nigerian financial technology company that provides online and offline payment solutions to businesses across Africa.", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Sandbox, + }; + + static PAYSTACK_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 2] = +diff --git a/crates/hyperswitch_connectors/src/connectors/paytm.rs b/crates/hyperswitch_connectors/src/connectors/paytm.rs +index 0de4995e..76ac0dc2 100644 +--- a/crates/hyperswitch_connectors/src/connectors/paytm.rs ++++ b/crates/hyperswitch_connectors/src/connectors/paytm.rs +@@ -623,7 +623,8 @@ lazy_static! { + display_name: "PAYTM", + description: + "Paytm is an Indian multinational fintech company specializing in digital payments and financial services. Initially known for its mobile wallet, it has expanded to include a payment bank, e-commerce, ticketing, and wealth management services.", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Alpha, + }; + + static ref PAYTM_SUPPORTED_WEBHOOK_FLOWS: Vec = Vec::new(); +diff --git a/crates/hyperswitch_connectors/src/connectors/payu.rs b/crates/hyperswitch_connectors/src/connectors/payu.rs +index c1bb0506..92d6d1f1 100644 +--- a/crates/hyperswitch_connectors/src/connectors/payu.rs ++++ b/crates/hyperswitch_connectors/src/connectors/payu.rs +@@ -883,7 +883,8 @@ static PAYU_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Payu", + description: + "PayU is a global fintech company providing online payment solutions, including card processing, UPI, wallets, and BNPL services across multiple markets ", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Sandbox, + }; + + static PAYU_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 0] = []; +diff --git a/crates/hyperswitch_connectors/src/connectors/phonepe.rs b/crates/hyperswitch_connectors/src/connectors/phonepe.rs +index 908fe3f3..5dfdb2ea 100644 +--- a/crates/hyperswitch_connectors/src/connectors/phonepe.rs ++++ b/crates/hyperswitch_connectors/src/connectors/phonepe.rs +@@ -623,7 +623,8 @@ lazy_static! { + display_name: "PHONEPE", + description: + "PhonePe is a digital payments and financial services platform built on the UPI system. It allows users to make instant payments, recharge mobiles, pay bills, and access financial services like investments and insurance.", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Alpha, + }; + + static ref PHONEPE_SUPPORTED_WEBHOOK_FLOWS: Vec = Vec::new(); +diff --git a/crates/hyperswitch_connectors/src/connectors/placetopay.rs b/crates/hyperswitch_connectors/src/connectors/placetopay.rs +index 0bdb7f2d..8cd17041 100644 +--- a/crates/hyperswitch_connectors/src/connectors/placetopay.rs ++++ b/crates/hyperswitch_connectors/src/connectors/placetopay.rs +@@ -729,7 +729,8 @@ static PLACETOPAY_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "PlacetoPay", + description: + "PlacetoPay is a Latin American financial technology company's online payment platform, offering various payment methods and integrations for businesses", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Sandbox, + }; + + static PLACETOPAY_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 0] = []; +diff --git a/crates/hyperswitch_connectors/src/connectors/powertranz.rs b/crates/hyperswitch_connectors/src/connectors/powertranz.rs +index 63f9119c..b393bc83 100644 +--- a/crates/hyperswitch_connectors/src/connectors/powertranz.rs ++++ b/crates/hyperswitch_connectors/src/connectors/powertranz.rs +@@ -669,7 +669,8 @@ lazy_static! { + display_name: "Powertranz", + description: + "Powertranz is a leading payment gateway serving the Caribbean and parts of Central America ", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Alpha, + }; + + static ref POWERTRANZ_SUPPORTED_WEBHOOK_FLOWS: Vec = Vec::new(); +diff --git a/crates/hyperswitch_connectors/src/connectors/prophetpay.rs b/crates/hyperswitch_connectors/src/connectors/prophetpay.rs +index 696d1976..486a8e8a 100644 +--- a/crates/hyperswitch_connectors/src/connectors/prophetpay.rs ++++ b/crates/hyperswitch_connectors/src/connectors/prophetpay.rs +@@ -746,7 +746,8 @@ static PROPHETPAY_SUPPORTED_PAYMENT_METHODS: LazyLock = + static PROPHETPAY_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Prophetpay", + description: "GlobePay Limited is a professional cross-border payment solution provider (WeChat Pay & Alipay) in the UK", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Alpha, + }; + + static PROPHETPAY_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 0] = []; +diff --git a/crates/hyperswitch_connectors/src/connectors/rapyd.rs b/crates/hyperswitch_connectors/src/connectors/rapyd.rs +index 0c4605f1..8f0474c5 100644 +--- a/crates/hyperswitch_connectors/src/connectors/rapyd.rs ++++ b/crates/hyperswitch_connectors/src/connectors/rapyd.rs +@@ -1037,7 +1037,8 @@ lazy_static! { + display_name: "Rapyd", + description: + "Rapyd is a fintech company that enables businesses to collect payments in local currencies across the globe ", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Sandbox, + }; + + static ref RAPYD_SUPPORTED_WEBHOOK_FLOWS: Vec = vec![enums::EventClass::Payments, enums::EventClass::Refunds, enums::EventClass::Disputes]; +diff --git a/crates/hyperswitch_connectors/src/connectors/razorpay.rs b/crates/hyperswitch_connectors/src/connectors/razorpay.rs +index 151bcea7..44f1b462 100644 +--- a/crates/hyperswitch_connectors/src/connectors/razorpay.rs ++++ b/crates/hyperswitch_connectors/src/connectors/razorpay.rs +@@ -812,7 +812,8 @@ lazy_static! { + display_name: "RAZORPAY", + description: + "Razorpay helps you accept online payments from customers across Desktop, Mobile web, Android & iOS. Additionally by using Razorpay Payment Links, you can collect payments across multiple channels like SMS, Email, Whatsapp, Chatbots & Messenger.", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Sandbox, + }; + + static ref RAZORPAY_SUPPORTED_WEBHOOK_FLOWS: Vec = vec![enums::EventClass::Payments, enums::EventClass::Refunds]; +diff --git a/crates/hyperswitch_connectors/src/connectors/redsys.rs b/crates/hyperswitch_connectors/src/connectors/redsys.rs +index 0c2e8dfa..01397a91 100644 +--- a/crates/hyperswitch_connectors/src/connectors/redsys.rs ++++ b/crates/hyperswitch_connectors/src/connectors/redsys.rs +@@ -887,7 +887,8 @@ static REDSYS_SUPPORTED_PAYMENT_METHODS: LazyLock = Laz + static REDSYS_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Redsys", + description: "Redsys is a Spanish payment gateway offering secure and innovative payment solutions for merchants and banks", +- connector_type: common_enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: common_enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: common_enums::ConnectorIntegrationStatus::Live, + }; + + static REDSYS_SUPPORTED_WEBHOOK_FLOWS: [common_enums::EventClass; 0] = []; +diff --git a/crates/hyperswitch_connectors/src/connectors/riskified.rs b/crates/hyperswitch_connectors/src/connectors/riskified.rs +index 450ec312..392cd849 100644 +--- a/crates/hyperswitch_connectors/src/connectors/riskified.rs ++++ b/crates/hyperswitch_connectors/src/connectors/riskified.rs +@@ -37,7 +37,9 @@ use hyperswitch_domain_models::{ + PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData, + RefundsData, SetupMandateRequestData, + }, +- router_response_types::{PaymentsResponseData, RefundsResponseData}, ++ router_response_types::{ ++ ConnectorInfo, PaymentsResponseData, RefundsResponseData, SupportedPaymentMethods, ++ }, + }; + use hyperswitch_interfaces::{ + api::{ +@@ -649,4 +651,23 @@ impl IncomingWebhook for Riskified { + } + } + +-impl ConnectorSpecifications for Riskified {} ++static RISKIFIED_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { ++ display_name: "Riskified", ++ description: "Riskified fraud and risk management provider with guaranteed real-time decisions and machine learning-powered ecommerce fraud prevention", ++ connector_type: common_enums::HyperswitchConnectorCategory::FraudAndRiskManagementProvider, ++ integration_status: common_enums::ConnectorIntegrationStatus::Sandbox, ++}; ++ ++impl ConnectorSpecifications for Riskified { ++ fn get_connector_about(&self) -> Option<&'static ConnectorInfo> { ++ Some(&RISKIFIED_CONNECTOR_INFO) ++ } ++ ++ fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> { ++ None ++ } ++ ++ fn get_supported_webhook_flows(&self) -> Option<&'static [common_enums::enums::EventClass]> { ++ None ++ } ++} +diff --git a/crates/hyperswitch_connectors/src/connectors/santander.rs b/crates/hyperswitch_connectors/src/connectors/santander.rs +index 47816d3a..90769e15 100644 +--- a/crates/hyperswitch_connectors/src/connectors/santander.rs ++++ b/crates/hyperswitch_connectors/src/connectors/santander.rs +@@ -878,7 +878,8 @@ static SANTANDER_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Santander", + description: + "Santander is a leading private bank in Brazil, offering a wide range of financial services across retail and corporate segments. It is part of the global Santander Group, one of Europe’s largest financial institutions.", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Alpha, + }; + + static SANTANDER_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 0] = []; +diff --git a/crates/hyperswitch_connectors/src/connectors/shift4.rs b/crates/hyperswitch_connectors/src/connectors/shift4.rs +index 35611d73..0503a551 100644 +--- a/crates/hyperswitch_connectors/src/connectors/shift4.rs ++++ b/crates/hyperswitch_connectors/src/connectors/shift4.rs +@@ -1054,7 +1054,8 @@ lazy_static! { + display_name: "Shift4", + description: + "Shift4 Payments, Inc. is an American payment processing company based in Allentown, Pennsylvania. ", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Live, + }; + + static ref SHIFT4_SUPPORTED_WEBHOOK_FLOWS: Vec = vec![enums::EventClass::Payments, enums::EventClass::Refunds]; +diff --git a/crates/hyperswitch_connectors/src/connectors/sift.rs b/crates/hyperswitch_connectors/src/connectors/sift.rs +index 3a9f6218..7d8340f2 100644 +--- a/crates/hyperswitch_connectors/src/connectors/sift.rs ++++ b/crates/hyperswitch_connectors/src/connectors/sift.rs +@@ -603,7 +603,8 @@ static SIFT_SUPPORTED_PAYMENT_METHODS: LazyLock = + static SIFT_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Sift", + description: "Sift connector", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: common_enums::ConnectorIntegrationStatus::Alpha, + }; + + static SIFT_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 0] = []; +diff --git a/crates/hyperswitch_connectors/src/connectors/signifyd.rs b/crates/hyperswitch_connectors/src/connectors/signifyd.rs +index 643d24cb..bab9e4c4 100644 +--- a/crates/hyperswitch_connectors/src/connectors/signifyd.rs ++++ b/crates/hyperswitch_connectors/src/connectors/signifyd.rs +@@ -26,7 +26,9 @@ use hyperswitch_domain_models::{ + PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData, + RefundsData, SetupMandateRequestData, + }, +- router_response_types::{PaymentsResponseData, RefundsResponseData}, ++ router_response_types::{ ++ ConnectorInfo, PaymentsResponseData, RefundsResponseData, SupportedPaymentMethods, ++ }, + }; + #[cfg(feature = "frm")] + use hyperswitch_domain_models::{ +@@ -722,4 +724,23 @@ impl IncomingWebhook for Signifyd { + } + } + +-impl ConnectorSpecifications for Signifyd {} ++static SYGNIFYD_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { ++ display_name: "Signifyd", ++ description: "Signifyd fraud and risk management provider with AI-driven commerce protection platform for maximizing conversions and eliminating fraud risk with guaranteed fraud liability coverage", ++ connector_type: common_enums::HyperswitchConnectorCategory::FraudAndRiskManagementProvider, ++ integration_status: common_enums::ConnectorIntegrationStatus::Sandbox, ++}; ++ ++impl ConnectorSpecifications for Signifyd { ++ fn get_connector_about(&self) -> Option<&'static ConnectorInfo> { ++ Some(&SYGNIFYD_CONNECTOR_INFO) ++ } ++ ++ fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> { ++ None ++ } ++ ++ fn get_supported_webhook_flows(&self) -> Option<&'static [common_enums::enums::EventClass]> { ++ None ++ } ++} +diff --git a/crates/hyperswitch_connectors/src/connectors/silverflow.rs b/crates/hyperswitch_connectors/src/connectors/silverflow.rs +index b084475c..44019a78 100644 +--- a/crates/hyperswitch_connectors/src/connectors/silverflow.rs ++++ b/crates/hyperswitch_connectors/src/connectors/silverflow.rs +@@ -959,7 +959,8 @@ static SILVERFLOW_SUPPORTED_PAYMENT_METHODS: LazyLock = + static SILVERFLOW_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Silverflow", + description: "Silverflow is a global payment processor that provides secure and reliable payment processing services with support for multiple capture methods and 3DS authentication.", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Alpha, + }; + + static SILVERFLOW_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 2] = +diff --git a/crates/hyperswitch_connectors/src/connectors/square.rs b/crates/hyperswitch_connectors/src/connectors/square.rs +index b0d9bcf1..1d65e157 100644 +--- a/crates/hyperswitch_connectors/src/connectors/square.rs ++++ b/crates/hyperswitch_connectors/src/connectors/square.rs +@@ -923,7 +923,8 @@ lazy_static! { + display_name: "Square", + description: + "Square is the largest business technology platform serving all kinds of businesses.", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Alpha, + }; + static ref SQUARE_SUPPORTED_PAYMENT_METHODS: SupportedPaymentMethods = { + let supported_capture_methods = vec![ +diff --git a/crates/hyperswitch_connectors/src/connectors/stax.rs b/crates/hyperswitch_connectors/src/connectors/stax.rs +index 5e2b9d5a..b9e3d56d 100644 +--- a/crates/hyperswitch_connectors/src/connectors/stax.rs ++++ b/crates/hyperswitch_connectors/src/connectors/stax.rs +@@ -1002,7 +1002,8 @@ static STAX_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Stax", + description: + "Stax is a payment processing platform that helps businesses accept payments and manage their payment ecosystem ", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Sandbox, + }; + + static STAX_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 2] = +diff --git a/crates/hyperswitch_connectors/src/connectors/stripe.rs b/crates/hyperswitch_connectors/src/connectors/stripe.rs +index b7810310..ce144a41 100644 +--- a/crates/hyperswitch_connectors/src/connectors/stripe.rs ++++ b/crates/hyperswitch_connectors/src/connectors/stripe.rs +@@ -1,6 +1,6 @@ + pub mod transformers; + +-use std::collections::HashMap; ++use std::{collections::HashMap, sync::LazyLock}; + + use api_models::webhooks::IncomingWebhookEvent; + use common_enums::{ +@@ -34,8 +34,9 @@ use hyperswitch_domain_models::{ + SplitRefundsRequest, SubmitEvidenceRequestData, UploadFileRequestData, + }, + router_response_types::{ +- PaymentsResponseData, RefundsResponseData, RetrieveFileResponse, SubmitEvidenceResponse, +- UploadFileResponse, ++ ConnectorInfo, PaymentMethodDetails, PaymentsResponseData, RefundsResponseData, ++ RetrieveFileResponse, SubmitEvidenceResponse, SupportedPaymentMethods, ++ SupportedPaymentMethodsExt, UploadFileResponse, + }, + types::{ + ConnectorCustomerRouterData, PaymentsAuthorizeRouterData, PaymentsCancelRouterData, +@@ -2926,4 +2927,378 @@ impl ConnectorIntegration + } + } + +-impl ConnectorSpecifications for Stripe {} ++static STRIPE_SUPPORTED_PAYMENT_METHODS: LazyLock = LazyLock::new(|| { ++ let default_capture_methods = vec![ ++ CaptureMethod::Automatic, ++ CaptureMethod::Manual, ++ CaptureMethod::SequentialAutomatic, ++ ]; ++ ++ let automatic_capture_supported = ++ vec![CaptureMethod::Automatic, CaptureMethod::SequentialAutomatic]; ++ ++ let supported_card_network = vec![ ++ common_enums::CardNetwork::Visa, ++ common_enums::CardNetwork::Mastercard, ++ common_enums::CardNetwork::AmericanExpress, ++ common_enums::CardNetwork::Discover, ++ common_enums::CardNetwork::JCB, ++ common_enums::CardNetwork::DinersClub, ++ common_enums::CardNetwork::UnionPay, ++ ]; ++ ++ let mut stripe_supported_payment_methods = SupportedPaymentMethods::new(); ++ ++ stripe_supported_payment_methods.add( ++ common_enums::PaymentMethod::Card, ++ PaymentMethodType::Credit, ++ PaymentMethodDetails { ++ mandates: common_enums::FeatureStatus::Supported, ++ refunds: common_enums::FeatureStatus::Supported, ++ supported_capture_methods: default_capture_methods.clone(), ++ specific_features: Some( ++ api_models::feature_matrix::PaymentMethodSpecificFeatures::Card( ++ api_models::feature_matrix::CardSpecificFeatures { ++ three_ds: common_enums::FeatureStatus::Supported, ++ no_three_ds: common_enums::FeatureStatus::Supported, ++ supported_card_networks: supported_card_network.clone(), ++ }, ++ ), ++ ), ++ }, ++ ); ++ ++ stripe_supported_payment_methods.add( ++ common_enums::PaymentMethod::Card, ++ PaymentMethodType::Debit, ++ PaymentMethodDetails { ++ mandates: common_enums::FeatureStatus::Supported, ++ refunds: common_enums::FeatureStatus::Supported, ++ supported_capture_methods: default_capture_methods.clone(), ++ specific_features: Some( ++ api_models::feature_matrix::PaymentMethodSpecificFeatures::Card( ++ api_models::feature_matrix::CardSpecificFeatures { ++ three_ds: common_enums::FeatureStatus::Supported, ++ no_three_ds: common_enums::FeatureStatus::Supported, ++ supported_card_networks: supported_card_network.clone(), ++ }, ++ ), ++ ), ++ }, ++ ); ++ ++ stripe_supported_payment_methods.add( ++ common_enums::PaymentMethod::PayLater, ++ PaymentMethodType::Klarna, ++ PaymentMethodDetails { ++ mandates: common_enums::FeatureStatus::NotSupported, ++ refunds: common_enums::FeatureStatus::Supported, ++ supported_capture_methods: default_capture_methods.clone(), ++ specific_features: None, ++ }, ++ ); ++ ++ stripe_supported_payment_methods.add( ++ common_enums::PaymentMethod::PayLater, ++ PaymentMethodType::Affirm, ++ PaymentMethodDetails { ++ mandates: common_enums::FeatureStatus::NotSupported, ++ refunds: common_enums::FeatureStatus::Supported, ++ supported_capture_methods: default_capture_methods.clone(), ++ specific_features: None, ++ }, ++ ); ++ ++ stripe_supported_payment_methods.add( ++ common_enums::PaymentMethod::PayLater, ++ PaymentMethodType::AfterpayClearpay, ++ PaymentMethodDetails { ++ mandates: common_enums::FeatureStatus::NotSupported, ++ refunds: common_enums::FeatureStatus::Supported, ++ supported_capture_methods: default_capture_methods.clone(), ++ specific_features: None, ++ }, ++ ); ++ ++ stripe_supported_payment_methods.add( ++ common_enums::PaymentMethod::Wallet, ++ PaymentMethodType::AliPay, ++ PaymentMethodDetails { ++ mandates: common_enums::FeatureStatus::NotSupported, ++ refunds: common_enums::FeatureStatus::Supported, ++ supported_capture_methods: default_capture_methods.clone(), ++ specific_features: None, ++ }, ++ ); ++ ++ stripe_supported_payment_methods.add( ++ common_enums::PaymentMethod::Wallet, ++ PaymentMethodType::AmazonPay, ++ PaymentMethodDetails { ++ mandates: common_enums::FeatureStatus::Supported, ++ refunds: common_enums::FeatureStatus::Supported, ++ supported_capture_methods: default_capture_methods.clone(), ++ specific_features: None, ++ }, ++ ); ++ ++ stripe_supported_payment_methods.add( ++ common_enums::PaymentMethod::Wallet, ++ PaymentMethodType::ApplePay, ++ PaymentMethodDetails { ++ mandates: common_enums::FeatureStatus::Supported, ++ refunds: common_enums::FeatureStatus::Supported, ++ supported_capture_methods: default_capture_methods.clone(), ++ specific_features: None, ++ }, ++ ); ++ ++ stripe_supported_payment_methods.add( ++ common_enums::PaymentMethod::Wallet, ++ PaymentMethodType::GooglePay, ++ PaymentMethodDetails { ++ mandates: common_enums::FeatureStatus::Supported, ++ refunds: common_enums::FeatureStatus::Supported, ++ supported_capture_methods: default_capture_methods.clone(), ++ specific_features: None, ++ }, ++ ); ++ ++ stripe_supported_payment_methods.add( ++ common_enums::PaymentMethod::Wallet, ++ PaymentMethodType::WeChatPay, ++ PaymentMethodDetails { ++ mandates: common_enums::FeatureStatus::NotSupported, ++ refunds: common_enums::FeatureStatus::Supported, ++ supported_capture_methods: automatic_capture_supported.clone(), ++ specific_features: None, ++ }, ++ ); ++ ++ stripe_supported_payment_methods.add( ++ common_enums::PaymentMethod::Wallet, ++ PaymentMethodType::Cashapp, ++ PaymentMethodDetails { ++ mandates: common_enums::FeatureStatus::Supported, ++ refunds: common_enums::FeatureStatus::Supported, ++ supported_capture_methods: default_capture_methods.clone(), ++ specific_features: None, ++ }, ++ ); ++ ++ stripe_supported_payment_methods.add( ++ common_enums::PaymentMethod::Wallet, ++ PaymentMethodType::RevolutPay, ++ PaymentMethodDetails { ++ mandates: common_enums::FeatureStatus::Supported, ++ refunds: common_enums::FeatureStatus::Supported, ++ supported_capture_methods: default_capture_methods.clone(), ++ specific_features: None, ++ }, ++ ); ++ ++ stripe_supported_payment_methods.add( ++ common_enums::PaymentMethod::BankDebit, ++ PaymentMethodType::Becs, ++ PaymentMethodDetails { ++ mandates: common_enums::FeatureStatus::Supported, ++ refunds: common_enums::FeatureStatus::Supported, ++ supported_capture_methods: default_capture_methods.clone(), ++ specific_features: None, ++ }, ++ ); ++ ++ stripe_supported_payment_methods.add( ++ common_enums::PaymentMethod::BankDebit, ++ PaymentMethodType::Ach, ++ PaymentMethodDetails { ++ mandates: common_enums::FeatureStatus::Supported, ++ refunds: common_enums::FeatureStatus::Supported, ++ supported_capture_methods: automatic_capture_supported.clone(), ++ specific_features: None, ++ }, ++ ); ++ ++ stripe_supported_payment_methods.add( ++ common_enums::PaymentMethod::BankDebit, ++ PaymentMethodType::Sepa, ++ PaymentMethodDetails { ++ mandates: common_enums::FeatureStatus::Supported, ++ refunds: common_enums::FeatureStatus::Supported, ++ supported_capture_methods: automatic_capture_supported.clone(), ++ specific_features: None, ++ }, ++ ); ++ ++ stripe_supported_payment_methods.add( ++ common_enums::PaymentMethod::BankDebit, ++ PaymentMethodType::Bacs, ++ PaymentMethodDetails { ++ mandates: common_enums::FeatureStatus::Supported, ++ refunds: common_enums::FeatureStatus::Supported, ++ supported_capture_methods: default_capture_methods.clone(), ++ specific_features: None, ++ }, ++ ); ++ ++ stripe_supported_payment_methods.add( ++ common_enums::PaymentMethod::BankRedirect, ++ PaymentMethodType::BancontactCard, ++ PaymentMethodDetails { ++ mandates: common_enums::FeatureStatus::Supported, ++ refunds: common_enums::FeatureStatus::Supported, ++ supported_capture_methods: automatic_capture_supported.clone(), ++ specific_features: None, ++ }, ++ ); ++ ++ stripe_supported_payment_methods.add( ++ common_enums::PaymentMethod::BankRedirect, ++ PaymentMethodType::Blik, ++ PaymentMethodDetails { ++ mandates: common_enums::FeatureStatus::NotSupported, ++ refunds: common_enums::FeatureStatus::Supported, ++ supported_capture_methods: automatic_capture_supported.clone(), ++ specific_features: None, ++ }, ++ ); ++ ++ stripe_supported_payment_methods.add( ++ common_enums::PaymentMethod::BankTransfer, ++ PaymentMethodType::Ach, ++ PaymentMethodDetails { ++ mandates: common_enums::FeatureStatus::NotSupported, ++ refunds: common_enums::FeatureStatus::Supported, ++ supported_capture_methods: automatic_capture_supported.clone(), ++ specific_features: None, ++ }, ++ ); ++ ++ stripe_supported_payment_methods.add( ++ common_enums::PaymentMethod::BankTransfer, ++ PaymentMethodType::SepaBankTransfer, ++ PaymentMethodDetails { ++ mandates: common_enums::FeatureStatus::NotSupported, ++ refunds: common_enums::FeatureStatus::Supported, ++ supported_capture_methods: automatic_capture_supported.clone(), ++ specific_features: None, ++ }, ++ ); ++ ++ stripe_supported_payment_methods.add( ++ common_enums::PaymentMethod::BankTransfer, ++ PaymentMethodType::Bacs, ++ PaymentMethodDetails { ++ mandates: common_enums::FeatureStatus::NotSupported, ++ refunds: common_enums::FeatureStatus::Supported, ++ supported_capture_methods: automatic_capture_supported.clone(), ++ specific_features: None, ++ }, ++ ); ++ ++ stripe_supported_payment_methods.add( ++ common_enums::PaymentMethod::BankTransfer, ++ PaymentMethodType::Multibanco, ++ PaymentMethodDetails { ++ mandates: common_enums::FeatureStatus::NotSupported, ++ refunds: common_enums::FeatureStatus::Supported, ++ supported_capture_methods: automatic_capture_supported.clone(), ++ specific_features: None, ++ }, ++ ); ++ ++ stripe_supported_payment_methods.add( ++ common_enums::PaymentMethod::BankRedirect, ++ PaymentMethodType::Giropay, ++ PaymentMethodDetails { ++ mandates: common_enums::FeatureStatus::NotSupported, ++ refunds: common_enums::FeatureStatus::NotSupported, ++ supported_capture_methods: automatic_capture_supported.clone(), ++ specific_features: None, ++ }, ++ ); ++ ++ stripe_supported_payment_methods.add( ++ common_enums::PaymentMethod::BankRedirect, ++ PaymentMethodType::Ideal, ++ PaymentMethodDetails { ++ mandates: common_enums::FeatureStatus::Supported, ++ refunds: common_enums::FeatureStatus::Supported, ++ supported_capture_methods: automatic_capture_supported.clone(), ++ specific_features: None, ++ }, ++ ); ++ ++ stripe_supported_payment_methods.add( ++ common_enums::PaymentMethod::BankRedirect, ++ PaymentMethodType::Przelewy24, ++ PaymentMethodDetails { ++ mandates: common_enums::FeatureStatus::NotSupported, ++ refunds: common_enums::FeatureStatus::Supported, ++ supported_capture_methods: automatic_capture_supported.clone(), ++ specific_features: None, ++ }, ++ ); ++ ++ stripe_supported_payment_methods.add( ++ common_enums::PaymentMethod::BankRedirect, ++ PaymentMethodType::Eps, ++ PaymentMethodDetails { ++ mandates: common_enums::FeatureStatus::NotSupported, ++ refunds: common_enums::FeatureStatus::Supported, ++ supported_capture_methods: automatic_capture_supported.clone(), ++ specific_features: None, ++ }, ++ ); ++ ++ stripe_supported_payment_methods.add( ++ common_enums::PaymentMethod::BankRedirect, ++ PaymentMethodType::OnlineBankingFpx, ++ PaymentMethodDetails { ++ mandates: common_enums::FeatureStatus::NotSupported, ++ refunds: common_enums::FeatureStatus::Supported, ++ supported_capture_methods: automatic_capture_supported.clone(), ++ specific_features: None, ++ }, ++ ); ++ ++ stripe_supported_payment_methods.add( ++ common_enums::PaymentMethod::BankRedirect, ++ PaymentMethodType::Sofort, ++ PaymentMethodDetails { ++ mandates: common_enums::FeatureStatus::Supported, ++ refunds: common_enums::FeatureStatus::Supported, ++ supported_capture_methods: automatic_capture_supported.clone(), ++ specific_features: None, ++ }, ++ ); ++ ++ stripe_supported_payment_methods ++}); ++ ++static STRIPE_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { ++ display_name: "Stripe", ++ description: "Stripe is a payment processing platform that provides businesses with tools and APIs to accept payments online and manage their financial infrastructure", ++ connector_type: common_enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: common_enums::ConnectorIntegrationStatus::Live, ++}; ++ ++static STRIPE_SUPPORTED_WEBHOOK_FLOWS: [common_enums::EventClass; 3] = [ ++ common_enums::EventClass::Payments, ++ common_enums::EventClass::Refunds, ++ common_enums::EventClass::Disputes, ++]; ++ ++impl ConnectorSpecifications for Stripe { ++ fn get_connector_about(&self) -> Option<&'static ConnectorInfo> { ++ Some(&STRIPE_CONNECTOR_INFO) ++ } ++ ++ fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> { ++ Some(&*STRIPE_SUPPORTED_PAYMENT_METHODS) ++ } ++ ++ fn get_supported_webhook_flows(&self) -> Option<&'static [common_enums::EventClass]> { ++ Some(&STRIPE_SUPPORTED_WEBHOOK_FLOWS) ++ } ++} +diff --git a/crates/hyperswitch_connectors/src/connectors/taxjar.rs b/crates/hyperswitch_connectors/src/connectors/taxjar.rs +index a205c974..160f3391 100644 +--- a/crates/hyperswitch_connectors/src/connectors/taxjar.rs ++++ b/crates/hyperswitch_connectors/src/connectors/taxjar.rs +@@ -23,7 +23,8 @@ use hyperswitch_domain_models::{ + PaymentsTaxCalculationData, RefundsData, SetupMandateRequestData, + }, + router_response_types::{ +- PaymentsResponseData, RefundsResponseData, TaxCalculationResponseData, ++ ConnectorInfo, PaymentsResponseData, RefundsResponseData, SupportedPaymentMethods, ++ TaxCalculationResponseData, + }, + types::PaymentsTaxCalculationRouterData, + }; +@@ -300,4 +301,23 @@ impl webhooks::IncomingWebhook for Taxjar { + } + } + +-impl ConnectorSpecifications for Taxjar {} ++static TAXJAR_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { ++ display_name: "Taxjar", ++ description: "TaxJar is a cloud-based platform that automates sales tax calculations, reporting, and filing for businesses across multiple channels", ++ connector_type: common_enums::HyperswitchConnectorCategory::TaxCalculationProvider, ++ integration_status: common_enums::ConnectorIntegrationStatus::Sandbox, ++}; ++ ++impl ConnectorSpecifications for Taxjar { ++ fn get_connector_about(&self) -> Option<&'static ConnectorInfo> { ++ Some(&TAXJAR_CONNECTOR_INFO) ++ } ++ ++ fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> { ++ None ++ } ++ ++ fn get_supported_webhook_flows(&self) -> Option<&'static [common_enums::enums::EventClass]> { ++ None ++ } ++} +diff --git a/crates/hyperswitch_connectors/src/connectors/threedsecureio.rs b/crates/hyperswitch_connectors/src/connectors/threedsecureio.rs +index 52013044..97573b3b 100644 +--- a/crates/hyperswitch_connectors/src/connectors/threedsecureio.rs ++++ b/crates/hyperswitch_connectors/src/connectors/threedsecureio.rs +@@ -28,7 +28,8 @@ use hyperswitch_domain_models::{ + RefundsData, SetupMandateRequestData, + }, + router_response_types::{ +- AuthenticationResponseData, PaymentsResponseData, RefundsResponseData, ++ AuthenticationResponseData, ConnectorInfo, PaymentsResponseData, RefundsResponseData, ++ SupportedPaymentMethods, + }, + }; + use hyperswitch_interfaces::{ +@@ -512,4 +513,23 @@ impl + { + } + +-impl ConnectorSpecifications for Threedsecureio {} ++static THREEDSECUREIO_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { ++ display_name: "3dsecure.io", ++ description: "3DSecure.io is a service that facilitates 3-D Secure verifications for online credit and debit card transactions through a simple JSON API, enhancing payment security for merchants.docs.3dsecure.io3dsecure.io", ++ connector_type: common_enums::HyperswitchConnectorCategory::AuthenticationProvider, ++ integration_status: common_enums::ConnectorIntegrationStatus::Sandbox, ++}; ++ ++impl ConnectorSpecifications for Threedsecureio { ++ fn get_connector_about(&self) -> Option<&'static ConnectorInfo> { ++ Some(&THREEDSECUREIO_CONNECTOR_INFO) ++ } ++ ++ fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> { ++ None ++ } ++ ++ fn get_supported_webhook_flows(&self) -> Option<&'static [common_enums::enums::EventClass]> { ++ None ++ } ++} +diff --git a/crates/hyperswitch_connectors/src/connectors/thunes.rs b/crates/hyperswitch_connectors/src/connectors/thunes.rs +index d7149321..cd12d12a 100644 +--- a/crates/hyperswitch_connectors/src/connectors/thunes.rs ++++ b/crates/hyperswitch_connectors/src/connectors/thunes.rs +@@ -19,7 +19,9 @@ use hyperswitch_domain_models::{ + PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData, + RefundsData, SetupMandateRequestData, + }, +- router_response_types::{PaymentsResponseData, RefundsResponseData}, ++ router_response_types::{ ++ ConnectorInfo, PaymentsResponseData, RefundsResponseData, SupportedPaymentMethods, ++ }, + types::{ + PaymentsAuthorizeRouterData, PaymentsCaptureRouterData, PaymentsSyncRouterData, + RefundSyncRouterData, RefundsRouterData, +@@ -569,4 +571,23 @@ impl webhooks::IncomingWebhook for Thunes { + } + } + +-impl ConnectorSpecifications for Thunes {} ++static THUNES_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { ++ display_name: "Thunes", ++ description: "Thunes Payouts is a global payment solution that enables businesses to send instant, secure, and cost-effective cross-border payments to bank accounts, mobile wallets, and cards in over 130 countries using a single API", ++ connector_type: common_enums::HyperswitchConnectorCategory::PayoutProcessor, ++ integration_status: common_enums::ConnectorIntegrationStatus::Sandbox, ++}; ++ ++impl ConnectorSpecifications for Thunes { ++ fn get_connector_about(&self) -> Option<&'static ConnectorInfo> { ++ Some(&THUNES_CONNECTOR_INFO) ++ } ++ ++ fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> { ++ None ++ } ++ ++ fn get_supported_webhook_flows(&self) -> Option<&'static [common_enums::enums::EventClass]> { ++ None ++ } ++} +diff --git a/crates/hyperswitch_connectors/src/connectors/tokenio.rs b/crates/hyperswitch_connectors/src/connectors/tokenio.rs +index 186378f4..ad8607ea 100644 +--- a/crates/hyperswitch_connectors/src/connectors/tokenio.rs ++++ b/crates/hyperswitch_connectors/src/connectors/tokenio.rs +@@ -770,7 +770,8 @@ static TOKENIO_SUPPORTED_PAYMENT_METHODS: LazyLock = La + static TOKENIO_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Token.io", + description: "Token.io is a financial technology company that provides Open Banking and real-time payment solutions across Europe. They enable secure bank-to-bank transfers using various payment rails including SEPA, Faster Payments, and other regional payment systems.", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Sandbox, + }; + + static TOKENIO_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 1] = [enums::EventClass::Payments]; +diff --git a/crates/hyperswitch_connectors/src/connectors/trustpayments.rs b/crates/hyperswitch_connectors/src/connectors/trustpayments.rs +index a5914d00..4b92c5ae 100644 +--- a/crates/hyperswitch_connectors/src/connectors/trustpayments.rs ++++ b/crates/hyperswitch_connectors/src/connectors/trustpayments.rs +@@ -613,7 +613,8 @@ static TRUSTPAYMENTS_SUPPORTED_PAYMENT_METHODS: LazyLock = LazyL + static TSYS_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Tsys", + description: "TSYS, a Global Payments company, is the payment stack for the future, powered by unmatched expertise.", +- connector_type: enums::PaymentConnectorCategory::BankAcquirer, ++ connector_type: enums::HyperswitchConnectorCategory::BankAcquirer, ++ integration_status: enums::ConnectorIntegrationStatus::Beta, + }; + + static TSYS_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 0] = []; +diff --git a/crates/hyperswitch_connectors/src/connectors/volt.rs b/crates/hyperswitch_connectors/src/connectors/volt.rs +index b9655334..878a92a5 100644 +--- a/crates/hyperswitch_connectors/src/connectors/volt.rs ++++ b/crates/hyperswitch_connectors/src/connectors/volt.rs +@@ -767,7 +767,8 @@ lazy_static! { + display_name: "VOLT", + description: + "Volt is a payment gateway operating in China, specializing in facilitating local bank transfers", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Live, + }; + + static ref VOLT_SUPPORTED_WEBHOOK_FLOWS: Vec = Vec::new(); +diff --git a/crates/hyperswitch_connectors/src/connectors/wellsfargo.rs b/crates/hyperswitch_connectors/src/connectors/wellsfargo.rs +index 13ae18e8..75bf5f3b 100644 +--- a/crates/hyperswitch_connectors/src/connectors/wellsfargo.rs ++++ b/crates/hyperswitch_connectors/src/connectors/wellsfargo.rs +@@ -1420,7 +1420,8 @@ static WELLSFARGO_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Wells Fargo", + description: + "Wells Fargo is a major bank offering retail, commercial, and wealth management services", +- connector_type: enums::PaymentConnectorCategory::BankAcquirer, ++ connector_type: enums::HyperswitchConnectorCategory::BankAcquirer, ++ integration_status: enums::ConnectorIntegrationStatus::Beta, + }; + + static WELLSFARGO_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 0] = []; +diff --git a/crates/hyperswitch_connectors/src/connectors/wellsfargopayout.rs b/crates/hyperswitch_connectors/src/connectors/wellsfargopayout.rs +index c69d73ad..074a12dc 100644 +--- a/crates/hyperswitch_connectors/src/connectors/wellsfargopayout.rs ++++ b/crates/hyperswitch_connectors/src/connectors/wellsfargopayout.rs +@@ -19,7 +19,9 @@ use hyperswitch_domain_models::{ + PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData, + RefundsData, SetupMandateRequestData, + }, +- router_response_types::{PaymentsResponseData, RefundsResponseData}, ++ router_response_types::{ ++ ConnectorInfo, PaymentsResponseData, RefundsResponseData, SupportedPaymentMethods, ++ }, + types::{ + PaymentsAuthorizeRouterData, PaymentsCaptureRouterData, PaymentsSyncRouterData, + RefundSyncRouterData, RefundsRouterData, +@@ -573,4 +575,23 @@ impl IncomingWebhook for Wellsfargopayout { + } + } + +-impl ConnectorSpecifications for Wellsfargopayout {} ++static WELLSFARGOPAYOUTS_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { ++ display_name: "Wellsfargo Payout", ++ description: "Wells Fargo Payouts streamlines secure domestic and international payments for businesses via online banking, supporting Bill Pay, Digital Wires, and Zelle", ++ connector_type: common_enums::HyperswitchConnectorCategory::PayoutProcessor, ++ integration_status: common_enums::ConnectorIntegrationStatus::Sandbox, ++}; ++ ++impl ConnectorSpecifications for Wellsfargopayout { ++ fn get_connector_about(&self) -> Option<&'static ConnectorInfo> { ++ Some(&WELLSFARGOPAYOUTS_CONNECTOR_INFO) ++ } ++ ++ fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> { ++ None ++ } ++ ++ fn get_supported_webhook_flows(&self) -> Option<&'static [common_enums::enums::EventClass]> { ++ None ++ } ++} +diff --git a/crates/hyperswitch_connectors/src/connectors/wise.rs b/crates/hyperswitch_connectors/src/connectors/wise.rs +index 5d28f131..68f1b053 100644 +--- a/crates/hyperswitch_connectors/src/connectors/wise.rs ++++ b/crates/hyperswitch_connectors/src/connectors/wise.rs +@@ -20,7 +20,9 @@ use hyperswitch_domain_models::{ + PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData, + RefundsData, SetupMandateRequestData, + }, +- router_response_types::{PaymentsResponseData, RefundsResponseData}, ++ router_response_types::{ ++ ConnectorInfo, PaymentsResponseData, RefundsResponseData, SupportedPaymentMethods, ++ }, + }; + #[cfg(feature = "payouts")] + use hyperswitch_domain_models::{ +@@ -823,4 +825,23 @@ impl IncomingWebhook for Wise { + } + } + +-impl ConnectorSpecifications for Wise {} ++static WISE_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { ++ display_name: "Wise", ++ description: "The Wise connector enables cross-border money transfers by integrating with Wise's API to initiate, track, and manage international payouts efficiently.", ++ connector_type: common_enums::HyperswitchConnectorCategory::PayoutProcessor, ++ integration_status: common_enums::ConnectorIntegrationStatus::Sandbox, ++}; ++ ++impl ConnectorSpecifications for Wise { ++ fn get_connector_about(&self) -> Option<&'static ConnectorInfo> { ++ Some(&WISE_CONNECTOR_INFO) ++ } ++ ++ fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> { ++ None ++ } ++ ++ fn get_supported_webhook_flows(&self) -> Option<&'static [common_enums::enums::EventClass]> { ++ None ++ } ++} +diff --git a/crates/hyperswitch_connectors/src/connectors/worldline.rs b/crates/hyperswitch_connectors/src/connectors/worldline.rs +index 1af8ecd8..6012782e 100644 +--- a/crates/hyperswitch_connectors/src/connectors/worldline.rs ++++ b/crates/hyperswitch_connectors/src/connectors/worldline.rs +@@ -908,7 +908,8 @@ lazy_static! { + static ref WORLDLINE_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Worldline", + description: "Worldline, Europe's leading payment service provider", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Sandbox, + }; + static ref WORLDLINE_SUPPORTED_WEBHOOK_FLOWS: Vec = + vec![enums::EventClass::Payments]; +diff --git a/crates/hyperswitch_connectors/src/connectors/worldpay.rs b/crates/hyperswitch_connectors/src/connectors/worldpay.rs +index b5d3dacd..9883549a 100644 +--- a/crates/hyperswitch_connectors/src/connectors/worldpay.rs ++++ b/crates/hyperswitch_connectors/src/connectors/worldpay.rs +@@ -1348,7 +1348,8 @@ static WORLDPAY_SUPPORTED_PAYMENT_METHODS: LazyLock = + static WORLDPAY_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Worldpay", + description: "Worldpay is a payment gateway and PSP enabling secure online transactions", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Live, + }; + + static WORLDPAY_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 1] = [enums::EventClass::Payments]; +diff --git a/crates/hyperswitch_connectors/src/connectors/worldpayvantiv.rs b/crates/hyperswitch_connectors/src/connectors/worldpayvantiv.rs +index 796dc700..8333a90e 100644 +--- a/crates/hyperswitch_connectors/src/connectors/worldpayvantiv.rs ++++ b/crates/hyperswitch_connectors/src/connectors/worldpayvantiv.rs +@@ -1676,7 +1676,8 @@ static WORLDPAYVANTIV_SUPPORTED_PAYMENT_METHODS: LazyLock + static WORLDPAYXML_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Worldpay XML", + description: "Worldpay is a payment gateway and PSP enabling secure online transactions", +- connector_type: common_enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: common_enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: common_enums::ConnectorIntegrationStatus::Sandbox, + }; + + static WORLDPAYXML_SUPPORTED_WEBHOOK_FLOWS: [common_enums::EventClass; 0] = []; +diff --git a/crates/hyperswitch_connectors/src/connectors/xendit.rs b/crates/hyperswitch_connectors/src/connectors/xendit.rs +index bf318f1a..7c6065eb 100644 +--- a/crates/hyperswitch_connectors/src/connectors/xendit.rs ++++ b/crates/hyperswitch_connectors/src/connectors/xendit.rs +@@ -1013,7 +1013,8 @@ static XENDIT_SUPPORTED_PAYMENT_METHODS: LazyLock = Laz + static XENDIT_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Xendit", + description: "Xendit is a financial technology company that provides payment solutions and simplifies the payment process for businesses in Indonesia, the Philippines and Southeast Asia, from SMEs and e-commerce startups to large enterprises.", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Sandbox, + }; + + static XENDIT_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 1] = [enums::EventClass::Payments]; +diff --git a/crates/hyperswitch_connectors/src/connectors/zen.rs b/crates/hyperswitch_connectors/src/connectors/zen.rs +index 62bb0f5e..8a616a40 100644 +--- a/crates/hyperswitch_connectors/src/connectors/zen.rs ++++ b/crates/hyperswitch_connectors/src/connectors/zen.rs +@@ -866,7 +866,8 @@ static ZEN_SUPPORTED_PAYMENT_METHODS: LazyLock = LazyLo + static ZEN_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Zen", + description: "Zen Payment Gateway is a secure and scalable payment solution that enables businesses to accept online payments globally with various methods and currencies.", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Live, + }; + + static ZEN_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 2] = +diff --git a/crates/hyperswitch_connectors/src/connectors/zsl.rs b/crates/hyperswitch_connectors/src/connectors/zsl.rs +index 3ab30024..1defc874 100644 +--- a/crates/hyperswitch_connectors/src/connectors/zsl.rs ++++ b/crates/hyperswitch_connectors/src/connectors/zsl.rs +@@ -473,7 +473,8 @@ lazy_static! { + display_name: "ZSL", + description: + "Zsl is a payment gateway operating in China, specializing in facilitating local bank transfers", +- connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Live, + }; + + static ref ZSL_SUPPORTED_WEBHOOK_FLOWS: Vec = Vec::new(); +diff --git a/crates/hyperswitch_domain_models/src/router_response_types.rs b/crates/hyperswitch_domain_models/src/router_response_types.rs +index aacbfbf1..c7cfbc76 100644 +--- a/crates/hyperswitch_domain_models/src/router_response_types.rs ++++ b/crates/hyperswitch_domain_models/src/router_response_types.rs +@@ -636,7 +636,9 @@ pub struct ConnectorInfo { + /// Description of the connector. + pub description: &'static str, + /// Connector Type +- pub connector_type: common_enums::PaymentConnectorCategory, ++ pub connector_type: common_enums::HyperswitchConnectorCategory, ++ /// Integration status of the connector ++ pub integration_status: common_enums::ConnectorIntegrationStatus, + } + + pub trait SupportedPaymentMethodsExt { +diff --git a/crates/openapi/src/openapi.rs b/crates/openapi/src/openapi.rs +index d352aa11..16ce1cf8 100644 +--- a/crates/openapi/src/openapi.rs ++++ b/crates/openapi/src/openapi.rs +@@ -371,7 +371,8 @@ Never share your secret api keys. Keep them guarded and secure. + api_models::enums::PaymentMethodStatus, + api_models::enums::UIWidgetFormLayout, + api_models::enums::MerchantProductType, +- api_models::enums::PaymentConnectorCategory, ++ api_models::enums::HyperswitchConnectorCategory, ++ api_models::enums::ConnectorIntegrationStatus, + api_models::enums::CardDiscovery, + api_models::enums::FeatureStatus, + api_models::enums::MerchantProductType, +diff --git a/crates/openapi/src/openapi_v2.rs b/crates/openapi/src/openapi_v2.rs +index 553c7f17..2751055a 100644 +--- a/crates/openapi/src/openapi_v2.rs ++++ b/crates/openapi/src/openapi_v2.rs +@@ -322,7 +322,8 @@ Never share your secret api keys. Keep them guarded and secure. + api_models::enums::MerchantProductType, + api_models::enums::PaymentLinkDetailsLayout, + api_models::enums::PaymentMethodStatus, +- api_models::enums::PaymentConnectorCategory, ++ api_models::enums::HyperswitchConnectorCategory, ++ api_models::enums::ConnectorIntegrationStatus, + api_models::enums::FeatureStatus, + api_models::enums::OrderFulfillmentTimeOrigin, + api_models::enums::UIWidgetFormLayout, +diff --git a/crates/router/src/routes/feature_matrix.rs b/crates/router/src/routes/feature_matrix.rs +index 92456da4..9e23f950 100644 +--- a/crates/router/src/routes/feature_matrix.rs ++++ b/crates/router/src/routes/feature_matrix.rs +@@ -51,18 +51,16 @@ pub async fn generate_feature_matrix( + connector_list + .into_iter() + .filter_map(|connector_name| { +- api_types::ConnectorData::convert_connector(&connector_name.to_string()) +- .inspect_err(|_| { +- router_env::logger::warn!("Failed to fetch {:?} details", connector_name) +- }) +- .ok() +- .and_then(|connector| { +- build_connector_feature_details( +- &state, +- connector, +- connector_name.to_string(), +- ) +- }) ++ api_types::feature_matrix::FeatureMatrixConnectorData::convert_connector( ++ &connector_name.to_string(), ++ ) ++ .inspect_err(|_| { ++ router_env::logger::warn!("Failed to fetch {:?} details", connector_name) ++ }) ++ .ok() ++ .and_then(|connector| { ++ build_connector_feature_details(&state, connector, connector_name.to_string()) ++ }) + }) + .collect(); + +@@ -80,32 +78,36 @@ fn build_connector_feature_details( + connector_name: String, + ) -> Option { + let connector_integration_features = connector.get_supported_payment_methods(); +- connector_integration_features.map(|connector_integration_feature_data| { +- let supported_payment_methods = connector_integration_feature_data +- .iter() +- .flat_map(|(payment_method, supported_payment_method_types)| { +- build_payment_method_wise_feature_details( +- state, +- &connector_name, +- *payment_method, +- supported_payment_method_types, +- ) +- }) +- .collect::>(); ++ let supported_payment_methods = ++ connector_integration_features.map(|connector_integration_feature_data| { ++ connector_integration_feature_data ++ .iter() ++ .flat_map(|(payment_method, supported_payment_method_types)| { ++ build_payment_method_wise_feature_details( ++ state, ++ &connector_name, ++ *payment_method, ++ supported_payment_method_types, ++ ) ++ }) ++ .collect::>() ++ }); ++ let supported_webhook_flows = connector ++ .get_supported_webhook_flows() ++ .map(|webhook_flows| webhook_flows.to_vec()); ++ let connector_about = connector.get_connector_about(); + +- let connector_about = connector.get_connector_about(); +- let supported_webhook_flows = connector +- .get_supported_webhook_flows() +- .map(|webhook_flows| webhook_flows.to_vec()); +- feature_matrix::ConnectorFeatureMatrixResponse { ++ connector_about.map( ++ |connector_about| feature_matrix::ConnectorFeatureMatrixResponse { + name: connector_name.to_uppercase(), +- display_name: connector_about.map(|about| about.display_name.to_string()), +- description: connector_about.map(|about| about.description.to_string()), +- category: connector_about.map(|about| about.connector_type), ++ display_name: connector_about.display_name.to_string(), ++ description: connector_about.description.to_string(), ++ integration_status: connector_about.integration_status, ++ category: connector_about.connector_type, + supported_webhook_flows, + supported_payment_methods, +- } +- }) ++ }, ++ ) + } + + fn build_payment_method_wise_feature_details( +diff --git a/crates/router/src/types/api.rs b/crates/router/src/types/api.rs +index 01f872e6..362daa82 100644 +--- a/crates/router/src/types/api.rs ++++ b/crates/router/src/types/api.rs +@@ -29,6 +29,7 @@ pub mod webhooks; + pub mod authentication_v2; + pub mod connector_mapping; + pub mod disputes_v2; ++pub mod feature_matrix; + pub mod files_v2; + #[cfg(feature = "frm")] + pub mod fraud_check_v2; +diff --git a/crates/router/src/types/api/feature_matrix.rs b/crates/router/src/types/api/feature_matrix.rs +new file mode 100644 +index 00000000..ac7754fa +--- /dev/null ++++ b/crates/router/src/types/api/feature_matrix.rs +@@ -0,0 +1,390 @@ ++use std::str::FromStr; ++ ++use error_stack::{report, ResultExt}; ++ ++use crate::{ ++ connector, ++ core::errors::{self, CustomResult}, ++ services::connector_integration_interface::ConnectorEnum, ++ types::api::enums, ++}; ++ ++#[derive(Clone)] ++pub struct FeatureMatrixConnectorData {} ++ ++impl FeatureMatrixConnectorData { ++ pub fn convert_connector( ++ connector_name: &str, ++ ) -> CustomResult { ++ match enums::Connector::from_str(connector_name) { ++ Ok(name) => match name { ++ enums::Connector::Aci => Ok(ConnectorEnum::Old(Box::new(connector::Aci::new()))), ++ enums::Connector::Adyen => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Adyen::new()))) ++ } ++ enums::Connector::Adyenplatform => Ok(ConnectorEnum::Old(Box::new( ++ connector::Adyenplatform::new(), ++ ))), ++ enums::Connector::Airwallex => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Airwallex::new()))) ++ } ++ // enums::Connector::Amazonpay => { ++ // Ok(ConnectorEnum::Old(Box::new(connector::Amazonpay))) ++ // } ++ enums::Connector::Archipel => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Archipel::new()))) ++ } ++ enums::Connector::Authipay => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Authipay::new()))) ++ } ++ enums::Connector::Authorizedotnet => { ++ Ok(ConnectorEnum::Old(Box::new(&connector::Authorizedotnet))) ++ } ++ enums::Connector::Bambora => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Bambora::new()))) ++ } ++ enums::Connector::Bamboraapac => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Bamboraapac::new()))) ++ } ++ enums::Connector::Bankofamerica => { ++ Ok(ConnectorEnum::Old(Box::new(&connector::Bankofamerica))) ++ } ++ enums::Connector::Barclaycard => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Barclaycard::new()))) ++ } ++ enums::Connector::Billwerk => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Billwerk::new()))) ++ } ++ enums::Connector::Bitpay => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Bitpay::new()))) ++ } ++ enums::Connector::Bluesnap => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Bluesnap::new()))) ++ } ++ enums::Connector::Bluecode => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Bluecode::new()))) ++ } ++ // enums::Connector::Bluecode => { ++ // Ok(ConnectorEnum::Old(Box::new(connector::Bluecode::new()))) ++ // } ++ enums::Connector::Boku => Ok(ConnectorEnum::Old(Box::new(connector::Boku::new()))), ++ enums::Connector::Braintree => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Braintree::new()))) ++ } ++ enums::Connector::Breadpay => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Breadpay::new()))) ++ } ++ enums::Connector::Cashtocode => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Cashtocode::new()))) ++ } ++ enums::Connector::Celero => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Celero::new()))) ++ } ++ enums::Connector::Chargebee => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Chargebee::new()))) ++ } ++ enums::Connector::Checkbook => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Checkbook::new()))) ++ } ++ enums::Connector::Checkout => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Checkout::new()))) ++ } ++ enums::Connector::Coinbase => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Coinbase::new()))) ++ } ++ enums::Connector::Coingate => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Coingate::new()))) ++ } ++ enums::Connector::Cryptopay => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Cryptopay::new()))) ++ } ++ enums::Connector::CtpMastercard => { ++ Ok(ConnectorEnum::Old(Box::new(&connector::CtpMastercard))) ++ } ++ enums::Connector::Custombilling => Ok(ConnectorEnum::Old(Box::new( ++ connector::Custombilling::new(), ++ ))), ++ enums::Connector::CtpVisa => Ok(ConnectorEnum::Old(Box::new( ++ connector::UnifiedAuthenticationService::new(), ++ ))), ++ enums::Connector::Cybersource => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Cybersource::new()))) ++ } ++ enums::Connector::Datatrans => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Datatrans::new()))) ++ } ++ enums::Connector::Deutschebank => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Deutschebank::new()))) ++ } ++ enums::Connector::Digitalvirgo => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Digitalvirgo::new()))) ++ } ++ enums::Connector::Dlocal => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Dlocal::new()))) ++ } ++ #[cfg(feature = "dummy_connector")] ++ enums::Connector::DummyConnector1 => Ok(ConnectorEnum::Old(Box::new( ++ connector::DummyConnector::<1>::new(), ++ ))), ++ #[cfg(feature = "dummy_connector")] ++ enums::Connector::DummyConnector2 => Ok(ConnectorEnum::Old(Box::new( ++ connector::DummyConnector::<2>::new(), ++ ))), ++ #[cfg(feature = "dummy_connector")] ++ enums::Connector::DummyConnector3 => Ok(ConnectorEnum::Old(Box::new( ++ connector::DummyConnector::<3>::new(), ++ ))), ++ #[cfg(feature = "dummy_connector")] ++ enums::Connector::DummyConnector4 => Ok(ConnectorEnum::Old(Box::new( ++ connector::DummyConnector::<4>::new(), ++ ))), ++ #[cfg(feature = "dummy_connector")] ++ enums::Connector::DummyConnector5 => Ok(ConnectorEnum::Old(Box::new( ++ connector::DummyConnector::<5>::new(), ++ ))), ++ #[cfg(feature = "dummy_connector")] ++ enums::Connector::DummyConnector6 => Ok(ConnectorEnum::Old(Box::new( ++ connector::DummyConnector::<6>::new(), ++ ))), ++ #[cfg(feature = "dummy_connector")] ++ enums::Connector::DummyConnector7 => Ok(ConnectorEnum::Old(Box::new( ++ connector::DummyConnector::<7>::new(), ++ ))), ++ #[cfg(feature = "dummy_connector")] ++ enums::Connector::DummyBillingConnector => Ok(ConnectorEnum::Old(Box::new( ++ connector::DummyConnector::<8>::new(), ++ ))), ++ enums::Connector::Dwolla => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Dwolla::new()))) ++ } ++ enums::Connector::Ebanx => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Ebanx::new()))) ++ } ++ enums::Connector::Elavon => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Elavon::new()))) ++ } ++ enums::Connector::Facilitapay => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Facilitapay::new()))) ++ } ++ enums::Connector::Fiserv => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Fiserv::new()))) ++ } ++ enums::Connector::Fiservemea => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Fiservemea::new()))) ++ } ++ enums::Connector::Fiuu => Ok(ConnectorEnum::Old(Box::new(connector::Fiuu::new()))), ++ enums::Connector::Forte => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Forte::new()))) ++ } ++ enums::Connector::Flexiti => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Flexiti::new()))) ++ } ++ enums::Connector::Getnet => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Getnet::new()))) ++ } ++ enums::Connector::Globalpay => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Globalpay::new()))) ++ } ++ enums::Connector::Globepay => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Globepay::new()))) ++ } ++ enums::Connector::Gocardless => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Gocardless::new()))) ++ } ++ enums::Connector::Hipay => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Hipay::new()))) ++ } ++ enums::Connector::Helcim => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Helcim::new()))) ++ } ++ enums::Connector::HyperswitchVault => { ++ Ok(ConnectorEnum::Old(Box::new(&connector::HyperswitchVault))) ++ } ++ enums::Connector::Iatapay => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Iatapay::new()))) ++ } ++ enums::Connector::Inespay => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Inespay::new()))) ++ } ++ enums::Connector::Itaubank => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Itaubank::new()))) ++ } ++ enums::Connector::Jpmorgan => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Jpmorgan::new()))) ++ } ++ enums::Connector::Juspaythreedsserver => Ok(ConnectorEnum::Old(Box::new( ++ connector::Juspaythreedsserver::new(), ++ ))), ++ enums::Connector::Klarna => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Klarna::new()))) ++ } ++ enums::Connector::Mollie => { ++ // enums::Connector::Moneris => Ok(ConnectorEnum::Old(Box::new(connector::Moneris))), ++ Ok(ConnectorEnum::Old(Box::new(connector::Mollie::new()))) ++ } ++ enums::Connector::Moneris => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Moneris::new()))) ++ } ++ enums::Connector::Nexixpay => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Nexixpay::new()))) ++ } ++ enums::Connector::Nmi => Ok(ConnectorEnum::Old(Box::new(connector::Nmi::new()))), ++ enums::Connector::Nomupay => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Nomupay::new()))) ++ } ++ enums::Connector::Noon => Ok(ConnectorEnum::Old(Box::new(connector::Noon::new()))), ++ enums::Connector::Nordea => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Nordea::new()))) ++ } ++ enums::Connector::Novalnet => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Novalnet::new()))) ++ } ++ enums::Connector::Nuvei => Ok(ConnectorEnum::Old(Box::new(&connector::Nuvei))), ++ enums::Connector::Opennode => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Opennode::new()))) ++ } ++ enums::Connector::Phonepe => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Phonepe::new()))) ++ } ++ enums::Connector::Paybox => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Paybox::new()))) ++ } ++ enums::Connector::Paytm => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Paytm::new()))) ++ } ++ // "payeezy" => Ok(ConnectorIntegrationEnum::Old(Box::new(&connector::Payeezy)), As psync and rsync are not supported by this connector, it is added as template code for future usage ++ // enums::Connector::Payload => { ++ // Ok(ConnectorEnum::Old(Box::new(connector::Paybload::new()))) ++ // } ++ enums::Connector::Payload => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Payload::new()))) ++ } ++ enums::Connector::Payme => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Payme::new()))) ++ } ++ enums::Connector::Payone => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Payone::new()))) ++ } ++ enums::Connector::Payu => Ok(ConnectorEnum::Old(Box::new(connector::Payu::new()))), ++ enums::Connector::Placetopay => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Placetopay::new()))) ++ } ++ enums::Connector::Powertranz => { ++ Ok(ConnectorEnum::Old(Box::new(&connector::Powertranz))) ++ } ++ enums::Connector::Prophetpay => { ++ Ok(ConnectorEnum::Old(Box::new(&connector::Prophetpay))) ++ } ++ enums::Connector::Razorpay => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Razorpay::new()))) ++ } ++ enums::Connector::Rapyd => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Rapyd::new()))) ++ } ++ enums::Connector::Recurly => { ++ Ok(ConnectorEnum::New(Box::new(connector::Recurly::new()))) ++ } ++ enums::Connector::Redsys => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Redsys::new()))) ++ } ++ enums::Connector::Santander => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Santander::new()))) ++ } ++ enums::Connector::Shift4 => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Shift4::new()))) ++ } ++ enums::Connector::Square => Ok(ConnectorEnum::Old(Box::new(&connector::Square))), ++ enums::Connector::Stax => Ok(ConnectorEnum::Old(Box::new(&connector::Stax))), ++ enums::Connector::Stripe => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Stripe::new()))) ++ } ++ enums::Connector::Stripebilling => Ok(ConnectorEnum::Old(Box::new( ++ connector::Stripebilling::new(), ++ ))), ++ enums::Connector::Wise => Ok(ConnectorEnum::Old(Box::new(connector::Wise::new()))), ++ enums::Connector::Worldline => { ++ Ok(ConnectorEnum::Old(Box::new(&connector::Worldline))) ++ } ++ enums::Connector::Worldpay => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Worldpay::new()))) ++ } ++ enums::Connector::Worldpayvantiv => Ok(ConnectorEnum::Old(Box::new( ++ connector::Worldpayvantiv::new(), ++ ))), ++ enums::Connector::Worldpayxml => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Worldpayxml::new()))) ++ } ++ enums::Connector::Xendit => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Xendit::new()))) ++ } ++ enums::Connector::Mifinity => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Mifinity::new()))) ++ } ++ enums::Connector::Multisafepay => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Multisafepay::new()))) ++ } ++ enums::Connector::Netcetera => { ++ Ok(ConnectorEnum::Old(Box::new(&connector::Netcetera))) ++ } ++ enums::Connector::Nexinets => { ++ Ok(ConnectorEnum::Old(Box::new(&connector::Nexinets))) ++ } ++ // enums::Connector::Nexixpay => { ++ // Ok(ConnectorEnum::Old(Box::new(&connector::Nexixpay))) ++ // } ++ enums::Connector::Paypal => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Paypal::new()))) ++ } ++ enums::Connector::Paystack => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Paystack::new()))) ++ } ++ // enums::Connector::Thunes => Ok(ConnectorEnum::Old(Box::new(connector::Thunes))), ++ enums::Connector::Tokenio => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Tokenio::new()))) ++ } ++ enums::Connector::Trustpay => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Trustpay::new()))) ++ } ++ enums::Connector::Tsys => Ok(ConnectorEnum::Old(Box::new(connector::Tsys::new()))), ++ // enums::Connector::UnifiedAuthenticationService => Ok(ConnectorEnum::Old(Box::new( ++ // connector::UnifiedAuthenticationService, ++ // ))), ++ enums::Connector::Vgs => Ok(ConnectorEnum::Old(Box::new(connector::Vgs::new()))), ++ enums::Connector::Volt => Ok(ConnectorEnum::Old(Box::new(connector::Volt::new()))), ++ enums::Connector::Wellsfargo => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Wellsfargo::new()))) ++ } ++ ++ // enums::Connector::Wellsfargopayout => { ++ // Ok(Box::new(connector::Wellsfargopayout::new())) ++ // } ++ enums::Connector::Zen => Ok(ConnectorEnum::Old(Box::new(&connector::Zen))), ++ enums::Connector::Zsl => Ok(ConnectorEnum::Old(Box::new(&connector::Zsl))), ++ enums::Connector::Plaid => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Plaid::new()))) ++ } ++ enums::Connector::Signifyd => { ++ Ok(ConnectorEnum::Old(Box::new(&connector::Signifyd))) ++ } ++ enums::Connector::Silverflow => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Silverflow::new()))) ++ } ++ enums::Connector::Riskified => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Riskified::new()))) ++ } ++ enums::Connector::Gpayments => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Gpayments::new()))) ++ } ++ enums::Connector::Threedsecureio => { ++ Ok(ConnectorEnum::Old(Box::new(&connector::Threedsecureio))) ++ } ++ enums::Connector::Taxjar => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Taxjar::new()))) ++ } ++ }, ++ Err(_) => Err(report!(errors::ConnectorError::InvalidConnectorName) ++ .attach_printable(format!("invalid connector name: {connector_name}"))) ++ .change_context(errors::ApiErrorResponse::InternalServerError), ++ } ++ } ++} +diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.js +index 1d1e9451..dcc95c5f 100644 +--- a/cypress-tests/cypress/support/commands.js ++++ b/cypress-tests/cypress/support/commands.js +@@ -185,8 +185,7 @@ Cypress.Commands.add("ListConnectorsFeatureMatrixCall", (globalState) => { + response.body.connectors.forEach((item) => { + expect(item).to.have.property("description").and.not.empty; + expect(item).to.have.property("category").and.not.empty; +- expect(item).to.have.property("supported_payment_methods").and.not +- .empty; ++ expect(item).to.have.property("integration_status").and.not.empty; + }); + }); + }); + +----- END CHUNK ----- \ No newline at end of file diff --git a/raw/70/7047c3faa1e71c7ad13592cd41b77be3cdc1a8a2.txt b/raw/70/7047c3faa1e71c7ad13592cd41b77be3cdc1a8a2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d8488bc417a18c6ed166565460c22970fd1025f0 --- /dev/null +++ b/raw/70/7047c3faa1e71c7ad13592cd41b77be3cdc1a8a2.txt @@ -0,0 +1,1341 @@ +ROUTE: juspay/hyperswitch@7047c3faa1e71c7ad13592cd41b77be3cdc1a8a2 +REPO: https://github.com/juspay/hyperswitch +COMMIT: 7047c3faa1e71c7ad13592cd41b77be3cdc1a8a2 +AUTHOR: awasthi21 <107559116+awasthi21@users.noreply.github.com> +DATE: 2025-08-24T16:48:27 + +=== ISSUE_AND_PR === +[PR #9032] feat(core): Add network_transaction_id in payments Response +URL: https://github.com/juspay/hyperswitch/pull/9032 +BODY: +## Type of Change + + +- [ ] Bugfix +- [ ] New feature +- [x] Enhancement +- [ ] Refactoring +- [ ] Dependency updates +- [ ] Documentation +- [ ] CI/CD + +## Description + + +Database Changes: + +Added network_transaction_id column (VARCHAR(255), nullable) to the payment_attempt table via migration 2025-08-20-095434_add_ntid_in_attempt_table. + +Added get_network_transaction_id method to PaymentsResponseData in crates/hyperswitch_domain_models/src/router_response_types.rs to extract network_transaction_id from transaction responses. + + +### Additional Changes + +- [ ] This PR modifies the API contract +- [x] This PR modifies the database schema +- [ ] This PR modifies application configuration/environment variables + + + + +## Motivation and Context + + + + +## How did you test it? + +For CIT Transaction: +Request: +``` +curl --location 'http://localhost:8080/payments' \ +--header 'Content-Type: application/json' \ +--header 'Accept: application/json' \ +--header 'api-key: dev_DD2unr7vk4xDt33fxLlCT7JRyc5lX0ffC5fSLUo8Qrwcz4MLzt55T8jnBzveIgLs' \ +--data-raw '{ + "amount": 1000, + "currency": "USD", + "amount_to_capture": 1000, + "customer_id":"131123", + "confirm": true, + "capture_method": "automatic", + "setup_future_usage": "off_session", + "authentication_type": "no_three_ds", + "payment_method": "card", + "payment_method_type": "credit", + + "customer_acceptance": { + "acceptance_type": "offline", + "accepted_at": "1963-05-03T04:07:52.723Z", + "online": { + "ip_address": "in sit", + "user_agent": "amet irure esse" + } + }, + "email": "guest@example.com", + "payment_method_data": { + "card": { + "card_number": "5404000000000001", + "card_exp_month": "09", + "card_exp_year": "25", + "card_holder_name": "joseph Doe", + "card_cvc": "123" + } + }, + "billing": { + "address": { + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "city": "Zurich", + "state": "asd", + "zip": "8008", + "country": "CH", + "first_name": "joseph", + "last_name": "Doe", + "origin_zip":"43234" + } + } +}' +``` +Response +``` +{ + "payment_id": "pay_SdL4iUqO5d7j0FzJYU65", + "merchant_id": "merchant_1755880712", + "status": "processing", + "amount": 1000, + "net_amount": 1000, + "shipping_cost": null, + "amount_capturable": 1000, + "amount_received": null, + "connector": "worldpayvantiv", + "client_secret": "pay_SdL4iUqO5d7j0FzJYU65_secret_yKgYTJrT0zHhYi5JruGO", + "created": "2025-08-22T16:44:09.334Z", + "currency": "USD", + "customer_id": "131123", + "customer": { + "id": "131123", + "name": null, + "email": "guest@example.com", + "phone": null, + "phone_country_code": null + }, + "description": null, + "refunds": null, + "disputes": null, + "mandate_id": null, + "mandate_data": null, + "setup_future_usage": "off_session", + "off_session": null, + "capture_on": null, + "capture_method": "automatic", + "payment_method": "card", + "payment_method_data": { + "card": { + "last4": "0001", + "card_type": null, + "card_network": null, + "card_issuer": null, + "card_issuing_country": null, + "card_isin": "540400", + "card_extended_bin": null, + "card_exp_month": "09", + "card_exp_year": "25", + "card_holder_name": "joseph Doe", + "payment_checks": { + "avs_result": "00", + "advanced_a_v_s_result": null, + "authentication_result": null, + "card_validation_result": "M" + }, + "authentication_data": null + }, + "billing": null + }, + "payment_token": null, + "shipping": null, + "billing": { + "address": { + "city": "Zurich", + "country": "CH", + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "zip": "8008", + "state": "asd", + "first_name": "joseph", + "last_name": "Doe", + "origin_zip": "43234" + }, + "phone": null, + "email": null + }, + "order_details": null, + "email": "guest@example.com", + "name": null, + "phone": null, + "return_url": null, + "authentication_type": "no_three_ds", + "statement_descriptor_name": null, + "statement_descriptor_suffix": null, + "next_action": null, + "cancellation_reason": null, + "error_code": null, + "error_message": null, + "unified_code": null, + "unified_message": null, + "payment_experience": null, + "payment_method_type": "credit", + "connector_label": null, + "business_country": null, + "business_label": "default", + "business_sub_label": null, + "allowed_payment_method_types": null, + "ephemeral_key": { + "customer_id": "131123", + "created_at": 1755881049, + "expires": 1755884649, + "secret": "epk_9348e3aa032c4d098bbfd192de70ef12" + }, + "manual_retry_allowed": false, + "connector_transaction_id": "83997485375813577", + "frm_message": null, + "metadata": null, + "connector_metadata": null, + "feature_metadata": { + "redirect_response": null, + "search_tags": null, + "apple_pay_recurring_details": null, + "gateway_system": "direct" + }, + "reference_id": "pay_SdL4iUqO5d7j0FzJYU65_1", + "payment_link": null, + "profile_id": "pro_hu1z8tTKASkmCSAzpgrG", + "surcharge_details": null, + "attempt_count": 1, + "merchant_decision": null, + "merchant_connector_id": "mca_lWpk5Il3XuhAhU9yZCYv", + "incremental_authorization_allowed": false, + "authorization_count": null, + "incremental_authorizations": null, + "external_authentication_details": null, + "external_3ds_authentication_attempted": false, + "expires_on": "2025-08-22T16:59:09.334Z", + "fingerprint": null, + "browser_info": null, + "payment_channel": null, + "payment_method_id": "pm_g1hGld5oStSlL23yZMU7", + "network_transaction_id": "1096408000822", + "payment_method_status": "inactive", + "updated": "2025-08-22T16:44:10.187Z", + "split_payments": null, + "frm_metadata": null, + "extended_authorization_applied": null, + "capture_before": null, + "merchant_order_reference_id": null, + "order_tax_amount": null, + "connector_mandate_id": "2592937072890001", + "card_discovery": "manual", + "force_3ds_challenge": false, + "force_3ds_challenge_trigger": false, + "issuer_error_code": null, + "issuer_error_message": null, + "is_iframe_redirection_enabled": null, + "whole_connector_response": null, + "enable_partial_authorization": null +} +``` +Payments Method table: +Screenshot 2025-08-22 at 10 19 32 PM + +Payments Attempt Table: +Screenshot 2025-08-22 at 10 20 02 PM + +Normal Card's Flow +Request +``` +curl --location 'http://localhost:8080/payments' \ +--header 'Content-Type: application/json' \ +--header 'Accept: application/json' \ +--header 'api-key: dev_DD2unr7vk4xDt33fxLlCT7JRyc5lX0ffC5fSLUo8Qrwcz4MLzt55T8jnBzveIgLs' \ +--data-raw '{ + "amount": 1000, + "currency": "USD", + "amount_to_capture": 1000, + "customer_id":"131123", + "confirm": true, + "capture_method": "automatic", + + "authentication_type": "no_three_ds", + "payment_method": "card", + "payment_method_type": "credit", + + "email": "guest@example.com", + "payment_method_data": { + "card": { + "card_number": "5404000000000001", + "card_exp_month": "09", + "card_exp_year": "25", + "card_holder_name": "joseph Doe", + "card_cvc": "123" + } + }, + "billing": { + "address": { + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "city": "Zurich", + "state": "asd", + "zip": "8008", + "country": "CH", + "first_name": "joseph", + "last_name": "Doe", + "origin_zip":"43234" + } + } +}' +``` +Response +``` +{ + "payment_id": "pay_6nYH976LGZjIxtPDiPBH", + "merchant_id": "merchant_1755880712", + "status": "processing", + "amount": 1000, + "net_amount": 1000, + "shipping_cost": null, + "amount_capturable": 1000, + "amount_received": null, + "connector": "worldpayvantiv", + "client_secret": "pay_6nYH976LGZjIxtPDiPBH_secret_xEhb0OgmGKkfmggg9aXW", + "created": "2025-08-22T16:55:44.705Z", + "currency": "USD", + "customer_id": "131123", + "customer": { + "id": "131123", + "name": null, + "email": "guest@example.com", + "phone": null, + "phone_country_code": null + }, + "description": null, + "refunds": null, + "disputes": null, + "mandate_id": null, + "mandate_data": null, + "setup_future_usage": null, + "off_session": null, + "capture_on": null, + "capture_method": "automatic", + "payment_method": "card", + "payment_method_data": { + "card": { + "last4": "0001", + "card_type": null, + "card_network": null, + "card_issuer": null, + "card_issuing_country": null, + "card_isin": "540400", + "card_extended_bin": null, + "card_exp_month": "09", + "card_exp_year": "25", + "card_holder_name": "joseph Doe", + "payment_checks": { + "avs_result": "00", + "advanced_a_v_s_result": null, + "authentication_result": null, + "card_validation_result": "M" + }, + "authentication_data": null + }, + "billing": null + }, + "payment_token": null, + "shipping": null, + "billing": { + "address": { + "city": "Zurich", + "country": "CH", + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "zip": "8008", + "state": "asd", + "first_name": "joseph", + "last_name": "Doe", + "origin_zip": "43234" + }, + "phone": null, + "email": null + }, + "order_details": null, + "email": "guest@example.com", + "name": null, + "phone": null, + "return_url": null, + "authentication_type": "no_three_ds", + "statement_descriptor_name": null, + "statement_descriptor_suffix": null, + "next_action": null, + "cancellation_reason": null, + "error_code": null, + "error_message": null, + "unified_code": null, + "unified_message": null, + "payment_experience": null, + "payment_method_type": "credit", + "connector_label": null, + "business_country": null, + "business_label": "default", + "business_sub_label": null, + "allowed_payment_method_types": null, + "ephemeral_key": { + "customer_id": "131123", + "created_at": 1755881744, + "expires": 1755885344, + "secret": "epk_e922a4645c01494495dc217f2edab3ef" + }, + "manual_retry_allowed": false, + "connector_transaction_id": "83997485380421630", + "frm_message": null, + "metadata": null, + "connector_metadata": null, + "feature_metadata": { + "redirect_response": null, + "search_tags": null, + "apple_pay_recurring_details": null, + "gateway_system": "direct" + }, + "reference_id": "pay_6nYH976LGZjIxtPDiPBH_1", + "payment_link": null, + "profile_id": "pro_hu1z8tTKASkmCSAzpgrG", + "surcharge_details": null, + "attempt_count": 1, + "merchant_decision": null, + "merchant_connector_id": "mca_lWpk5Il3XuhAhU9yZCYv", + "incremental_authorization_allowed": false, + "authorization_count": null, + "incremental_authorizations": null, + "external_authentication_details": null, + "external_3ds_authentication_attempted": false, + "expires_on": "2025-08-22T17:10:44.705Z", + "fingerprint": null, + "browser_info": null, + "payment_channel": null, + "payment_method_id": null, + "network_transaction_id": "3614028940822", + "payment_method_status": null, + "updated": "2025-08-22T16:55:45.233Z", + "split_payments": null, + "frm_metadata": null, + "extended_authorization_applied": null, + "capture_before": null, + "merchant_order_reference_id": null, + "order_tax_amount": null, + "connector_mandate_id": null, + "card_discovery": "manual", + "force_3ds_challenge": false, + "force_3ds_challenge_trigger": false, + "issuer_error_code": null, + "issuer_error_message": null, + "is_iframe_redirection_enabled": null, + "whole_connector_response": null, + "enable_partial_authorization": null +} +``` +Payments Attempt +Screenshot 2025-08-22 at 10 27 16 PM + + +## Checklist + + +- [x] I formatted the code `cargo +nightly fmt --all` +- [x] I addressed lints thrown by `cargo clippy` +- [x] I reviewed the submitted code +- [ ] I added unit tests for my changes where possible +COMMENTS: +- semanticdiff-com[bot]: Review changes with  SemanticDiff +
+Changed Files +
+ +| File | Status | +| :--- | :--- | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#crates/router/src/core/payments/transformers.rs)  [crates/router/src/core/payments/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#crates/router/src/core/payments/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#crates/router/src/core/payments/transformers.rs)  54% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#crates/diesel_models/src/payment_attempt.rs)  [crates/diesel\_models/src/payment\_attempt\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#crates/diesel_models/src/payment_attempt.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#crates/diesel_models/src/payment_attempt.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#crates/diesel_models/src/schema.rs)  [crates/diesel\_models/src/schema\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#crates/diesel_models/src/schema.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#crates/diesel_models/src/schema.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#crates/diesel_models/src/schema_v2.rs)  [crates/diesel\_models/src/schema\_v2\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#crates/diesel_models/src/schema_v2.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#crates/diesel_models/src/schema_v2.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#crates/diesel_models/src/user/sample_data.rs)  [crates/diesel\_models/src/user/sample\_data\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#crates/diesel_models/src/user/sample_data.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#crates/diesel_models/src/user/sample_data.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#crates/hyperswitch_domain_models/src/payments/payment_attempt.rs)  [crates/hyperswitch\_domain\_models/src/payments/payment\_attempt\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#crates/hyperswitch_domain_models/src/payments/payment_attempt.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#crates/hyperswitch_domain_models/src/payments/payment_attempt.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#crates/hyperswitch_domain_models/src/router_response_types.rs)  [crates/hyperswitch\_domain\_models/src/router\_response\_types\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#crates/hyperswitch_domain_models/src/router_response_types.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#crates/hyperswitch_domain_models/src/router_response_types.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#crates/router/src/core/payments/helpers.rs)  [crates/router/src/core/payments/helpers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#crates/router/src/core/payments/helpers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#crates/router/src/core/payments/helpers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#crates/router/src/core/payments/operations/payment_confirm.rs)  [crates/router/src/core/payments/operations/payment\_confirm\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#crates/router/src/core/payments/operations/payment_confirm.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#crates/router/src/core/payments/operations/payment_confirm.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#crates/router/src/core/payments/operations/payment_create.rs)  [crates/router/src/core/payments/operations/payment\_create\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#crates/router/src/core/payments/operations/payment_create.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#crates/router/src/core/payments/operations/payment_create.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#crates/router/src/core/payments/operations/payment_response.rs)  [crates/router/src/core/payments/operations/payment\_response\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#crates/router/src/core/payments/operations/payment_response.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#crates/router/src/core/payments/operations/payment_response.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#crates/router/src/core/payments/operations/payment_update.rs)  [crates/router/src/core/payments/operations/payment\_update\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#crates/router/src/core/payments/operations/payment_update.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#crates/router/src/core/payments/operations/payment_update.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#crates/router/src/core/payments/retry.rs)  [crates/router/src/core/payments/retry\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#crates/router/src/core/payments/retry.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#crates/router/src/core/payments/retry.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#crates/router/src/services/kafka/payment_attempt.rs)  [crates/router/src/services/kafka/payment\_attempt\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#crates/router/src/services/kafka/payment_attempt.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#crates/router/src/services/kafka/payment_attempt.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#crates/router/src/services/kafka/payment_attempt_event.rs)  [crates/router/src/services/kafka/payment\_attempt\_event\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#crates/router/src/services/kafka/payment_attempt_event.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#crates/router/src/services/kafka/payment_attempt_event.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#crates/router/src/types/storage/payment_attempt.rs)  [crates/router/src/types/storage/payment\_attempt\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#crates/router/src/types/storage/payment_attempt.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#crates/router/src/types/storage/payment_attempt.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#crates/router/src/utils/user/sample_data.rs)  [crates/router/src/utils/user/sample\_data\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#crates/router/src/utils/user/sample_data.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#crates/router/src/utils/user/sample_data.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#crates/storage_impl/src/mock_db/payment_attempt.rs)  [crates/storage\_impl/src/mock\_db/payment\_attempt\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#crates/storage_impl/src/mock_db/payment_attempt.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#crates/storage_impl/src/mock_db/payment_attempt.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#crates/storage_impl/src/payments/payment_attempt.rs)  [crates/storage\_impl/src/payments/payment\_attempt\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#crates/storage_impl/src/payments/payment_attempt.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#crates/storage_impl/src/payments/payment_attempt.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#migrations/2025-08-20-095434_add_ntid_in_attempt_table/down.sql)  [migrations/2025\-08\-20\-095434\_add\_ntid\_in\_attempt\_table/down\.sql](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#migrations/2025-08-20-095434_add_ntid_in_attempt_table/down.sql) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#migrations/2025-08-20-095434_add_ntid_in_attempt_table/up.sql)  [migrations/2025\-08\-20\-095434\_add\_ntid\_in\_attempt\_table/up\.sql](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9032/changes#migrations/2025-08-20-095434_add_ntid_in_attempt_table/up.sql) | Unsupported file format | + +
+- ShankarSinghC [crates/router/src/services/kafka/payment_attempt_event.rs:283]: Should we include `network_transaction_id` in `KafkaPaymentAttemptEvent` ? + +=== COMMIT === +SUBJECT: feat(core): Add network_transaction_id in payments Response (#9032) +BODY: +Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> + +=== FILES === +Summary: 21 files changed, +108 -3 +- crates/diesel_models/src/payment_attempt.rs (+35 -0) +- crates/diesel_models/src/schema.rs (+2 -0) +- crates/diesel_models/src/schema_v2.rs (+2 -0) +- crates/diesel_models/src/user/sample_data.rs (+2 -0) +- crates/hyperswitch_domain_models/src/payments/payment_attempt.rs (+24 -0) +- crates/hyperswitch_domain_models/src/router_response_types.rs (+6 -0) +- crates/router/src/core/payments/helpers.rs (+1 -0) +- crates/router/src/core/payments/operations/payment_confirm.rs (+4 -0) +- crates/router/src/core/payments/operations/payment_create.rs (+1 -0) +- crates/router/src/core/payments/operations/payment_response.rs (+7 -0) +- crates/router/src/core/payments/operations/payment_update.rs (+2 -0) +- crates/router/src/core/payments/retry.rs (+5 -0) +- crates/router/src/core/payments/transformers.rs (+1 -3) +- crates/router/src/services/kafka/payment_attempt.rs (+1 -0) +- crates/router/src/services/kafka/payment_attempt_event.rs (+1 -0) +- crates/router/src/types/storage/payment_attempt.rs (+3 -0) +- crates/router/src/utils/user/sample_data.rs (+1 -0) +- crates/storage_impl/src/mock_db/payment_attempt.rs (+1 -0) +- crates/storage_impl/src/payments/payment_attempt.rs (+5 -0) +- migrations/2025-08-20-095434_add_ntid_in_attempt_table/down.sql (+2 -0) +- migrations/2025-08-20-095434_add_ntid_in_attempt_table/up.sql (+2 -0) + +=== PATCH === +diff --git a/crates/diesel_models/src/payment_attempt.rs b/crates/diesel_models/src/payment_attempt.rs +index 9c3b4a56..0a085991 100644 +--- a/crates/diesel_models/src/payment_attempt.rs ++++ b/crates/diesel_models/src/payment_attempt.rs +@@ -96,6 +96,7 @@ pub struct PaymentAttempt { + pub processor_merchant_id: Option, + pub created_by: Option, + pub connector_request_reference_id: Option, ++ pub network_transaction_id: Option, + #[diesel(deserialize_as = RequiredFromNullable)] + pub payment_method_type_v2: storage_enums::PaymentMethod, + pub connector_payment_id: Option, +@@ -210,6 +211,7 @@ pub struct PaymentAttempt { + pub setup_future_usage_applied: Option, + pub routing_approach: Option, + pub connector_request_reference_id: Option, ++ pub network_transaction_id: Option, + } + + #[cfg(feature = "v1")] +@@ -309,6 +311,7 @@ pub struct PaymentAttemptNew { + pub preprocessing_step_id: Option, + pub error_reason: Option, + pub connector_response_reference_id: Option, ++ pub network_transaction_id: Option, + pub multiple_capture_count: Option, + pub amount_capturable: MinorUnit, + pub updated_by: String, +@@ -431,6 +434,7 @@ pub struct PaymentAttemptNew { + pub setup_future_usage_applied: Option, + pub routing_approach: Option, + pub connector_request_reference_id: Option, ++ pub network_transaction_id: Option, + } + + #[cfg(feature = "v1")] +@@ -453,6 +457,7 @@ pub enum PaymentAttemptUpdate { + tax_amount: Option, + fingerprint_id: Option, + payment_method_billing_address_id: Option, ++ network_transaction_id: Option, + updated_by: String, + }, + UpdateTrackers { +@@ -506,6 +511,7 @@ pub enum PaymentAttemptUpdate { + card_discovery: Option, + routing_approach: Option, + connector_request_reference_id: Option, ++ network_transaction_id: Option, + }, + VoidUpdate { + status: storage_enums::AttemptStatus, +@@ -537,6 +543,7 @@ pub enum PaymentAttemptUpdate { + connector: Option, + connector_transaction_id: Option, + authentication_type: Option, ++ network_transaction_id: Option, + payment_method_id: Option, + mandate_id: Option, + connector_metadata: Option, +@@ -975,6 +982,7 @@ impl PaymentAttemptUpdateInternal { + processor_merchant_id: source.processor_merchant_id, + created_by: source.created_by, + payment_method_type_v2: source.payment_method_type_v2, ++ network_transaction_id: source.network_transaction_id, + connector_payment_id: source.connector_payment_id, + payment_method_subtype: source.payment_method_subtype, + routing_result: source.routing_result, +@@ -1058,6 +1066,7 @@ pub struct PaymentAttemptUpdateInternal { + pub setup_future_usage_applied: Option, + pub routing_approach: Option, + pub connector_request_reference_id: Option, ++ pub network_transaction_id: Option, + } + + #[cfg(feature = "v1")] +@@ -1249,6 +1258,7 @@ impl PaymentAttemptUpdate { + setup_future_usage_applied, + routing_approach, + connector_request_reference_id, ++ network_transaction_id, + } = PaymentAttemptUpdateInternal::from(self).populate_derived_fields(&source); + PaymentAttempt { + amount: amount.unwrap_or(source.amount), +@@ -1318,6 +1328,7 @@ impl PaymentAttemptUpdate { + routing_approach: routing_approach.or(source.routing_approach), + connector_request_reference_id: connector_request_reference_id + .or(source.connector_request_reference_id), ++ network_transaction_id: network_transaction_id.or(source.network_transaction_id), + ..source + } + } +@@ -2317,6 +2328,7 @@ impl From for PaymentAttemptUpdateInternal { + fingerprint_id, + updated_by, + payment_method_billing_address_id, ++ network_transaction_id, + } => Self { + amount: Some(amount), + currency: Some(currency), +@@ -2378,6 +2390,7 @@ impl From for PaymentAttemptUpdateInternal { + setup_future_usage_applied: None, + routing_approach: None, + connector_request_reference_id: None, ++ network_transaction_id, + }, + PaymentAttemptUpdate::AuthenticationTypeUpdate { + authentication_type, +@@ -2442,6 +2455,7 @@ impl From for PaymentAttemptUpdateInternal { + setup_future_usage_applied: None, + routing_approach: None, + connector_request_reference_id: None, ++ network_transaction_id: None, + }, + PaymentAttemptUpdate::ConfirmUpdate { + amount, +@@ -2479,6 +2493,7 @@ impl From for PaymentAttemptUpdateInternal { + card_discovery, + routing_approach, + connector_request_reference_id, ++ network_transaction_id, + } => Self { + amount: Some(amount), + currency: Some(currency), +@@ -2539,6 +2554,7 @@ impl From for PaymentAttemptUpdateInternal { + setup_future_usage_applied: None, + routing_approach, + connector_request_reference_id, ++ network_transaction_id, + }, + PaymentAttemptUpdate::VoidUpdate { + status, +@@ -2604,6 +2620,7 @@ impl From for PaymentAttemptUpdateInternal { + setup_future_usage_applied: None, + routing_approach: None, + connector_request_reference_id: None, ++ network_transaction_id: None, + }, + PaymentAttemptUpdate::RejectUpdate { + status, +@@ -2670,6 +2687,7 @@ impl From for PaymentAttemptUpdateInternal { + setup_future_usage_applied: None, + routing_approach: None, + connector_request_reference_id: None, ++ network_transaction_id: None, + }, + PaymentAttemptUpdate::BlocklistUpdate { + status, +@@ -2736,6 +2754,7 @@ impl From for PaymentAttemptUpdateInternal { + setup_future_usage_applied: None, + routing_approach: None, + connector_request_reference_id: None, ++ network_transaction_id: None, + }, + PaymentAttemptUpdate::ConnectorMandateDetailUpdate { + connector_mandate_detail, +@@ -2800,6 +2819,7 @@ impl From for PaymentAttemptUpdateInternal { + setup_future_usage_applied: None, + routing_approach: None, + connector_request_reference_id: None, ++ network_transaction_id: None, + }, + PaymentAttemptUpdate::PaymentMethodDetailsUpdate { + payment_method_id, +@@ -2864,6 +2884,7 @@ impl From for PaymentAttemptUpdateInternal { + setup_future_usage_applied: None, + routing_approach: None, + connector_request_reference_id: None, ++ network_transaction_id: None, + }, + PaymentAttemptUpdate::ResponseUpdate { + status, +@@ -2890,6 +2911,7 @@ impl From for PaymentAttemptUpdateInternal { + connector_mandate_detail, + charges, + setup_future_usage_applied, ++ network_transaction_id, + } => { + let (connector_transaction_id, processor_transaction_data) = + connector_transaction_id +@@ -2956,6 +2978,7 @@ impl From for PaymentAttemptUpdateInternal { + setup_future_usage_applied, + routing_approach: None, + connector_request_reference_id: None, ++ network_transaction_id, + } + } + PaymentAttemptUpdate::ErrorUpdate { +@@ -3039,6 +3062,7 @@ impl From for PaymentAttemptUpdateInternal { + setup_future_usage_applied: None, + routing_approach: None, + connector_request_reference_id: None, ++ network_transaction_id: None, + } + } + PaymentAttemptUpdate::StatusUpdate { status, updated_by } => Self { +@@ -3101,6 +3125,7 @@ impl From for PaymentAttemptUpdateInternal { + setup_future_usage_applied: None, + routing_approach: None, + connector_request_reference_id: None, ++ network_transaction_id: None, + }, + PaymentAttemptUpdate::UpdateTrackers { + payment_token, +@@ -3172,6 +3197,7 @@ impl From for PaymentAttemptUpdateInternal { + setup_future_usage_applied: None, + routing_approach, + connector_request_reference_id: None, ++ network_transaction_id: None, + }, + PaymentAttemptUpdate::UnresolvedResponseUpdate { + status, +@@ -3249,6 +3275,7 @@ impl From for PaymentAttemptUpdateInternal { + setup_future_usage_applied: None, + routing_approach: None, + connector_request_reference_id: None, ++ network_transaction_id: None, + } + } + PaymentAttemptUpdate::PreprocessingUpdate { +@@ -3325,6 +3352,7 @@ impl From for PaymentAttemptUpdateInternal { + setup_future_usage_applied: None, + routing_approach: None, + connector_request_reference_id: None, ++ network_transaction_id: None, + } + } + PaymentAttemptUpdate::CaptureUpdate { +@@ -3391,6 +3419,7 @@ impl From for PaymentAttemptUpdateInternal { + setup_future_usage_applied: None, + routing_approach: None, + connector_request_reference_id: None, ++ network_transaction_id: None, + }, + PaymentAttemptUpdate::AmountToCaptureUpdate { + status, +@@ -3456,6 +3485,7 @@ impl From for PaymentAttemptUpdateInternal { + setup_future_usage_applied: None, + routing_approach: None, + connector_request_reference_id: None, ++ network_transaction_id: None, + }, + PaymentAttemptUpdate::ConnectorResponse { + authentication_data, +@@ -3530,6 +3560,7 @@ impl From for PaymentAttemptUpdateInternal { + setup_future_usage_applied: None, + routing_approach: None, + connector_request_reference_id: None, ++ network_transaction_id: None, + } + } + PaymentAttemptUpdate::IncrementalAuthorizationAmountUpdate { +@@ -3595,6 +3626,7 @@ impl From for PaymentAttemptUpdateInternal { + setup_future_usage_applied: None, + routing_approach: None, + connector_request_reference_id: None, ++ network_transaction_id: None, + }, + PaymentAttemptUpdate::AuthenticationUpdate { + status, +@@ -3662,6 +3694,7 @@ impl From for PaymentAttemptUpdateInternal { + setup_future_usage_applied: None, + routing_approach: None, + connector_request_reference_id: None, ++ network_transaction_id: None, + }, + PaymentAttemptUpdate::ManualUpdate { + status, +@@ -3738,6 +3771,7 @@ impl From for PaymentAttemptUpdateInternal { + setup_future_usage_applied: None, + routing_approach: None, + connector_request_reference_id: None, ++ network_transaction_id: None, + } + } + PaymentAttemptUpdate::PostSessionTokensUpdate { +@@ -3803,6 +3837,7 @@ impl From for PaymentAttemptUpdateInternal { + setup_future_usage_applied: None, + routing_approach: None, + connector_request_reference_id: None, ++ network_transaction_id: None, + }, + } + } +diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rs +index 319503e6..08675d90 100644 +--- a/crates/diesel_models/src/schema.rs ++++ b/crates/diesel_models/src/schema.rs +@@ -981,6 +981,8 @@ diesel::table! { + routing_approach -> Nullable, + #[max_length = 255] + connector_request_reference_id -> Nullable, ++ #[max_length = 255] ++ network_transaction_id -> Nullable, + } + } + +diff --git a/crates/diesel_models/src/schema_v2.rs b/crates/diesel_models/src/schema_v2.rs +index 1837903f..4711143d 100644 +--- a/crates/diesel_models/src/schema_v2.rs ++++ b/crates/diesel_models/src/schema_v2.rs +@@ -923,6 +923,8 @@ diesel::table! { + created_by -> Nullable, + #[max_length = 255] + connector_request_reference_id -> Nullable, ++ #[max_length = 255] ++ network_transaction_id -> Nullable, + payment_method_type_v2 -> Nullable, + #[max_length = 128] + connector_payment_id -> Nullable, +diff --git a/crates/diesel_models/src/user/sample_data.rs b/crates/diesel_models/src/user/sample_data.rs +index f892ac8e..846c0852 100644 +--- a/crates/diesel_models/src/user/sample_data.rs ++++ b/crates/diesel_models/src/user/sample_data.rs +@@ -218,6 +218,7 @@ pub struct PaymentAttemptBatchNew { + pub setup_future_usage_applied: Option, + pub routing_approach: Option, + pub connector_request_reference_id: Option, ++ pub network_transaction_id: Option, + } + + #[cfg(feature = "v1")] +@@ -305,6 +306,7 @@ impl PaymentAttemptBatchNew { + setup_future_usage_applied: self.setup_future_usage_applied, + routing_approach: self.routing_approach, + connector_request_reference_id: self.connector_request_reference_id, ++ network_transaction_id: self.network_transaction_id, + } + } + } +diff --git a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs +index 755d9f79..4d1ae8bb 100644 +--- a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs ++++ b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs +@@ -490,6 +490,7 @@ pub struct PaymentAttempt { + /// merchantwho invoked the resource based api (identifier) and through what source (Api, Jwt(Dashboard)) + pub created_by: Option, + pub connector_request_reference_id: Option, ++ pub network_transaction_id: Option, + } + + impl PaymentAttempt { +@@ -622,6 +623,7 @@ impl PaymentAttempt { + processor_merchant_id: payment_intent.merchant_id.clone(), + created_by: None, + connector_request_reference_id: None, ++ network_transaction_id: None, + }) + } + +@@ -711,6 +713,7 @@ impl PaymentAttempt { + processor_merchant_id: payment_intent.merchant_id.clone(), + created_by: None, + connector_request_reference_id: None, ++ network_transaction_id: None, + }) + } + +@@ -806,6 +809,7 @@ impl PaymentAttempt { + processor_merchant_id: payment_intent.merchant_id.clone(), + created_by: None, + connector_request_reference_id: None, ++ network_transaction_id: None, + }) + } + +@@ -915,6 +919,7 @@ impl PaymentAttempt { + processor_merchant_id: payment_intent.merchant_id.clone(), + created_by: None, + connector_request_reference_id, ++ network_transaction_id: None, + }) + } + +@@ -1015,6 +1020,7 @@ pub struct PaymentAttempt { + pub routing_approach: Option, + pub connector_request_reference_id: Option, + pub debit_routing_savings: Option, ++ pub network_transaction_id: Option, + } + + #[cfg(feature = "v1")] +@@ -1307,6 +1313,7 @@ pub struct PaymentAttemptNew { + pub setup_future_usage_applied: Option, + pub routing_approach: Option, + pub connector_request_reference_id: Option, ++ pub network_transaction_id: Option, + } + + #[cfg(feature = "v1")] +@@ -1328,6 +1335,7 @@ pub enum PaymentAttemptUpdate { + fingerprint_id: Option, + payment_method_billing_address_id: Option, + updated_by: String, ++ network_transaction_id: Option, + }, + UpdateTrackers { + payment_token: Option, +@@ -1376,6 +1384,7 @@ pub enum PaymentAttemptUpdate { + card_discovery: Option, + routing_approach: Option, + connector_request_reference_id: Option, ++ network_transaction_id: Option, + }, + RejectUpdate { + status: storage_enums::AttemptStatus, +@@ -1406,6 +1415,7 @@ pub enum PaymentAttemptUpdate { + status: storage_enums::AttemptStatus, + connector: Option, + connector_transaction_id: Option, ++ network_transaction_id: Option, + authentication_type: Option, + payment_method_id: Option, + mandate_id: Option, +@@ -1532,6 +1542,7 @@ impl PaymentAttemptUpdate { + amount_to_capture, + capture_method, + fingerprint_id, ++ network_transaction_id, + payment_method_billing_address_id, + updated_by, + } => DieselPaymentAttemptUpdate::Update { +@@ -1551,6 +1562,7 @@ impl PaymentAttemptUpdate { + tax_amount: net_amount.get_tax_on_surcharge(), + fingerprint_id, + payment_method_billing_address_id, ++ network_transaction_id, + updated_by, + }, + Self::UpdateTrackers { +@@ -1645,6 +1657,7 @@ impl PaymentAttemptUpdate { + card_discovery, + routing_approach, + connector_request_reference_id, ++ network_transaction_id, + } => DieselPaymentAttemptUpdate::ConfirmUpdate { + amount: net_amount.get_order_amount(), + currency, +@@ -1688,6 +1701,7 @@ impl PaymentAttemptUpdate { + _ => approach, + }), + connector_request_reference_id, ++ network_transaction_id, + }, + Self::VoidUpdate { + status, +@@ -1723,6 +1737,7 @@ impl PaymentAttemptUpdate { + connector_mandate_detail, + charges, + setup_future_usage_applied, ++ network_transaction_id, + debit_routing_savings: _, + } => DieselPaymentAttemptUpdate::ResponseUpdate { + status, +@@ -1749,6 +1764,7 @@ impl PaymentAttemptUpdate { + connector_mandate_detail, + charges, + setup_future_usage_applied, ++ network_transaction_id, + }, + Self::UnresolvedResponseUpdate { + status, +@@ -2123,6 +2139,7 @@ impl behaviour::Conversion for PaymentAttempt { + created_by: self.created_by.map(|cb| cb.to_string()), + routing_approach: self.routing_approach, + connector_request_reference_id: self.connector_request_reference_id, ++ network_transaction_id: self.network_transaction_id, + }) + } + +@@ -2221,6 +2238,7 @@ impl behaviour::Conversion for PaymentAttempt { + routing_approach: storage_model.routing_approach, + connector_request_reference_id: storage_model.connector_request_reference_id, + debit_routing_savings: None, ++ network_transaction_id: storage_model.network_transaction_id, + }) + } + .await +@@ -2311,6 +2329,7 @@ impl behaviour::Conversion for PaymentAttempt { + setup_future_usage_applied: self.setup_future_usage_applied, + routing_approach: self.routing_approach, + connector_request_reference_id: self.connector_request_reference_id, ++ network_transaction_id: self.network_transaction_id, + }) + } + } +@@ -2383,6 +2402,7 @@ impl behaviour::Conversion for PaymentAttempt { + processor_merchant_id, + created_by, + connector_request_reference_id, ++ network_transaction_id, + } = self; + + let AttemptAmountDetails { +@@ -2478,6 +2498,7 @@ impl behaviour::Conversion for PaymentAttempt { + processor_merchant_id: Some(processor_merchant_id), + created_by: created_by.map(|cb| cb.to_string()), + connector_request_reference_id, ++ network_transaction_id, + }) + } + +@@ -2601,6 +2622,7 @@ impl behaviour::Conversion for PaymentAttempt { + .created_by + .and_then(|created_by| created_by.parse::().ok()), + connector_request_reference_id: storage_model.connector_request_reference_id, ++ network_transaction_id: storage_model.network_transaction_id, + }) + } + .await +@@ -2660,6 +2682,7 @@ impl behaviour::Conversion for PaymentAttempt { + processor_merchant_id, + created_by, + connector_request_reference_id, ++ network_transaction_id, + } = self; + + let card_network = payment_method_data +@@ -2677,6 +2700,7 @@ impl behaviour::Conversion for PaymentAttempt { + payment_id, + merchant_id, + status, ++ network_transaction_id, + error_message: error_details + .as_ref() + .map(|details| details.message.clone()), +diff --git a/crates/hyperswitch_domain_models/src/router_response_types.rs b/crates/hyperswitch_domain_models/src/router_response_types.rs +index c7cfbc76..17c268fb 100644 +--- a/crates/hyperswitch_domain_models/src/router_response_types.rs ++++ b/crates/hyperswitch_domain_models/src/router_response_types.rs +@@ -143,6 +143,12 @@ impl PaymentsResponseData { + _ => None, + } + } ++ pub fn get_network_transaction_id(&self) -> Option { ++ match self { ++ Self::TransactionResponse { network_txn_id, .. } => network_txn_id.clone(), ++ _ => None, ++ } ++ } + + pub fn get_connector_transaction_id( + &self, +diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs +index 1523a4b3..b3a1c7e5 100644 +--- a/crates/router/src/core/payments/helpers.rs ++++ b/crates/router/src/core/payments/helpers.rs +@@ -4635,6 +4635,7 @@ impl AttemptType { + setup_future_usage_applied: None, + routing_approach: old_payment_attempt.routing_approach, + connector_request_reference_id: None, ++ network_transaction_id: None, + } + } + +diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rs +index 7cc48fd6..dca5c726 100644 +--- a/crates/router/src/core/payments/operations/payment_confirm.rs ++++ b/crates/router/src/core/payments/operations/payment_confirm.rs +@@ -1967,6 +1967,10 @@ impl UpdateTracker, api::PaymentsRequest> for + card_discovery, + routing_approach: payment_data.payment_attempt.routing_approach, + connector_request_reference_id, ++ network_transaction_id: payment_data ++ .payment_attempt ++ .network_transaction_id ++ .clone(), + }, + storage_scheme, + ) +diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rs +index d9b71791..79bfbebf 100644 +--- a/crates/router/src/core/payments/operations/payment_create.rs ++++ b/crates/router/src/core/payments/operations/payment_create.rs +@@ -1386,6 +1386,7 @@ impl PaymentCreate { + setup_future_usage_applied: request.setup_future_usage, + routing_approach: Some(common_enums::RoutingApproach::default()), + connector_request_reference_id: None, ++ network_transaction_id:None, + }, + additional_pm_data, + +diff --git a/crates/router/src/core/payments/operations/payment_response.rs b/crates/router/src/core/payments/operations/payment_response.rs +index 0ffc4f84..830186ee 100644 +--- a/crates/router/src/core/payments/operations/payment_response.rs ++++ b/crates/router/src/core/payments/operations/payment_response.rs +@@ -1726,6 +1726,12 @@ async fn payment_response_update_tracker( + types::ResponseId::ConnectorTransactionId(ref id) + | types::ResponseId::EncodedData(ref id) => Some(id), + }; ++ let resp_network_transaction_id = router_data.response.as_ref() ++ .map_err(|err| { ++ logger::error!(error = ?err, "Failed to obtain the network_transaction_id from payment response"); ++ }) ++ .ok() ++ .and_then(|resp| resp.get_network_transaction_id()); + + let encoded_data = payment_data.payment_attempt.encoded_data.clone(); + +@@ -1932,6 +1938,7 @@ async fn payment_response_update_tracker( + .payment_attempt + .setup_future_usage_applied, + debit_routing_savings, ++ network_transaction_id: resp_network_transaction_id, + }), + ), + }; +diff --git a/crates/router/src/core/payments/operations/payment_update.rs b/crates/router/src/core/payments/operations/payment_update.rs +index 6026a82e..b1460efc 100644 +--- a/crates/router/src/core/payments/operations/payment_update.rs ++++ b/crates/router/src/core/payments/operations/payment_update.rs +@@ -813,6 +813,7 @@ impl UpdateTracker, api::PaymentsRequest> for + .surcharge_details + .as_ref() + .map(|surcharge_details| surcharge_details.tax_on_surcharge_amount); ++ let network_transaction_id = payment_data.payment_attempt.network_transaction_id.clone(); + payment_data.payment_attempt = state + .store + .update_payment_attempt_with_attempt_id( +@@ -832,6 +833,7 @@ impl UpdateTracker, api::PaymentsRequest> for + fingerprint_id: None, + payment_method_billing_address_id, + updated_by: storage_scheme.to_string(), ++ network_transaction_id, + net_amount: + hyperswitch_domain_models::payments::payment_attempt::NetAmount::new( + payment_data.amount.into(), +diff --git a/crates/router/src/core/payments/retry.rs b/crates/router/src/core/payments/retry.rs +index b49103b9..1811a449 100644 +--- a/crates/router/src/core/payments/retry.rs ++++ b/crates/router/src/core/payments/retry.rs +@@ -517,6 +517,10 @@ where + charges, + setup_future_usage_applied: None, + debit_routing_savings, ++ network_transaction_id: payment_data ++ .get_payment_attempt() ++ .network_transaction_id ++ .clone(), + }; + + #[cfg(feature = "v1")] +@@ -715,6 +719,7 @@ pub fn make_new_payment_attempt( + setup_future_usage_applied: setup_future_usage_intent, // setup future usage is picked from intent for new payment attempt + routing_approach: old_payment_attempt.routing_approach, + connector_request_reference_id: Default::default(), ++ network_transaction_id: old_payment_attempt.network_transaction_id, + } + } + +diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs +index cf91b2bc..8a3594c3 100644 +--- a/crates/router/src/core/payments/transformers.rs ++++ b/crates/router/src/core/payments/transformers.rs +@@ -3338,9 +3338,7 @@ where + fingerprint: payment_intent.fingerprint_id, + browser_info: payment_attempt.browser_info, + payment_method_id: payment_attempt.payment_method_id, +- network_transaction_id: payment_data +- .get_payment_method_info() +- .and_then(|info| info.network_transaction_id.clone()), ++ network_transaction_id: payment_attempt.network_transaction_id, + payment_method_status: payment_data + .get_payment_method_info() + .map(|info| info.status), +diff --git a/crates/router/src/services/kafka/payment_attempt.rs b/crates/router/src/services/kafka/payment_attempt.rs +index 0d8dfd87..9afb697e 100644 +--- a/crates/router/src/services/kafka/payment_attempt.rs ++++ b/crates/router/src/services/kafka/payment_attempt.rs +@@ -278,6 +278,7 @@ impl<'a> KafkaPaymentAttempt<'a> { + processor_merchant_id, + created_by, + connector_request_reference_id, ++ network_transaction_id: _, + } = attempt; + + let (connector_payment_id, connector_payment_data) = connector_payment_id +diff --git a/crates/router/src/services/kafka/payment_attempt_event.rs b/crates/router/src/services/kafka/payment_attempt_event.rs +index 5f87e017..46a05d6f 100644 +--- a/crates/router/src/services/kafka/payment_attempt_event.rs ++++ b/crates/router/src/services/kafka/payment_attempt_event.rs +@@ -280,6 +280,7 @@ impl<'a> KafkaPaymentAttemptEvent<'a> { + processor_merchant_id, + created_by, + connector_request_reference_id, ++ network_transaction_id: _, + } = attempt; + + let (connector_payment_id, connector_payment_data) = connector_payment_id +diff --git a/crates/router/src/types/storage/payment_attempt.rs b/crates/router/src/types/storage/payment_attempt.rs +index 32601f25..c0ccc2ee 100644 +--- a/crates/router/src/types/storage/payment_attempt.rs ++++ b/crates/router/src/types/storage/payment_attempt.rs +@@ -227,6 +227,7 @@ mod tests { + setup_future_usage_applied: Default::default(), + routing_approach: Default::default(), + connector_request_reference_id: Default::default(), ++ network_transaction_id: Default::default(), + }; + + let store = state +@@ -319,6 +320,7 @@ mod tests { + setup_future_usage_applied: Default::default(), + routing_approach: Default::default(), + connector_request_reference_id: Default::default(), ++ network_transaction_id: Default::default(), + }; + let store = state + .stores +@@ -424,6 +426,7 @@ mod tests { + setup_future_usage_applied: Default::default(), + routing_approach: Default::default(), + connector_request_reference_id: Default::default(), ++ network_transaction_id: Default::default(), + }; + let store = state + .stores +diff --git a/crates/router/src/utils/user/sample_data.rs b/crates/router/src/utils/user/sample_data.rs +index f7253fc0..5c8d79e0 100644 +--- a/crates/router/src/utils/user/sample_data.rs ++++ b/crates/router/src/utils/user/sample_data.rs +@@ -391,6 +391,7 @@ pub async fn generate_sample_data( + setup_future_usage_applied: None, + routing_approach: None, + connector_request_reference_id: None, ++ network_transaction_id: None, + }; + + let refund = if refunds_count < number_of_refunds && !is_failed_payment { +diff --git a/crates/storage_impl/src/mock_db/payment_attempt.rs b/crates/storage_impl/src/mock_db/payment_attempt.rs +index 0268bc93..022c2265 100644 +--- a/crates/storage_impl/src/mock_db/payment_attempt.rs ++++ b/crates/storage_impl/src/mock_db/payment_attempt.rs +@@ -238,6 +238,7 @@ impl PaymentAttemptInterface for MockDb { + routing_approach: payment_attempt.routing_approach, + connector_request_reference_id: payment_attempt.connector_request_reference_id, + debit_routing_savings: None, ++ network_transaction_id: payment_attempt.network_transaction_id, + }; + payment_attempts.push(payment_attempt.clone()); + Ok(payment_attempt) +diff --git a/crates/storage_impl/src/payments/payment_attempt.rs b/crates/storage_impl/src/payments/payment_attempt.rs +index 5424ad96..f5bcf1dc 100644 +--- a/crates/storage_impl/src/payments/payment_attempt.rs ++++ b/crates/storage_impl/src/payments/payment_attempt.rs +@@ -692,6 +692,7 @@ impl PaymentAttemptInterface for KVRouterStore { + .connector_request_reference_id + .clone(), + debit_routing_savings: None, ++ network_transaction_id: payment_attempt.network_transaction_id.clone(), + }; + + let field = format!("pa_{}", created_attempt.attempt_id); +@@ -1900,6 +1901,7 @@ impl DataModelExt for PaymentAttempt { + processor_merchant_id: Some(self.processor_merchant_id), + created_by: self.created_by.map(|created_by| created_by.to_string()), + connector_request_reference_id: self.connector_request_reference_id, ++ network_transaction_id: self.network_transaction_id, + } + } + +@@ -1993,6 +1995,7 @@ impl DataModelExt for PaymentAttempt { + routing_approach: storage_model.routing_approach, + connector_request_reference_id: storage_model.connector_request_reference_id, + debit_routing_savings: None, ++ network_transaction_id: storage_model.network_transaction_id, + } + } + } +@@ -2084,6 +2087,7 @@ impl DataModelExt for PaymentAttemptNew { + setup_future_usage_applied: self.setup_future_usage_applied, + routing_approach: self.routing_approach, + connector_request_reference_id: self.connector_request_reference_id, ++ network_transaction_id: self.network_transaction_id, + } + } + +@@ -2168,6 +2172,7 @@ impl DataModelExt for PaymentAttemptNew { + setup_future_usage_applied: storage_model.setup_future_usage_applied, + routing_approach: storage_model.routing_approach, + connector_request_reference_id: storage_model.connector_request_reference_id, ++ network_transaction_id: storage_model.network_transaction_id, + } + } + } +diff --git a/migrations/2025-08-20-095434_add_ntid_in_attempt_table/down.sql b/migrations/2025-08-20-095434_add_ntid_in_attempt_table/down.sql +new file mode 100644 +index 00000000..98f92ed3 +--- /dev/null ++++ b/migrations/2025-08-20-095434_add_ntid_in_attempt_table/down.sql +@@ -0,0 +1,2 @@ ++ALTER TABLE payment_attempt ++DROP COLUMN IF EXISTS network_transaction_id; +diff --git a/migrations/2025-08-20-095434_add_ntid_in_attempt_table/up.sql b/migrations/2025-08-20-095434_add_ntid_in_attempt_table/up.sql +new file mode 100644 +index 00000000..922423e6 +--- /dev/null ++++ b/migrations/2025-08-20-095434_add_ntid_in_attempt_table/up.sql +@@ -0,0 +1,2 @@ ++ALTER TABLE payment_attempt ++ADD COLUMN IF NOT EXISTS network_transaction_id VARCHAR(255) NULL; + +----- END CHUNK ----- \ No newline at end of file diff --git a/raw/70/70b426e3cac2dffee30fe99cdaa7040d74d92312.txt b/raw/70/70b426e3cac2dffee30fe99cdaa7040d74d92312.txt new file mode 100644 index 0000000000000000000000000000000000000000..2dab4e2d7224a33a481327dae09a77f2ad5cae39 --- /dev/null +++ b/raw/70/70b426e3cac2dffee30fe99cdaa7040d74d92312.txt @@ -0,0 +1,344 @@ +ROUTE: juspay/hyperswitch@70b426e3cac2dffee30fe99cdaa7040d74d92312 +REPO: https://github.com/juspay/hyperswitch +COMMIT: 70b426e3cac2dffee30fe99cdaa7040d74d92312 +AUTHOR: Pa1NarK <69745008+pixincreate@users.noreply.github.com> +DATE: 2025-08-26T07:05:12 + +=== ISSUE_AND_PR === +[PR #9041] fix(connector): [nordea] pass valid connector metadata fields and properly throw error unsupported flows +URL: https://github.com/juspay/hyperswitch/pull/9041 +BODY: +## Type of Change + + +- [x] Bugfix +- [ ] New feature +- [ ] Enhancement +- [ ] Refactoring +- [ ] Dependency updates +- [ ] Documentation +- [ ] CI/CD + +## Description + + +this pr addresses below mentioned nordea specific issues: + +- fixes connector metadata +- fixes refunds, void and manual capture + +### Additional Changes + +- [ ] This PR modifies the API contract +- [ ] This PR modifies the database schema +- [ ] This PR modifies application configuration/environment variables + + + +/crates/connector_configs/toml/sandbox.toml +/crates/connector_configs/toml/development.toml +/crates/connector_configs/toml/production.toml + +## Motivation and Context + + +some of the things that were to be working did not work as expected which is why this pr had to be raised. + +should close https://github.com/juspay/hyperswitch/issues/8957 + +## How did you test it? + + +WASM: + +image + +Refunds (error refactor): + +we now directly throw this error on face instead of a a generic refund failed error + +```curl +curl --location 'http://localhost:8080/refunds' \ +--header 'Content-Type: application/json' \ +--header 'Accept: application/json' \ +--header 'api-key: dev_jFXorXBJvS1rD70rdMJH3wwzN5eXY0WZ4RyWIPuCqMR0skNa2XoYLVTgMLxN0cuA' \ +--data '{ + "payment_id": "pay_IN0n2kHwoA4TySoi0g0z", + "amount": 600, + "reason": "Customer returned product", + "refund_type": "instant", + "metadata": { + "udf1": "value1", + "new_customer": "true", + "login_date": "2019-09-10T10:11:12Z" + } +}' +``` +```json +{ + "error": { + "type": "invalid_request", + "message": "Payment method type not supported", + "code": "IR_19", + "reason": "Personal API Refunds flow is not supported by Nordea" + } +} +``` + +## Checklist + + +- [x] I formatted the code `cargo +nightly fmt --all` +- [x] I addressed lints thrown by `just clippy && just clippy_v2` +- [x] I reviewed the submitted code +- [ ] I added unit tests for my changes where possible +COMMENTS: +- semanticdiff-com[bot]: Review changes with  SemanticDiff +
+Changed Files +
+ +| File | Status | +| :--- | :--- | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9041/changes#crates/hyperswitch_connectors/src/connectors/nordea/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/nordea/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9041/changes#crates/hyperswitch_connectors/src/connectors/nordea/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9041/changes#crates/hyperswitch_connectors/src/connectors/nordea/transformers.rs)  26% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9041/changes#crates/connector_configs/src/connector.rs)  [crates/connector\_configs/src/connector\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9041/changes#crates/connector_configs/src/connector.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9041/changes#crates/connector_configs/src/connector.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9041/changes#crates/connector_configs/toml/development.toml)  [crates/connector\_configs/toml/development\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9041/changes#crates/connector_configs/toml/development.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9041/changes#crates/connector_configs/toml/production.toml)  [crates/connector\_configs/toml/production\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9041/changes#crates/connector_configs/toml/production.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9041/changes#crates/connector_configs/toml/sandbox.toml)  [crates/connector\_configs/toml/sandbox\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9041/changes#crates/connector_configs/toml/sandbox.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9041/changes#crates/hyperswitch_connectors/src/connectors/nordea.rs)  [crates/hyperswitch\_connectors/src/connectors/nordea\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9041/changes#crates/hyperswitch_connectors/src/connectors/nordea.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9041/changes#crates/hyperswitch_connectors/src/connectors/nordea.rs)  0% smaller | + +
+ +=== COMMIT === +SUBJECT: fix(connector): [nordea] pass valid connector metadata fields and properly throw error unsupported flows (#9041) + +=== FILES === +Summary: 6 files changed, +40 -38 +- crates/connector_configs/src/connector.rs (+1 -0) +- crates/connector_configs/toml/development.toml (+7 -7) +- crates/connector_configs/toml/production.toml (+7 -8) +- crates/connector_configs/toml/sandbox.toml (+7 -8) +- crates/hyperswitch_connectors/src/connectors/nordea.rs (+9 -9) +- crates/hyperswitch_connectors/src/connectors/nordea/transformers.rs (+9 -6) + +=== PATCH === +diff --git a/crates/connector_configs/src/connector.rs b/crates/connector_configs/src/connector.rs +index fbdb9745..6427611b 100644 +--- a/crates/connector_configs/src/connector.rs ++++ b/crates/connector_configs/src/connector.rs +@@ -114,6 +114,7 @@ pub struct ConfigMetadata { + pub merchant_config_currency: Option, + pub merchant_account_id: Option, + pub account_name: Option, ++ pub account_type: Option, + pub terminal_id: Option, + pub google_pay: Option>, + pub apple_pay: Option>, +diff --git a/crates/connector_configs/toml/development.toml b/crates/connector_configs/toml/development.toml +index ac14c559..b496418f 100644 +--- a/crates/connector_configs/toml/development.toml ++++ b/crates/connector_configs/toml/development.toml +@@ -6420,20 +6420,20 @@ type = "Text" + api_key="Client Secret" + key1="Client ID" + api_secret="eIDAS Private Key" +-[nordea.metadata.creditor_account_type] +- name="creditor_account_type" ++[nordea.metadata.account_type] ++ name="account_type" + label="Creditor Account Type" + placeholder="Enter Beneficiary Account Type e.g. IBAN" + required=true + type="Text" +-[nordea.metadata.creditor_account_value] +- name="creditor_account_value" +- label="Creditor Account Type" ++[nordea.metadata.account_value] ++ name="destination_account_number" ++ label="Creditor Account Number" + placeholder="Enter Beneficiary Account Number" + required=true + type="Text" +-[nordea.metadata.creditor_beneficiary_name] +- name="creditor_beneficiary_name" ++[nordea.metadata.merchant_name] ++ name="merchant_name" + label="Creditor Account Beneficiary Name" + placeholder="Enter Beneficiary Name" + required=true +diff --git a/crates/connector_configs/toml/production.toml b/crates/connector_configs/toml/production.toml +index 5b14d328..5eaa0f7f 100644 +--- a/crates/connector_configs/toml/production.toml ++++ b/crates/connector_configs/toml/production.toml +@@ -5026,26 +5026,25 @@ type = "Text" + api_key="Client Secret" + key1="Client ID" + api_secret="eIDAS Private Key" +-[nordea.metadata.creditor_account_type] +- name="creditor_account_type" ++[nordea.metadata.account_type] ++ name="account_type" + label="Creditor Account Type" + placeholder="Enter Beneficiary Account Type e.g. IBAN" + required=true + type="Text" +-[nordea.metadata.creditor_account_value] +- name="creditor_account_value" +- label="Creditor Account Type" ++[nordea.metadata.account_value] ++ name="destination_account_number" ++ label="Creditor Account Number" + placeholder="Enter Beneficiary Account Number" + required=true + type="Text" +-[nordea.metadata.creditor_beneficiary_name] +- name="creditor_beneficiary_name" ++[nordea.metadata.merchant_name] ++ name="merchant_name" + label="Creditor Account Beneficiary Name" + placeholder="Enter Beneficiary Name" + required=true + type="Text" + +- + [worldpayxml] + [[worldpayxml.credit]] + payment_method_type = "Mastercard" +diff --git a/crates/connector_configs/toml/sandbox.toml b/crates/connector_configs/toml/sandbox.toml +index 486af693..f9be6ac7 100644 +--- a/crates/connector_configs/toml/sandbox.toml ++++ b/crates/connector_configs/toml/sandbox.toml +@@ -6402,26 +6402,25 @@ type = "Text" + api_key="Client Secret" + key1="Client ID" + api_secret="eIDAS Private Key" +-[nordea.metadata.creditor_account_type] +- name="creditor_account_type" ++[nordea.metadata.account_type] ++ name="account_type" + label="Creditor Account Type" + placeholder="Enter Beneficiary Account Type e.g. IBAN" + required=true + type="Text" +-[nordea.metadata.creditor_account_value] +- name="creditor_account_value" +- label="Creditor Account Type" ++[nordea.metadata.account_value] ++ name="destination_account_number" ++ label="Creditor Account Number" + placeholder="Enter Beneficiary Account Number" + required=true + type="Text" +-[nordea.metadata.creditor_beneficiary_name] +- name="creditor_beneficiary_name" ++[nordea.metadata.merchant_name] ++ name="merchant_name" + label="Creditor Account Beneficiary Name" + placeholder="Enter Beneficiary Name" + required=true + type="Text" + +- + [worldpayxml] + [[worldpayxml.credit]] + payment_method_type = "Mastercard" +diff --git a/crates/hyperswitch_connectors/src/connectors/nordea.rs b/crates/hyperswitch_connectors/src/connectors/nordea.rs +index 8eb29c3f..f33397ba 100644 +--- a/crates/hyperswitch_connectors/src/connectors/nordea.rs ++++ b/crates/hyperswitch_connectors/src/connectors/nordea.rs +@@ -1053,9 +1053,9 @@ impl ConnectorIntegration fo + _req: &RouterData, + _connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { +- Err(errors::ConnectorError::FlowNotSupported { +- flow: "Capture".to_string(), +- connector: "Nordea".to_string(), ++ Err(errors::ConnectorError::NotSupported { ++ message: "Capture".to_string(), ++ connector: "Nordea", + } + .into()) + } +@@ -1067,9 +1067,9 @@ impl ConnectorIntegration for No + _req: &RouterData, + _connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { +- Err(errors::ConnectorError::FlowNotSupported { +- flow: "Payments Cancel".to_string(), +- connector: "Nordea".to_string(), ++ Err(errors::ConnectorError::NotSupported { ++ message: "Payments Cancel".to_string(), ++ connector: "Nordea", + } + .into()) + } +@@ -1081,9 +1081,9 @@ impl ConnectorIntegration for Nordea + _req: &RefundsRouterData, + _connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { +- Err(errors::ConnectorError::FlowNotSupported { +- flow: "Personal API Refunds".to_string(), +- connector: "Nordea".to_string(), ++ Err(errors::ConnectorError::NotSupported { ++ message: "Personal API Refunds flow".to_string(), ++ connector: "Nordea", + } + .into()) + } +diff --git a/crates/hyperswitch_connectors/src/connectors/nordea/transformers.rs b/crates/hyperswitch_connectors/src/connectors/nordea/transformers.rs +index 5ca8e110..e7d5cc3f 100644 +--- a/crates/hyperswitch_connectors/src/connectors/nordea/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/nordea/transformers.rs +@@ -75,9 +75,12 @@ impl TryFrom<&ConnectorAuthType> for NordeaAuthType { + + #[derive(Debug, Default, Serialize, Deserialize)] + pub struct NordeaConnectorMetadataObject { +- pub creditor_account_value: Secret, +- pub creditor_account_type: String, +- pub creditor_beneficiary_name: Secret, ++ /// Account number of the beneficiary (merchant) ++ pub destination_account_number: Secret, ++ /// Account type (example: IBAN, BBAN_SE, BBAN_DK, BBAN_NO, BGNR, PGNR, GIRO_DK, BBAN_OTHER) ++ pub account_type: String, ++ /// Name of the beneficiary (merchant) ++ pub merchant_name: Secret, + } + + impl TryFrom<&Option> for NordeaConnectorMetadataObject { +@@ -222,14 +225,14 @@ fn get_creditor_account_from_metadata( + })?; + let creditor_account = CreditorAccount { + account: AccountNumber { +- account_type: AccountType::try_from(metadata.creditor_account_type.as_str()) ++ account_type: AccountType::try_from(metadata.account_type.as_str()) + .unwrap_or(AccountType::Iban), + currency: router_data.request.currency, +- value: metadata.creditor_account_value, ++ value: metadata.destination_account_number, + }, + country: router_data.get_optional_billing_country(), + // Merchant is the beneficiary in this case +- name: Some(metadata.creditor_beneficiary_name), ++ name: Some(metadata.merchant_name), + message: router_data + .description + .as_ref() + +----- END CHUNK ----- \ No newline at end of file diff --git a/raw/72/72eb25f074b600aa7db6c5ddab640a89f074e725.txt b/raw/72/72eb25f074b600aa7db6c5ddab640a89f074e725.txt new file mode 100644 index 0000000000000000000000000000000000000000..c6fe71456db6095e9c144b725c9f1f21827fc727 --- /dev/null +++ b/raw/72/72eb25f074b600aa7db6c5ddab640a89f074e725.txt @@ -0,0 +1,581 @@ +ROUTE: juspay/hyperswitch@72eb25f074b600aa7db6c5ddab640a89f074e725 +REPO: https://github.com/juspay/hyperswitch +COMMIT: 72eb25f074b600aa7db6c5ddab640a89f074e725 +AUTHOR: Kashif +DATE: 2025-08-19T10:42:23 + +=== ISSUE_AND_PR === +[PR #8990] refactor(connector): [AdyenPlatform] update required fields +URL: https://github.com/juspay/hyperswitch/pull/8990 +BODY: +## Type of Change + + +- [ ] Bugfix +- [ ] New feature +- [x] Enhancement +- [x] Refactoring +- [ ] Dependency updates +- [ ] Documentation +- [ ] CI/CD + +## Description +This PR removes any non mandatory fields from AdyenPlatform connector for card and SEPA payouts. + +New list + +- Card payouts +[payout_method_data.card.card_number](https://api-reference.hyperswitch.io/v1/payouts/payouts--create#body-payout-method-data-card-card-number) +[payout_method_data.card.expiry_month](https://api-reference.hyperswitch.io/v1/payouts/payouts--create#body-payout-method-data-card-expiry-month) +[payout_method_data.card.expiry_year](https://api-reference.hyperswitch.io/v1/payouts/payouts--create#body-payout-method-data-card-expiry-year) +[payout_method_data.card.card_holder_name](https://api-reference.hyperswitch.io/v1/payouts/payouts--create#body-payout-method-data-card-card-holder-name) +[billing.address.line1](https://api-reference.hyperswitch.io/v1/payouts/payouts--create#body-billing-address-line1) +[billing.address.line2](https://api-reference.hyperswitch.io/v1/payouts/payouts--create#body-billing-address-line2) +[billing.address.city](https://api-reference.hyperswitch.io/v1/payouts/payouts--create#body-billing-address-city) +[billing.address.country](https://api-reference.hyperswitch.io/v1/payouts/payouts--create#body-billing-address-country) + +- Bank payouts +Along with the payout method data depending on the bank (https://api-reference.hyperswitch.io/v1/payouts/payouts--create#body-payout-method-data-bank) +[billing.address.line1](https://api-reference.hyperswitch.io/v1/payouts/payouts--create#body-billing-address-line1) +[billing.address.line2](https://api-reference.hyperswitch.io/v1/payouts/payouts--create#body-billing-address-line2) +[billing.address.city](https://api-reference.hyperswitch.io/v1/payouts/payouts--create#body-billing-address-city) +[billing.address.country](https://api-reference.hyperswitch.io/v1/payouts/payouts--create#body-billing-address-country) +[billing.address.first_name](https://api-reference.hyperswitch.io/v1/payouts/payouts--create#body-billing-address-first-name) + +### Additional Changes + +- [ ] This PR modifies the API contract +- [ ] This PR modifies the database schema +- [ ] This PR modifies application configuration/environment variables + + + + +## Motivation and Context +This PR removes any mandatory fields that were needed for processing payouts via Adyenplatform + +## How did you test it? +Tested locally + +
+ [Negative] 1. Create SEPA payout with missing billing details + +cURL + + curl --location --request POST 'http://localhost:8080/payouts/create' \ + --header 'Content-Type: application/json' \ + --header 'api-key: dev_Rko4ofOnDKpn3Dbs0ZUz8PQ1qdIDgT183ONTPiY0dUFAJcv4eyDrzIzEnd6iFc0j' \ + --data '{"amount":1,"currency":"EUR","customer_id":"cus_5SyQoohBVj6cdUfmqLLK","description":"Its my first payout request","payout_type":"bank","priority":"instant","payout_method_data":{"bank":{"iban":"NL06INGB5632579034"}},"connector":["adyenplatform"],"entity_type":"Individual","recurring":true,"metadata":{"ref":"123"},"confirm":true,"auto_fulfill":true,"profile_id":"pro_AiAxQKHVhrQ8xdFAllu5"}' + +Response + + { + "error": { + "type": "invalid_request", + "message": "Missing required param: address", + "code": "IR_04" + } + } + +
+ + +
+ [Negative] 2. Create Card payout with missing billing details + +cURL + + curl --location --request POST 'http://localhost:8080/payouts/create' \ + --header 'Content-Type: application/json' \ + --header 'api-key: dev_Rko4ofOnDKpn3Dbs0ZUz8PQ1qdIDgT183ONTPiY0dUFAJcv4eyDrzIzEnd6iFc0j' \ + --data '{"amount":100,"currency":"EUR","profile_id":"pro_AiAxQKHVhrQ8xdFAllu5","customer_id":"cus_5SyQoohBVj6cdUfmqLLK","connector":["adyenplatform"],"description":"Its my first payout request","payout_type":"card","payout_method_data":{"card":{"card_number":"4111111111111111","expiry_month":"03","expiry_year":"2030","card_holder_name":"John Doe"}},"recurring":true,"metadata":{"ref":"123"},"confirm":true,"auto_fulfill":true}' + +Response + + { + "error": { + "type": "invalid_request", + "message": "Missing required param: address", + "code": "IR_04" + } + } + +
+ +
+ 3. Create a SEPA payout with mandatory fields + +cURL + + curl --location --request POST 'http://localhost:8080/payouts/create' \ + --header 'Content-Type: application/json' \ + --header 'api-key: dev_Rko4ofOnDKpn3Dbs0ZUz8PQ1qdIDgT183ONTPiY0dUFAJcv4eyDrzIzEnd6iFc0j' \ + --data '{"amount":1,"currency":"EUR","customer_id":"cus_5SyQoohBVj6cdUfmqLLK","description":"Its my first payout request","payout_type":"bank","priority":"instant","payout_method_data":{"bank":{"iban":"NL06INGB5632579034"}},"connector":["adyenplatform"],"billing":{"address":{"line1":"Raadhuisplein","line2":"92","city":"Hoogeveen","country":"NL","first_name":"John"}},"entity_type":"Individual","recurring":true,"metadata":{"ref":"123"},"confirm":true,"auto_fulfill":true,"profile_id":"pro_AiAxQKHVhrQ8xdFAllu5"}' + +Response + + {"payout_id":"payout_rBKFN2yzDxmULDYFUApY","merchant_id":"merchant_1755587924","merchant_order_reference_id":null,"amount":1,"currency":"EUR","connector":"adyenplatform","payout_type":"bank","payout_method_data":{"bank":{"iban":"NL06I********79034","bank_name":null,"bank_country_code":null,"bank_city":null,"bic":null}},"billing":{"address":{"city":"Hoogeveen","country":"NL","line1":"Raadhuisplein","line2":"92","line3":null,"zip":null,"state":null,"first_name":"John","last_name":null,"origin_zip":null},"phone":null,"email":null},"auto_fulfill":true,"customer_id":"cus_5SyQoohBVj6cdUfmqLLK","customer":{"id":"cus_5SyQoohBVj6cdUfmqLLK","name":"John Nether","email":null,"phone":"6168205362","phone_country_code":"+1"},"client_secret":"payout_payout_rBKFN2yzDxmULDYFUApY_secret_3G01mWdnAttOAfeC2wa8","return_url":null,"business_country":null,"business_label":null,"description":"Its my first payout request","entity_type":"Individual","recurring":true,"metadata":{"ref":"123"},"merchant_connector_id":"mca_KrzAoNCxtUDCf6kAzESd","status":"initiated","error_message":null,"error_code":null,"profile_id":"pro_AiAxQKHVhrQ8xdFAllu5","created":"2025-08-19T09:31:28.239Z","connector_transaction_id":"38EBH16813GN2MVG","priority":"instant","payout_link":null,"email":null,"name":"John Nether","phone":"6168205362","phone_country_code":"+1","unified_code":null,"unified_message":null,"payout_method_id":"pm_jod7TuYT46i6dCHkGmev"} + +
+ +
+ 4. Card payout with required fields + +cURL + + curl --location --request POST 'http://localhost:8080/payouts/create' \ + --header 'Content-Type: application/json' \ + --header 'api-key: dev_Rko4ofOnDKpn3Dbs0ZUz8PQ1qdIDgT183ONTPiY0dUFAJcv4eyDrzIzEnd6iFc0j' \ + --data '{"amount":100,"currency":"EUR","profile_id":"pro_AiAxQKHVhrQ8xdFAllu5","customer_id":"cus_5SyQoohBVj6cdUfmqLLK","connector":["adyenplatform"],"description":"Its my first payout request","payout_type":"card","payout_method_data":{"card":{"card_number":"4111111111111111","expiry_month":"03","expiry_year":"2030","card_holder_name":"John Doe"}},"billing":{"address":{"line1":"1467","line2":"Harrison Street","city":"San Fransico","country":"FR"}},"recurring":true,"metadata":{"ref":"123"},"confirm":true,"auto_fulfill":true}' + +Response + + {"payout_id":"payout_Lg2UYU0m2wQQC23NIGSD","merchant_id":"merchant_1755587924","merchant_order_reference_id":null,"amount":100,"currency":"EUR","connector":"adyenplatform","payout_type":"card","payout_method_data":{"card":{"card_issuer":null,"card_network":null,"card_type":null,"card_issuing_country":null,"bank_code":null,"last4":"1111","card_isin":"411111","card_extended_bin":null,"card_exp_month":"03","card_exp_year":"2030","card_holder_name":"John Doe"}},"billing":{"address":{"city":"San Fransico","country":"FR","line1":"1467","line2":"Harrison Street","line3":null,"zip":null,"state":null,"first_name":null,"last_name":null,"origin_zip":null},"phone":null,"email":null},"auto_fulfill":true,"customer_id":"cus_5SyQoohBVj6cdUfmqLLK","customer":{"id":"cus_5SyQoohBVj6cdUfmqLLK","name":"John Nether","email":null,"phone":"6168205362","phone_country_code":"+1"},"client_secret":"payout_payout_Lg2UYU0m2wQQC23NIGSD_secret_52k9WAGvV9OkAbfIZ4t4","return_url":null,"business_country":null,"business_label":null,"description":"Its my first payout request","entity_type":"Individual","recurring":true,"metadata":{"ref":"123"},"merchant_connector_id":"mca_KrzAoNCxtUDCf6kAzESd","status":"initiated","error_message":null,"error_code":null,"profile_id":"pro_AiAxQKHVhrQ8xdFAllu5","created":"2025-08-19T09:32:26.497Z","connector_transaction_id":"38EBH66813GZBWSE","priority":null,"payout_link":null,"email":null,"name":"John Nether","phone":"6168205362","phone_country_code":"+1","unified_code":null,"unified_message":null,"payout_method_id":"pm_sKZq1HLWSxrszfZGuubX"} + +
+ +## Checklist + + +- [x] I formatted the code `cargo +nightly fmt --all` +- [x] I addressed lints thrown by `cargo clippy` +- [ ] I reviewed the submitted code +- [ ] I added unit tests for my changes where possible +COMMENTS: +- semanticdiff-com[bot]: Review changes with  SemanticDiff +
+Changed Files +
+ +| File | Status | +| :--- | :--- | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8990/changes#crates/router/src/configs/defaults/payout_required_fields.rs)  [crates/router/src/configs/defaults/payout\_required\_fields\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8990/changes#crates/router/src/configs/defaults/payout_required_fields.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8990/changes#crates/router/src/configs/defaults/payout_required_fields.rs)  46% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8990/changes#crates/hyperswitch_connectors/src/connectors/adyenplatform/transformers/payouts.rs)  [crates/hyperswitch\_connectors/src/connectors/adyenplatform/transformers/payouts\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8990/changes#crates/hyperswitch_connectors/src/connectors/adyenplatform/transformers/payouts.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8990/changes#crates/hyperswitch_connectors/src/connectors/adyenplatform/transformers/payouts.rs)  11% smaller | + +
+ +=== COMMIT === +SUBJECT: refactor(connector): [AdyenPlatform] update required fields (#8990) +BODY: +Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> + +=== FILES === +Summary: 2 files changed, +150 -160 +- crates/hyperswitch_connectors/src/connectors/adyenplatform/transformers/payouts.rs (+79 -28) +- crates/router/src/configs/defaults/payout_required_fields.rs (+71 -132) + +=== PATCH === +diff --git a/crates/hyperswitch_connectors/src/connectors/adyenplatform/transformers/payouts.rs b/crates/hyperswitch_connectors/src/connectors/adyenplatform/transformers/payouts.rs +index 82c9afad..6c964aea 100644 +--- a/crates/hyperswitch_connectors/src/connectors/adyenplatform/transformers/payouts.rs ++++ b/crates/hyperswitch_connectors/src/connectors/adyenplatform/transformers/payouts.rs +@@ -2,9 +2,9 @@ use api_models::{payouts, webhooks}; + use common_enums::enums; + use common_utils::pii; + use error_stack::{report, ResultExt}; +-use hyperswitch_domain_models::types; ++use hyperswitch_domain_models::types::{self, PayoutsRouterData}; + use hyperswitch_interfaces::errors::ConnectorError; +-use masking::Secret; ++use masking::{ExposeInterface, Secret}; + use serde::{Deserialize, Serialize}; + + use super::{AdyenPlatformRouterData, Error}; +@@ -68,10 +68,11 @@ pub struct AdyenBankAccountDetails { + #[derive(Debug, Serialize, Deserialize)] + #[serde(rename_all = "camelCase")] + pub struct AdyenAccountHolder { +- address: AdyenAddress, ++ address: Option, + first_name: Option>, + last_name: Option>, + full_name: Option>, ++ email: Option, + #[serde(rename = "reference")] + customer_id: Option, + #[serde(rename = "type")] +@@ -251,40 +252,94 @@ impl TryFrom<&hyperswitch_domain_models::address::AddressDetails> for AdyenAddre + } + } + +-impl TryFrom<(&types::PayoutsRouterData, enums::PayoutType)> for AdyenAccountHolder { ++impl TryFrom<(&PayoutsRouterData, &payouts::CardPayout)> for AdyenAccountHolder { + type Error = Error; + + fn try_from( +- (router_data, payout_type): (&types::PayoutsRouterData, enums::PayoutType), ++ (router_data, card): (&PayoutsRouterData, &payouts::CardPayout), + ) -> Result { +- let billing_address = router_data.get_billing_address()?; +- let (first_name, last_name, full_name) = match payout_type { +- enums::PayoutType::Card => ( +- Some(router_data.get_billing_first_name()?), +- Some(router_data.get_billing_last_name()?), +- None, +- ), +- enums::PayoutType::Bank => (None, None, Some(router_data.get_billing_full_name()?)), +- _ => Err(ConnectorError::NotSupported { +- message: "Payout method not supported".to_string(), +- connector: "Adyen", +- })?, ++ let billing_address = router_data.get_optional_billing(); ++ ++ // Address is required for both card and bank payouts ++ let address = billing_address ++ .and_then(|billing| billing.address.as_ref().map(|addr| addr.try_into())) ++ .transpose()? ++ .ok_or(ConnectorError::MissingRequiredField { ++ field_name: "address", ++ })?; ++ ++ let (first_name, last_name) = if let Some(card_holder_name) = &card.card_holder_name { ++ let exposed_name = card_holder_name.clone().expose(); ++ let name_parts: Vec<&str> = exposed_name.split_whitespace().collect(); ++ let first_name = name_parts ++ .first() ++ .map(|s| Secret::new(s.to_string())) ++ .ok_or(ConnectorError::MissingRequiredField { ++ field_name: "card_holder_name.first_name", ++ })?; ++ let last_name = if name_parts.len() > 1 { ++ let remaining_names: Vec<&str> = name_parts.iter().skip(1).copied().collect(); ++ Some(Secret::new(remaining_names.join(" "))) ++ } else { ++ return Err(ConnectorError::MissingRequiredField { ++ field_name: "card_holder_name.last_name", ++ } ++ .into()); ++ }; ++ (Some(first_name), last_name) ++ } else { ++ return Err(ConnectorError::MissingRequiredField { ++ field_name: "card_holder_name", ++ } ++ .into()); + }; ++ + Ok(Self { +- address: billing_address.try_into()?, ++ address: Some(address), + first_name, + last_name, +- full_name, ++ full_name: None, ++ email: router_data.get_optional_billing_email(), ++ customer_id: Some(router_data.get_customer_id()?.get_string_repr().to_owned()), ++ entity_type: Some(EntityType::from(router_data.request.entity_type)), ++ }) ++ } ++} ++ ++impl TryFrom<(&PayoutsRouterData, &payouts::Bank)> for AdyenAccountHolder { ++ type Error = Error; ++ ++ fn try_from( ++ (router_data, _bank): (&PayoutsRouterData, &payouts::Bank), ++ ) -> Result { ++ let billing_address = router_data.get_optional_billing(); ++ ++ // Address is required for both card and bank payouts ++ let address = billing_address ++ .and_then(|billing| billing.address.as_ref().map(|addr| addr.try_into())) ++ .transpose()? ++ .ok_or(ConnectorError::MissingRequiredField { ++ field_name: "address", ++ })?; ++ ++ let full_name = router_data.get_billing_full_name()?; ++ ++ Ok(Self { ++ address: Some(address), ++ first_name: None, ++ last_name: None, ++ full_name: Some(full_name), ++ email: router_data.get_optional_billing_email(), + customer_id: Some(router_data.get_customer_id()?.get_string_repr().to_owned()), + entity_type: Some(EntityType::from(router_data.request.entity_type)), + }) + } + } + +-impl TryFrom<&AdyenPlatformRouterData<&types::PayoutsRouterData>> for AdyenTransferRequest { ++impl TryFrom<&AdyenPlatformRouterData<&PayoutsRouterData>> for AdyenTransferRequest { + type Error = Error; + fn try_from( +- item: &AdyenPlatformRouterData<&types::PayoutsRouterData>, ++ item: &AdyenPlatformRouterData<&PayoutsRouterData>, + ) -> Result { + let request = &item.router_data.request; + let (counterparty, priority) = match item.router_data.get_payout_method_data()? { +@@ -292,8 +347,7 @@ impl TryFrom<&AdyenPlatformRouterData<&types::PayoutsRouterData>> for Adye + utils::get_unimplemented_payment_method_error_message("Adyenplatform"), + ))?, + payouts::PayoutMethodData::Card(c) => { +- let card_holder: AdyenAccountHolder = +- (item.router_data, enums::PayoutType::Card).try_into()?; ++ let card_holder: AdyenAccountHolder = (item.router_data, &c).try_into()?; + let card_identification = AdyenCardIdentification { + card_number: c.card_number, + expiry_month: c.expiry_month, +@@ -309,8 +363,7 @@ impl TryFrom<&AdyenPlatformRouterData<&types::PayoutsRouterData>> for Adye + (counterparty, None) + } + payouts::PayoutMethodData::Bank(bd) => { +- let account_holder: AdyenAccountHolder = +- (item.router_data, enums::PayoutType::Bank).try_into()?; ++ let account_holder: AdyenAccountHolder = (item.router_data, &bd).try_into()?; + let bank_details = match bd { + payouts::Bank::Sepa(b) => AdyenBankAccountIdentification { + bank_type: "iban".to_string(), +@@ -367,9 +420,7 @@ impl TryFrom<&AdyenPlatformRouterData<&types::PayoutsRouterData>> for Adye + } + } + +-impl TryFrom> +- for types::PayoutsRouterData +-{ ++impl TryFrom> for PayoutsRouterData { + type Error = Error; + fn try_from( + item: PayoutsResponseRouterData, +diff --git a/crates/router/src/configs/defaults/payout_required_fields.rs b/crates/router/src/configs/defaults/payout_required_fields.rs +index a056a3ac..d6b316c4 100644 +--- a/crates/router/src/configs/defaults/payout_required_fields.rs ++++ b/crates/router/src/configs/defaults/payout_required_fields.rs +@@ -66,12 +66,81 @@ impl Default for PayoutRequiredFields { + } + } + ++fn get_billing_details_for_payment_method( ++ connector: PayoutConnectors, ++ payment_method_type: PaymentMethodType, ++) -> HashMap { ++ match connector { ++ PayoutConnectors::Adyenplatform => { ++ let mut fields = HashMap::from([ ++ ( ++ "billing.address.line1".to_string(), ++ RequiredFieldInfo { ++ required_field: "billing.address.line1".to_string(), ++ display_name: "billing_address_line1".to_string(), ++ field_type: FieldType::Text, ++ value: None, ++ }, ++ ), ++ ( ++ "billing.address.line2".to_string(), ++ RequiredFieldInfo { ++ required_field: "billing.address.line2".to_string(), ++ display_name: "billing_address_line2".to_string(), ++ field_type: FieldType::Text, ++ value: None, ++ }, ++ ), ++ ( ++ "billing.address.city".to_string(), ++ RequiredFieldInfo { ++ required_field: "billing.address.city".to_string(), ++ display_name: "billing_address_city".to_string(), ++ field_type: FieldType::Text, ++ value: None, ++ }, ++ ), ++ ( ++ "billing.address.country".to_string(), ++ RequiredFieldInfo { ++ required_field: "billing.address.country".to_string(), ++ display_name: "billing_address_country".to_string(), ++ field_type: FieldType::UserAddressCountry { ++ options: get_countries_for_connector(connector) ++ .iter() ++ .map(|country| country.to_string()) ++ .collect::>(), ++ }, ++ value: None, ++ }, ++ ), ++ ]); ++ ++ // Add first_name for bank payouts only ++ if payment_method_type == PaymentMethodType::Sepa { ++ fields.insert( ++ "billing.address.first_name".to_string(), ++ RequiredFieldInfo { ++ required_field: "billing.address.first_name".to_string(), ++ display_name: "billing_address_first_name".to_string(), ++ field_type: FieldType::Text, ++ value: None, ++ }, ++ ); ++ } ++ ++ fields ++ } ++ _ => get_billing_details(connector), ++ } ++} ++ + #[cfg(feature = "v1")] + fn get_connector_payment_method_type_fields( + connector: PayoutConnectors, + payment_method_type: PaymentMethodType, + ) -> (PaymentMethodType, ConnectorFields) { +- let mut common_fields = get_billing_details(connector); ++ let mut common_fields = get_billing_details_for_payment_method(connector, payment_method_type); + match payment_method_type { + // Card + PaymentMethodType::Debit => { +@@ -409,67 +478,6 @@ fn get_billing_details(connector: PayoutConnectors) -> HashMap HashMap::from([ +- ( +- "billing.address.line1".to_string(), +- RequiredFieldInfo { +- required_field: "billing.address.line1".to_string(), +- display_name: "billing_address_line1".to_string(), +- field_type: FieldType::Text, +- value: None, +- }, +- ), +- ( +- "billing.address.line2".to_string(), +- RequiredFieldInfo { +- required_field: "billing.address.line2".to_string(), +- display_name: "billing_address_line2".to_string(), +- field_type: FieldType::Text, +- value: None, +- }, +- ), +- ( +- "billing.address.city".to_string(), +- RequiredFieldInfo { +- required_field: "billing.address.city".to_string(), +- display_name: "billing_address_city".to_string(), +- field_type: FieldType::Text, +- value: None, +- }, +- ), +- ( +- "billing.address.country".to_string(), +- RequiredFieldInfo { +- required_field: "billing.address.country".to_string(), +- display_name: "billing_address_country".to_string(), +- field_type: FieldType::UserAddressCountry { +- options: get_countries_for_connector(connector) +- .iter() +- .map(|country| country.to_string()) +- .collect::>(), +- }, +- value: None, +- }, +- ), +- ( +- "billing.address.first_name".to_string(), +- RequiredFieldInfo { +- required_field: "billing.address.first_name".to_string(), +- display_name: "billing_address_first_name".to_string(), +- field_type: FieldType::Text, +- value: None, +- }, +- ), +- ( +- "billing.address.last_name".to_string(), +- RequiredFieldInfo { +- required_field: "billing.address.last_name".to_string(), +- display_name: "billing_address_last_name".to_string(), +- field_type: FieldType::Text, +- value: None, +- }, +- ), +- ]), + PayoutConnectors::Wise => HashMap::from([ + ( + "billing.address.line1".to_string(), +@@ -531,75 +539,6 @@ fn get_billing_details(connector: PayoutConnectors) -> HashMap HashMap::from([ +- ( +- "billing.address.line1".to_string(), +- RequiredFieldInfo { +- required_field: "billing.address.line1".to_string(), +- display_name: "billing_address_line1".to_string(), +- field_type: FieldType::Text, +- value: None, +- }, +- ), +- ( +- "billing.address.line2".to_string(), +- RequiredFieldInfo { +- required_field: "billing.address.line2".to_string(), +- display_name: "billing_address_line2".to_string(), +- field_type: FieldType::Text, +- value: None, +- }, +- ), +- ( +- "billing.address.city".to_string(), +- RequiredFieldInfo { +- required_field: "billing.address.city".to_string(), +- display_name: "billing_address_city".to_string(), +- field_type: FieldType::Text, +- value: None, +- }, +- ), +- ( +- "billing.address.zip".to_string(), +- RequiredFieldInfo { +- required_field: "billing.address.zip".to_string(), +- display_name: "billing_address_zip".to_string(), +- field_type: FieldType::Text, +- value: None, +- }, +- ), +- ( +- "billing.address.country".to_string(), +- RequiredFieldInfo { +- required_field: "billing.address.country".to_string(), +- display_name: "billing_address_country".to_string(), +- field_type: FieldType::UserAddressCountry { +- options: get_countries_for_connector(connector) +- .iter() +- .map(|country| country.to_string()) +- .collect::>(), +- }, +- value: None, +- }, +- ), +- ( +- "billing.address.first_name".to_string(), +- RequiredFieldInfo { +- required_field: "billing.address.first_name".to_string(), +- display_name: "billing_address_first_name".to_string(), +- field_type: FieldType::Text, +- value: None, +- }, +- ), +- ( +- "billing.address.last_name".to_string(), +- RequiredFieldInfo { +- required_field: "billing.address.last_name".to_string(), +- display_name: "billing_address_last_name".to_string(), +- field_type: FieldType::Text, +- value: None, +- }, +- ), +- ]), ++ _ => HashMap::from([]), + } + } + +----- END CHUNK ----- \ No newline at end of file diff --git a/raw/73/73dfa5e4fa3da2772648678e5ce0dbee4d1a63b5.txt b/raw/73/73dfa5e4fa3da2772648678e5ce0dbee4d1a63b5.txt new file mode 100644 index 0000000000000000000000000000000000000000..3789853e6c506b71b1c59283075df7f426b20473 --- /dev/null +++ b/raw/73/73dfa5e4fa3da2772648678e5ce0dbee4d1a63b5.txt @@ -0,0 +1,1547 @@ +ROUTE: juspay/hyperswitch@73dfa5e4fa3da2772648678e5ce0dbee4d1a63b5 +REPO: https://github.com/juspay/hyperswitch +COMMIT: 73dfa5e4fa3da2772648678e5ce0dbee4d1a63b5 +AUTHOR: Sakil Mostak <73734619+Sakilmostak@users.noreply.github.com> +DATE: 2025-08-20T11:17:26 + +=== ISSUE_AND_PR === +[PR #8964] feat(payment-methods): [Proxy] add saved card flow for proxy payments +URL: https://github.com/juspay/hyperswitch/pull/8964 +BODY: +## Type of Change + + +- [ ] Bugfix +- [x] New feature +- [ ] Enhancement +- [ ] Refactoring +- [ ] Dependency updates +- [ ] Documentation +- [ ] CI/CD + +## Description + +Add saved card flow for proxy payments: +- Card metadata is collected in the request along with tokens (bin_number and last_four digits for Card Number) +- Card Bin API is used to fetch data against card like card_network and issuer using bin number +- Card metadata is stored in payment method table along with tokens +- This component works along with Proxy Payments (needs confirm-intent/external-vault-proxy) +- Internally no locker is used since we don't store raw card data +- Data for subsequent payments (tokens) are fetched from payment method table +- Only cvc and card_holder_name is collected in subsequent payment with saved card + +### Additional Changes + +- [x] This PR modifies the API contract +First payment to save card in `confirm-intent/external-vault-proxy`: +``` +"payment_method_data": { + "vault_data_card": { + "card_number": "tok_sandbox_ZgPN54WU8y8tDjc6qfEs", + "card_exp_month": "04", + "card_exp_year": "29", + "card_cvc": "tok_sandbox_3EniLX4zKbwxV1PPZFopd", + "bin_number": "424242", + "last_four": "4242", + "card_holder_name": "john doe" + } + }, +``` +Subsequent payment with saved card in `confirm-intent/external-vault-proxy`: +``` +"payment_method_data": { + "vault_token": { + "card_cvc": "737" + } + }, +``` +- [x] This PR modifies the database schema +- [ ] This PR modifies application configuration/environment variables + + + + +## Motivation and Context + + + +## How did you test it? + +This PR is dependent in proxy module. Need the whole module to be present for testing. + +## Checklist + + +- [x] I formatted the code `cargo +nightly fmt --all` +- [x] I addressed lints thrown by `cargo clippy` +- [x] I reviewed the submitted code +- [ ] I added unit tests for my changes where possible +COMMENTS: +- semanticdiff-com[bot]: Review changes with  SemanticDiff +
+Changed Files +
+ +| File | Status | +| :--- | :--- | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#crates/router/src/core/payments/operations/payment_confirm_intent.rs)  [crates/router/src/core/payments/operations/payment\_confirm\_intent\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#crates/router/src/core/payments/operations/payment_confirm_intent.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#crates/router/src/core/payments/operations/payment_confirm_intent.rs)  100% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#crates/router/src/core/payment_methods/vault.rs)  [crates/router/src/core/payment\_methods/vault\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#crates/router/src/core/payment_methods/vault.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#crates/router/src/core/payment_methods/vault.rs)  92% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#crates/router/src/types/api/payment_methods.rs)  [crates/router/src/types/api/payment\_methods\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#crates/router/src/types/api/payment_methods.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#crates/router/src/types/api/payment_methods.rs)  86% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#crates/hyperswitch_domain_models/src/vault.rs)  [crates/hyperswitch\_domain\_models/src/vault\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#crates/hyperswitch_domain_models/src/vault.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#crates/hyperswitch_domain_models/src/vault.rs)  32% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#crates/api_models/src/payments.rs)  [crates/api\_models/src/payments\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#crates/api_models/src/payments.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#crates/api_models/src/payments.rs)  11% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#crates/openapi/src/openapi_v2.rs)  [crates/openapi/src/openapi\_v2\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#crates/openapi/src/openapi_v2.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#crates/openapi/src/openapi_v2.rs)  9% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#crates/router/src/core/payments/operations/external_vault_proxy_payment_intent.rs)  [crates/router/src/core/payments/operations/external\_vault\_proxy\_payment\_intent\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#crates/router/src/core/payments/operations/external_vault_proxy_payment_intent.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#crates/router/src/core/payments/operations/external_vault_proxy_payment_intent.rs)  6% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#crates/hyperswitch_domain_models/src/payment_method_data.rs)  [crates/hyperswitch\_domain\_models/src/payment\_method\_data\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#crates/hyperswitch_domain_models/src/payment_method_data.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#crates/hyperswitch_domain_models/src/payment_method_data.rs)  6% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#crates/router/src/core/payment_methods.rs)  [crates/router/src/core/payment\_methods\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#crates/router/src/core/payment_methods.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#crates/router/src/core/payment_methods.rs)  1% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#api-reference/v2/openapi_spec_v2.json)  [api\-reference/v2/openapi\_spec\_v2\.json](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#api-reference/v2/openapi_spec_v2.json) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#api-reference/v2/openapi_spec_v2.json)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#crates/api_models/src/payment_methods.rs)  [crates/api\_models/src/payment\_methods\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#crates/api_models/src/payment_methods.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#crates/api_models/src/payment_methods.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#crates/common_enums/src/enums.rs)  [crates/common\_enums/src/enums\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#crates/common_enums/src/enums.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#crates/common_enums/src/enums.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#crates/diesel_models/src/payment_method.rs)  [crates/diesel\_models/src/payment\_method\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#crates/diesel_models/src/payment_method.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#crates/diesel_models/src/payment_method.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#crates/diesel_models/src/schema_v2.rs)  [crates/diesel\_models/src/schema\_v2\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#crates/diesel_models/src/schema_v2.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#crates/diesel_models/src/schema_v2.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#crates/hyperswitch_domain_models/src/payment_methods.rs)  [crates/hyperswitch\_domain\_models/src/payment\_methods\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#crates/hyperswitch_domain_models/src/payment_methods.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#crates/hyperswitch_domain_models/src/payment_methods.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#crates/hyperswitch_domain_models/src/payments/payment_attempt.rs)  [crates/hyperswitch\_domain\_models/src/payments/payment\_attempt\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#crates/hyperswitch_domain_models/src/payments/payment_attempt.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#crates/hyperswitch_domain_models/src/payments/payment_attempt.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#crates/router/src/core/payments.rs)  [crates/router/src/core/payments\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#crates/router/src/core/payments.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#crates/router/src/core/payments.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#crates/router/src/core/payments/operations.rs)  [crates/router/src/core/payments/operations\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#crates/router/src/core/payments/operations.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#crates/router/src/core/payments/operations.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#crates/router/src/core/unified_connector_service.rs)  [crates/router/src/core/unified\_connector\_service\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#crates/router/src/core/unified_connector_service.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#crates/router/src/core/unified_connector_service.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#v2_compatible_migrations/2025-07-29-080133_add-external_vault_token_data-column-to-payment-methods/down.sql)  [v2\_compatible\_migrations/2025\-07\-29\-080133\_add\-external\_vault\_token\_data\-column\-to\-payment\-methods/down\.sql](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#v2_compatible_migrations/2025-07-29-080133_add-external_vault_token_data-column-to-payment-methods/down.sql) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#v2_compatible_migrations/2025-07-29-080133_add-external_vault_token_data-column-to-payment-methods/up.sql)  [v2\_compatible\_migrations/2025\-07\-29\-080133\_add\-external\_vault\_token\_data\-column\-to\-payment\-methods/up\.sql](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8964/changes#v2_compatible_migrations/2025-07-29-080133_add-external_vault_token_data-column-to-payment-methods/up.sql) | Unsupported file format | + +
+- prasunna09 [crates/hyperswitch_domain_models/src/payment_method_data.rs:162]: we have CardTokenData which has cvc and card_holder_name? can we reuse that? +- prasunna09 [crates/hyperswitch_domain_models/src/payment_method_data.rs:162]: and this can be secret +- prasunna09 [crates/router/src/core/payment_methods.rs:1910]: this external_vault_source should be updated as well right? +- prasunna09 [crates/router/src/core/payments/operations/external_vault_proxy_payment_intent.rs:461]: we are already updating attempt before we call UCS, this is redundant. +update the payment_data.payment_method with pm id, and in update trackers, it will get updated. + +refer to update_trackers for PaymentIntentConfirm +- prasunna09 [crates/router/src/core/payments/operations/external_vault_proxy_payment_intent.rs:701]: instead of cloning entire payment attempt, can we just move the fn`update_payment_method_status_internal` above this db call?? +- jarnura [crates/router/src/core/payments/operations/external_vault_proxy_payment_intent.rs:486]: ```suggestion + Err(report!(errors::ApiErrorResponse::MissingRequiredField { + field_name: "vault_token in payment_method_data" + }) + .attach_printable("Invalid external vault payment method data"))?; +``` +- prasunna09 [crates/router/src/core/payments/operations/external_vault_proxy_payment_intent.rs:362]: do not generate pm id in payments service. this should be handled by pm service only + +- prasunna09 [crates/api_models/src/payment_methods.rs:624]: we ll have to ensure actual card raw num is not stored in pm entry. +may be we can do a luhn check before storing in pm table? +- prasunna09 [crates/router/src/core/payments/operations/payment_response.rs:2746]: We ll have to introduce a new endpoint to activate the pm for internal use, instead payments directly calling update fn +- Sakilmostak [crates/api_models/src/payment_methods.rs:624]: Im taking it in a separate pr +- Sakilmostak [crates/router/src/core/payments/operations/payment_response.rs:2746]: Created a issue that could be picked up https://github.com/juspay/hyperswitch-cloud/issues/10702 +- jarnura [v2_compatible_migrations/2025-07-29-080133_add-external_vault_token_data-column-to-payment-methods/up.sql:1]: Remove default NULL +- jarnura [crates/router/src/core/payments/operations/payment_response.rs:2741]: move to domain and call the domain function in core flow instead adding this in trackers +- jarnura [crates/router/src/core/payments/operations/payment_response.rs:2532]: move to domain and call the domain function in core flow instead adding this in trackers +- prasunna09 [crates/common_enums/src/enums.rs:199]: we should update payment method to active if Authentication is successful and other successful status. Even in psync flow, the update payment method should happen +We can pick this up in a seperate pr. + +=== COMMIT === +SUBJECT: feat(payment-methods): [Proxy] add saved card flow for proxy payments (#8964) +BODY: +Co-authored-by: Prasunna Soppa +Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> +Co-authored-by: Prasunna Soppa <70575890+prasunna09@users.noreply.github.com> + +=== FILES === +Summary: 21 files changed, +861 -29 +- api-reference/v2/openapi_spec_v2.json (+87 -0) +- crates/api_models/src/payment_methods.rs (+58 -0) +- crates/api_models/src/payments.rs (+21 -1) +- crates/common_enums/src/enums.rs (+4 -0) +- crates/diesel_models/src/payment_method.rs (+4 -0) +- crates/diesel_models/src/schema_v2.rs (+1 -0) +- crates/hyperswitch_domain_models/src/payment_method_data.rs (+57 -2) +- crates/hyperswitch_domain_models/src/payment_methods.rs (+18 -0) +- crates/hyperswitch_domain_models/src/payments/payment_attempt.rs (+1 -1) +- crates/hyperswitch_domain_models/src/vault.rs (+15 -3) +- crates/openapi/src/openapi_v2.rs (+1 -0) +- crates/router/src/core/payment_methods.rs (+451 -8) +- crates/router/src/core/payment_methods/vault.rs (+1 -1) +- crates/router/src/core/payments.rs (+14 -0) +- crates/router/src/core/payments/operations.rs (+11 -0) +- crates/router/src/core/payments/operations/external_vault_proxy_payment_intent.rs (+96 -2) +- crates/router/src/core/payments/operations/payment_confirm_intent.rs (+9 -8) +- crates/router/src/core/unified_connector_service.rs (+6 -0) +- crates/router/src/types/api/payment_methods.rs (+3 -3) +- v2_compatible_migrations/2025-07-29-080133_add-external_vault_token_data-column-to-payment-methods/down.sql (+2 -0) +- v2_compatible_migrations/2025-07-29-080133_add-external_vault_token_data-column-to-payment-methods/up.sql (+1 -0) + +=== PATCH === +diff --git a/api-reference/v2/openapi_spec_v2.json b/api-reference/v2/openapi_spec_v2.json +index b34623cd..00d83f79 100644 +--- a/api-reference/v2/openapi_spec_v2.json ++++ b/api-reference/v2/openapi_spec_v2.json +@@ -17165,6 +17165,17 @@ + "$ref": "#/components/schemas/CardDetail" + } + } ++ }, ++ { ++ "type": "object", ++ "required": [ ++ "proxy_card" ++ ], ++ "properties": { ++ "proxy_card": { ++ "$ref": "#/components/schemas/ProxyCardDetails" ++ } ++ } + } + ] + }, +@@ -22168,6 +22179,82 @@ + } + } + }, ++ "ProxyCardDetails": { ++ "type": "object", ++ "required": [ ++ "card_number", ++ "card_exp_month", ++ "card_exp_year", ++ "card_holder_name", ++ "card_cvc" ++ ], ++ "properties": { ++ "card_number": { ++ "type": "string", ++ "description": "Tokenized Card Number", ++ "example": "tok_sjfowhoejsldj" ++ }, ++ "card_exp_month": { ++ "type": "string", ++ "description": "Card Expiry Month", ++ "example": "10" ++ }, ++ "card_exp_year": { ++ "type": "string", ++ "description": "Card Expiry Year", ++ "example": "25" ++ }, ++ "bin_number": { ++ "type": "string", ++ "description": "First Six Digit of Card Number", ++ "nullable": true ++ }, ++ "last_four": { ++ "type": "string", ++ "description": "Last Four Digit of Card Number", ++ "nullable": true ++ }, ++ "card_issuer": { ++ "type": "string", ++ "description": "Issuer Bank for Card", ++ "nullable": true ++ }, ++ "card_network": { ++ "allOf": [ ++ { ++ "$ref": "#/components/schemas/CardNetwork" ++ } ++ ], ++ "nullable": true ++ }, ++ "card_type": { ++ "type": "string", ++ "description": "Card Type", ++ "nullable": true ++ }, ++ "card_issuing_country": { ++ "type": "string", ++ "description": "Issuing Country of the Card", ++ "nullable": true ++ }, ++ "nick_name": { ++ "type": "string", ++ "description": "Card Holder's Nick Name", ++ "example": "John Doe", ++ "nullable": true ++ }, ++ "card_holder_name": { ++ "type": "string", ++ "description": "Card Holder Name", ++ "example": "John Doe" ++ }, ++ "card_cvc": { ++ "type": "string", ++ "description": "The CVC number for the card\nThis is optional in case the card needs to be vaulted", ++ "example": "242" ++ } ++ } ++ }, + "ProxyRequest": { + "type": "object", + "required": [ +diff --git a/crates/api_models/src/payment_methods.rs b/crates/api_models/src/payment_methods.rs +index 2e9478dc..135e0ddc 100644 +--- a/crates/api_models/src/payment_methods.rs ++++ b/crates/api_models/src/payment_methods.rs +@@ -497,6 +497,7 @@ pub enum PaymentMethodUpdateData { + #[serde(rename = "payment_method_data")] + pub enum PaymentMethodCreateData { + Card(CardDetail), ++ ProxyCard(ProxyCardDetails), + } + + #[cfg(feature = "v1")] +@@ -612,6 +613,57 @@ pub struct CardDetail { + pub card_cvc: Option>, + } + ++// This struct is for collecting Proxy Card Data ++// All card related data present in this struct are tokenzied ++// No strict type is present to accept tokenized data ++#[cfg(feature = "v2")] ++#[derive(Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)] ++pub struct ProxyCardDetails { ++ /// Tokenized Card Number ++ #[schema(value_type = String,example = "tok_sjfowhoejsldj")] ++ pub card_number: masking::Secret, ++ ++ /// Card Expiry Month ++ #[schema(value_type = String,example = "10")] ++ pub card_exp_month: masking::Secret, ++ ++ /// Card Expiry Year ++ #[schema(value_type = String,example = "25")] ++ pub card_exp_year: masking::Secret, ++ ++ /// First Six Digit of Card Number ++ pub bin_number: Option, ++ ++ ///Last Four Digit of Card Number ++ pub last_four: Option, ++ ++ /// Issuer Bank for Card ++ pub card_issuer: Option, ++ ++ /// Card's Network ++ #[schema(value_type = Option)] ++ pub card_network: Option, ++ ++ /// Card Type ++ pub card_type: Option, ++ ++ /// Issuing Country of the Card ++ pub card_issuing_country: Option, ++ ++ /// Card Holder's Nick Name ++ #[schema(value_type = Option,example = "John Doe")] ++ pub nick_name: Option>, ++ ++ /// Card Holder Name ++ #[schema(value_type = String,example = "John Doe")] ++ pub card_holder_name: Option>, ++ ++ /// The CVC number for the card ++ /// This is optional in case the card needs to be vaulted ++ #[schema(value_type = String, example = "242")] ++ pub card_cvc: Option>, ++} ++ + #[derive(Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)] + #[serde(deny_unknown_fields)] + pub struct MigrateCardDetail { +@@ -943,6 +995,12 @@ pub enum PaymentMethodsData { + WalletDetails(PaymentMethodDataWalletInfo), + } + ++#[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)] ++pub struct ExternalVaultTokenData { ++ /// Tokenized reference for Card Number ++ pub tokenized_card_number: masking::Secret, ++} ++ + #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)] + pub struct CardDetailsPaymentMethod { + pub last4_digits: Option, +diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs +index 723fbae3..e50c3782 100644 +--- a/crates/api_models/src/payments.rs ++++ b/crates/api_models/src/payments.rs +@@ -2611,7 +2611,8 @@ pub struct ProxyPaymentMethodDataRequest { + #[serde(rename_all = "snake_case")] + pub enum ProxyPaymentMethodData { + #[schema(title = "ProxyCardData")] +- VaultDataCard(ProxyCardData), ++ VaultDataCard(Box), ++ VaultToken(VaultToken), + } + + #[derive(Default, Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)] +@@ -2655,6 +2656,25 @@ pub struct ProxyCardData { + /// The card holder's nick name + #[schema(value_type = Option, example = "John Test")] + pub nick_name: Option>, ++ ++ /// The first six digit of the card number ++ #[schema(value_type = String, example = "424242")] ++ pub bin_number: Option, ++ ++ /// The last four digit of the card number ++ #[schema(value_type = String, example = "4242")] ++ pub last_four: Option, ++} ++ ++#[derive(Default, Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)] ++pub struct VaultToken { ++ /// The tokenized CVC number for the card ++ #[schema(value_type = String, example = "242")] ++ pub card_cvc: Secret, ++ ++ /// The card holder's name ++ #[schema(value_type = String, example = "John Test")] ++ pub card_holder_name: Option>, + } + + #[derive(Debug, Clone, serde::Deserialize, serde::Serialize, ToSchema, Eq, PartialEq)] +diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs +index 998c60b5..8fbc29c6 100644 +--- a/crates/common_enums/src/enums.rs ++++ b/crates/common_enums/src/enums.rs +@@ -194,6 +194,10 @@ impl AttemptStatus { + | Self::IntegrityFailure => false, + } + } ++ ++ pub fn is_success(self) -> bool { ++ matches!(self, Self::Charged | Self::PartialCharged) ++ } + } + + #[derive( +diff --git a/crates/diesel_models/src/payment_method.rs b/crates/diesel_models/src/payment_method.rs +index 472a5670..79d6865b 100644 +--- a/crates/diesel_models/src/payment_method.rs ++++ b/crates/diesel_models/src/payment_method.rs +@@ -89,6 +89,7 @@ pub struct PaymentMethod { + pub payment_method_subtype: Option, + pub id: common_utils::id_type::GlobalPaymentMethodId, + pub external_vault_source: Option, ++ pub external_vault_token_data: Option, + } + + impl PaymentMethod { +@@ -167,6 +168,7 @@ pub struct PaymentMethodNew { + pub network_token_requestor_reference_id: Option, + pub network_token_locker_id: Option, + pub network_token_payment_method_data: Option, ++ pub external_vault_token_data: Option, + pub locker_fingerprint_id: Option, + pub payment_method_type_v2: Option, + pub payment_method_subtype: Option, +@@ -364,6 +366,7 @@ impl PaymentMethodUpdateInternal { + network_token_payment_method_data: network_token_payment_method_data + .or(source.network_token_payment_method_data), + external_vault_source: external_vault_source.or(source.external_vault_source), ++ external_vault_token_data: source.external_vault_token_data, + } + } + } +@@ -905,6 +908,7 @@ impl From<&PaymentMethodNew> for PaymentMethod { + .network_token_payment_method_data + .clone(), + external_vault_source: None, ++ external_vault_token_data: payment_method_new.external_vault_token_data.clone(), + } + } + } +diff --git a/crates/diesel_models/src/schema_v2.rs b/crates/diesel_models/src/schema_v2.rs +index 192d6e72..1837903f 100644 +--- a/crates/diesel_models/src/schema_v2.rs ++++ b/crates/diesel_models/src/schema_v2.rs +@@ -1112,6 +1112,7 @@ diesel::table! { + id -> Varchar, + #[max_length = 64] + external_vault_source -> Nullable, ++ external_vault_token_data -> Nullable, + } + } + +diff --git a/crates/hyperswitch_domain_models/src/payment_method_data.rs b/crates/hyperswitch_domain_models/src/payment_method_data.rs +index de07d67f..139889da 100644 +--- a/crates/hyperswitch_domain_models/src/payment_method_data.rs ++++ b/crates/hyperswitch_domain_models/src/payment_method_data.rs +@@ -48,7 +48,8 @@ pub enum PaymentMethodData { + + #[derive(PartialEq, Clone, Debug, Serialize, Deserialize)] + pub enum ExternalVaultPaymentMethodData { +- Card(ExternalVaultCard), ++ Card(Box), ++ VaultToken(VaultToken), + } + + #[derive(Debug, Clone, PartialEq, Eq)] +@@ -144,6 +145,8 @@ pub struct ExternalVaultCard { + pub card_exp_month: Secret, + pub card_exp_year: Secret, + pub card_cvc: Secret, ++ pub bin_number: Option, ++ pub last_four: Option, + pub card_issuer: Option, + pub card_network: Option, + pub card_type: Option, +@@ -154,6 +157,12 @@ pub struct ExternalVaultCard { + pub co_badged_card_data: Option, + } + ++#[derive(PartialEq, Clone, Debug, Serialize, Deserialize, Default)] ++pub struct VaultToken { ++ pub card_cvc: Secret, ++ pub card_holder_name: Option>, ++} ++ + #[derive(Eq, PartialEq, Clone, Debug, Serialize, Deserialize, Default)] + pub struct CardDetailsForNetworkTransactionId { + pub card_number: cards::CardNumber, +@@ -849,6 +858,12 @@ impl TryFrom for PaymentMethodData { + card_holder_name, + co_badged_card_data: None, + })), ++ payment_methods::PaymentMethodCreateData::ProxyCard(_) => Err( ++ common_utils::errors::ValidationError::IncorrectValueProvided { ++ field_name: "Payment method data", ++ } ++ .into(), ++ ), + } + } + } +@@ -911,7 +926,10 @@ impl From for ExternalVaultPayment + fn from(api_model_payment_method_data: api_models::payments::ProxyPaymentMethodData) -> Self { + match api_model_payment_method_data { + api_models::payments::ProxyPaymentMethodData::VaultDataCard(card_data) => { +- Self::Card(ExternalVaultCard::from(card_data)) ++ Self::Card(Box::new(ExternalVaultCard::from(*card_data))) ++ } ++ api_models::payments::ProxyPaymentMethodData::VaultToken(vault_data) => { ++ Self::VaultToken(VaultToken::from(vault_data)) + } + } + } +@@ -924,6 +942,8 @@ impl From for ExternalVaultCard { + card_exp_year, + card_holder_name, + card_cvc, ++ bin_number, ++ last_four, + card_issuer, + card_network, + card_type, +@@ -937,6 +957,8 @@ impl From for ExternalVaultCard { + card_exp_month, + card_exp_year, + card_cvc, ++ bin_number, ++ last_four, + card_issuer, + card_network, + card_type, +@@ -948,6 +970,19 @@ impl From for ExternalVaultCard { + } + } + } ++impl From for VaultToken { ++ fn from(value: api_models::payments::VaultToken) -> Self { ++ let api_models::payments::VaultToken { ++ card_cvc, ++ card_holder_name, ++ } = value; ++ ++ Self { ++ card_cvc, ++ card_holder_name, ++ } ++ } ++} + impl + From<( + api_models::payments::Card, +@@ -1041,6 +1076,26 @@ impl From for payment_methods::CardDetail { + } + } + ++#[cfg(feature = "v2")] ++impl From for payment_methods::ProxyCardDetails { ++ fn from(card: ExternalVaultCard) -> Self { ++ Self { ++ card_number: card.card_number, ++ card_exp_month: card.card_exp_month, ++ card_exp_year: card.card_exp_year, ++ card_holder_name: card.card_holder_name, ++ nick_name: card.nick_name, ++ card_issuing_country: card.card_issuing_country, ++ card_network: card.card_network, ++ card_issuer: card.card_issuer, ++ card_type: card.card_type, ++ card_cvc: Some(card.card_cvc), ++ bin_number: card.bin_number, ++ last_four: card.last_four, ++ } ++ } ++} ++ + impl From for CardRedirectData { + fn from(value: api_models::payments::CardRedirectData) -> Self { + match value { +diff --git a/crates/hyperswitch_domain_models/src/payment_methods.rs b/crates/hyperswitch_domain_models/src/payment_methods.rs +index ff4d8bc0..0fa3d5b4 100644 +--- a/crates/hyperswitch_domain_models/src/payment_methods.rs ++++ b/crates/hyperswitch_domain_models/src/payment_methods.rs +@@ -125,6 +125,9 @@ pub struct PaymentMethod { + #[encrypt(ty = Value)] + pub network_token_payment_method_data: + Option>, ++ #[encrypt(ty = Value)] ++ pub external_vault_token_data: ++ Option>, + } + + impl PaymentMethod { +@@ -468,6 +471,7 @@ impl super::behaviour::Conversion for PaymentMethod { + .network_token_payment_method_data + .map(|val| val.into()), + external_vault_source: self.external_vault_source, ++ external_vault_token_data: self.external_vault_token_data.map(|val| val.into()), + }) + } + +@@ -493,6 +497,7 @@ impl super::behaviour::Conversion for PaymentMethod { + .payment_method_billing_address, + network_token_payment_method_data: storage_model + .network_token_payment_method_data, ++ external_vault_token_data: storage_model.external_vault_token_data, + }, + )), + key_manager_identifier, +@@ -535,6 +540,17 @@ impl super::behaviour::Conversion for PaymentMethod { + .change_context(common_utils::errors::CryptoError::DecodingFailed) + .attach_printable("Error while deserializing Network token Payment Method Data")?; + ++ let external_vault_token_data = data ++ .external_vault_token_data ++ .map(|external_vault_token_data| { ++ external_vault_token_data.deserialize_inner_value(|value| { ++ value.parse_value("External Vault Token Data") ++ }) ++ }) ++ .transpose() ++ .change_context(common_utils::errors::CryptoError::DecodingFailed) ++ .attach_printable("Error while deserializing External Vault Token Data")?; ++ + Ok::>(Self { + customer_id: storage_model.customer_id, + merchant_id: storage_model.merchant_id, +@@ -560,6 +576,7 @@ impl super::behaviour::Conversion for PaymentMethod { + network_token_locker_id: storage_model.network_token_locker_id, + network_token_payment_method_data, + external_vault_source: storage_model.external_vault_source, ++ external_vault_token_data, + }) + } + .await +@@ -596,6 +613,7 @@ impl super::behaviour::Conversion for PaymentMethod { + network_token_payment_method_data: self + .network_token_payment_method_data + .map(|val| val.into()), ++ external_vault_token_data: self.external_vault_token_data.map(|val| val.into()), + }) + } + } +diff --git a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs +index a1ff44f5..c29c4d60 100644 +--- a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs ++++ b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs +@@ -767,7 +767,7 @@ impl PaymentAttempt { + last_synced: None, + cancellation_reason: None, + browser_info: request.browser_info.clone(), +- payment_token: None, ++ payment_token: request.payment_token.clone(), + connector_metadata: None, + payment_experience: None, + payment_method_data: None, +diff --git a/crates/hyperswitch_domain_models/src/vault.rs b/crates/hyperswitch_domain_models/src/vault.rs +index b68e1d15..9ba63f50 100644 +--- a/crates/hyperswitch_domain_models/src/vault.rs ++++ b/crates/hyperswitch_domain_models/src/vault.rs +@@ -1,6 +1,10 @@ + use api_models::payment_methods; ++#[cfg(feature = "v2")] ++use error_stack; + use serde::{Deserialize, Serialize}; + ++#[cfg(feature = "v2")] ++use crate::errors; + use crate::payment_method_data; + + #[derive(Debug, Deserialize, Serialize, Clone)] +@@ -49,10 +53,18 @@ impl VaultingDataInterface for PaymentMethodVaultingData { + } + } + +-impl From for PaymentMethodVaultingData { +- fn from(item: payment_methods::PaymentMethodCreateData) -> Self { ++#[cfg(feature = "v2")] ++impl TryFrom for PaymentMethodVaultingData { ++ type Error = error_stack::Report; ++ fn try_from(item: payment_methods::PaymentMethodCreateData) -> Result { + match item { +- payment_methods::PaymentMethodCreateData::Card(card) => Self::Card(card), ++ payment_methods::PaymentMethodCreateData::Card(card) => Ok(Self::Card(card)), ++ payment_methods::PaymentMethodCreateData::ProxyCard(card) => Err( ++ errors::api_error_response::ApiErrorResponse::UnprocessableEntity { ++ message: "Proxy Card for PaymentMethodCreateData".to_string(), ++ } ++ .into(), ++ ), + } + } + } +diff --git a/crates/openapi/src/openapi_v2.rs b/crates/openapi/src/openapi_v2.rs +index 69de6450..553c7f17 100644 +--- a/crates/openapi/src/openapi_v2.rs ++++ b/crates/openapi/src/openapi_v2.rs +@@ -263,6 +263,7 @@ Never share your secret api keys. Keep them guarded and secure. + api_models::payment_methods::PaymentMethodUpdateData, + api_models::payment_methods::CardDetailFromLocker, + api_models::payment_methods::PaymentMethodCreateData, ++ api_models::payment_methods::ProxyCardDetails, + api_models::payment_methods::CardDetail, + api_models::payment_methods::CardDetailUpdate, + api_models::payment_methods::CardType, +diff --git a/crates/router/src/core/payment_methods.rs b/crates/router/src/core/payment_methods.rs +index c8320bcc..1ea747d8 100644 +--- a/crates/router/src/core/payment_methods.rs ++++ b/crates/router/src/core/payment_methods.rs +@@ -885,8 +885,14 @@ pub async fn create_payment_method( + profile: &domain::Profile, + ) -> RouterResponse { + // payment_method is for internal use, can never be populated in response +- let (response, _payment_method) = +- create_payment_method_core(state, request_state, req, merchant_context, profile).await?; ++ let (response, _payment_method) = Box::pin(create_payment_method_core( ++ state, ++ request_state, ++ req, ++ merchant_context, ++ profile, ++ )) ++ .await?; + + Ok(services::ApplicationResponse::Json(response)) + } +@@ -945,10 +951,57 @@ pub async fn create_payment_method_core( + .change_context(errors::ApiErrorResponse::InternalServerError) + .attach_printable("Unable to generate GlobalPaymentMethodId")?; + ++ match &req.payment_method_data { ++ api::PaymentMethodCreateData::Card(_) => { ++ create_payment_method_card_core( ++ state, ++ req, ++ merchant_context, ++ profile, ++ merchant_id, ++ &customer_id, ++ payment_method_id, ++ payment_method_billing_address, ++ ) ++ .await ++ } ++ api::PaymentMethodCreateData::ProxyCard(_) => { ++ create_payment_method_proxy_card_core( ++ state, ++ req, ++ merchant_context, ++ profile, ++ merchant_id, ++ &customer_id, ++ payment_method_id, ++ payment_method_billing_address, ++ ) ++ .await ++ } ++ } ++} ++ ++#[cfg(feature = "v2")] ++#[allow(clippy::too_many_arguments)] ++#[instrument(skip_all)] ++pub async fn create_payment_method_card_core( ++ state: &SessionState, ++ req: api::PaymentMethodCreate, ++ merchant_context: &domain::MerchantContext, ++ profile: &domain::Profile, ++ merchant_id: &id_type::MerchantId, ++ customer_id: &id_type::GlobalCustomerId, ++ payment_method_id: id_type::GlobalPaymentMethodId, ++ payment_method_billing_address: Option< ++ Encryptable, ++ >, ++) -> RouterResult<(api::PaymentMethodResponse, domain::PaymentMethod)> { ++ let db = &*state.store; ++ + let payment_method = create_payment_method_for_intent( + state, + req.metadata.clone(), +- &customer_id, ++ customer_id, + payment_method_id, + merchant_id, + merchant_context.get_merchant_key_store(), +@@ -958,7 +1011,7 @@ pub async fn create_payment_method_core( + .await + .attach_printable("failed to add payment method to db")?; + +- let payment_method_data = domain::PaymentMethodVaultingData::from(req.payment_method_data) ++ let payment_method_data = domain::PaymentMethodVaultingData::try_from(req.payment_method_data)? + .populate_bin_details_for_payment_method(state) + .await; + +@@ -968,7 +1021,7 @@ pub async fn create_payment_method_core( + merchant_context, + profile, + None, +- &customer_id, ++ customer_id, + ) + .await; + +@@ -978,7 +1031,7 @@ pub async fn create_payment_method_core( + merchant_context, + req.network_tokenization.clone(), + profile.is_network_tokenization_enabled, +- &customer_id, ++ customer_id, + ) + .await; + +@@ -1043,6 +1096,99 @@ pub async fn create_payment_method_core( + Ok((response, payment_method)) + } + ++// network tokenization and vaulting to locker is not required for proxy card since the card is already tokenized ++#[cfg(feature = "v2")] ++#[allow(clippy::too_many_arguments)] ++#[instrument(skip_all)] ++pub async fn create_payment_method_proxy_card_core( ++ state: &SessionState, ++ req: api::PaymentMethodCreate, ++ merchant_context: &domain::MerchantContext, ++ profile: &domain::Profile, ++ merchant_id: &id_type::MerchantId, ++ customer_id: &id_type::GlobalCustomerId, ++ payment_method_id: id_type::GlobalPaymentMethodId, ++ payment_method_billing_address: Option< ++ Encryptable, ++ >, ++) -> RouterResult<(api::PaymentMethodResponse, domain::PaymentMethod)> { ++ let key_manager_state = &(state).into(); ++ ++ let external_vault_source = profile ++ .external_vault_connector_details ++ .clone() ++ .map(|details| details.vault_connector_id); ++ ++ let additional_payment_method_data = Some( ++ req.payment_method_data ++ .populate_bin_details_for_payment_method(state) ++ .await ++ .convert_to_additional_payment_method_data()?, ++ ); ++ ++ let encrypted_payment_method_data = additional_payment_method_data ++ .async_map(|payment_method_data| { ++ cards::create_encrypted_data( ++ key_manager_state, ++ merchant_context.get_merchant_key_store(), ++ payment_method_data, ++ ) ++ }) ++ .await ++ .transpose() ++ .change_context(errors::ApiErrorResponse::InternalServerError) ++ .attach_printable("Unable to encrypt Payment method data")? ++ .map(|encoded_pmd| { ++ encoded_pmd.deserialize_inner_value(|value| value.parse_value("PaymentMethodsData")) ++ }) ++ .transpose() ++ .change_context(errors::ApiErrorResponse::InternalServerError) ++ .attach_printable("Unable to parse Payment method data")?; ++ ++ let external_vault_token_data = req.payment_method_data.get_external_vault_token_data(); ++ ++ let encrypted_external_vault_token_data = external_vault_token_data ++ .async_map(|external_vault_token_data| { ++ cards::create_encrypted_data( ++ key_manager_state, ++ merchant_context.get_merchant_key_store(), ++ external_vault_token_data, ++ ) ++ }) ++ .await ++ .transpose() ++ .change_context(errors::ApiErrorResponse::InternalServerError) ++ .attach_printable("Unable to encrypt External vault token data")? ++ .map(|encoded_data| { ++ encoded_data ++ .deserialize_inner_value(|value| value.parse_value("ExternalVaultTokenData")) ++ }) ++ .transpose() ++ .change_context(errors::ApiErrorResponse::InternalServerError) ++ .attach_printable("Unable to parse External vault token data")?; ++ ++ let payment_method = create_payment_method_for_confirm( ++ state, ++ customer_id, ++ payment_method_id, ++ external_vault_source, ++ merchant_id, ++ merchant_context.get_merchant_key_store(), ++ merchant_context.get_merchant_account().storage_scheme, ++ req.payment_method_type, ++ req.payment_method_subtype, ++ payment_method_billing_address, ++ encrypted_payment_method_data, ++ encrypted_external_vault_token_data, ++ ) ++ .await?; ++ ++ let payment_method_response = ++ pm_transforms::generate_payment_method_response(&payment_method, &None)?; ++ ++ Ok((payment_method_response, payment_method)) ++} ++ + #[cfg(feature = "v2")] + #[derive(Clone, Debug)] + pub struct NetworkTokenPaymentMethodDetails { +@@ -1183,6 +1329,14 @@ pub async fn populate_bin_details_for_payment_method( + #[async_trait::async_trait] + pub trait PaymentMethodExt { + async fn populate_bin_details_for_payment_method(&self, state: &SessionState) -> Self; ++ ++ // convert to data format compatible to save in payment method table ++ fn convert_to_additional_payment_method_data( ++ &self, ++ ) -> RouterResult; ++ ++ // get tokens generated from external vault ++ fn get_external_vault_token_data(&self) -> Option; + } + + #[cfg(feature = "v2")] +@@ -1239,6 +1393,120 @@ impl PaymentMethodExt for domain::PaymentMethodVaultingData { + _ => self.clone(), + } + } ++ ++ // Not implement because it is saved in locker and not in payment method table ++ fn convert_to_additional_payment_method_data( ++ &self, ++ ) -> RouterResult { ++ Err(report!(errors::ApiErrorResponse::UnprocessableEntity { ++ message: "Payment method data is not supported".to_string() ++ }) ++ .attach_printable("Payment method data is not supported")) ++ } ++ ++ fn get_external_vault_token_data(&self) -> Option { ++ None ++ } ++} ++ ++#[cfg(feature = "v2")] ++#[async_trait::async_trait] ++impl PaymentMethodExt for payment_methods::PaymentMethodCreateData { ++ async fn populate_bin_details_for_payment_method(&self, state: &SessionState) -> Self { ++ match self { ++ Self::ProxyCard(card) => { ++ let card_isin = card.bin_number.clone(); ++ ++ if card.card_issuer.is_some() ++ && card.card_network.is_some() ++ && card.card_type.is_some() ++ && card.card_issuing_country.is_some() ++ { ++ Self::ProxyCard(card.clone()) ++ } else if let Some(card_isin) = card_isin { ++ let card_info = state ++ .store ++ .get_card_info(&card_isin) ++ .await ++ .map_err(|error| services::logger::error!(card_info_error=?error)) ++ .ok() ++ .flatten(); ++ ++ Self::ProxyCard(payment_methods::ProxyCardDetails { ++ card_number: card.card_number.clone(), ++ card_exp_month: card.card_exp_month.clone(), ++ card_exp_year: card.card_exp_year.clone(), ++ card_holder_name: card.card_holder_name.clone(), ++ bin_number: card.bin_number.clone(), ++ last_four: card.last_four.clone(), ++ nick_name: card.nick_name.clone(), ++ card_issuing_country: card_info ++ .as_ref() ++ .and_then(|val| val.card_issuing_country.clone()), ++ card_network: card_info.as_ref().and_then(|val| val.card_network.clone()), ++ card_issuer: card_info.as_ref().and_then(|val| val.card_issuer.clone()), ++ card_type: card_info.as_ref().and_then(|val| val.card_type.clone()), ++ card_cvc: card.card_cvc.clone(), ++ }) ++ } else { ++ Self::ProxyCard(card.clone()) ++ } ++ } ++ _ => self.clone(), ++ } ++ } ++ ++ fn convert_to_additional_payment_method_data( ++ &self, ++ ) -> RouterResult { ++ match self.clone() { ++ Self::ProxyCard(card_details) => Ok(payment_methods::PaymentMethodsData::Card( ++ payment_methods::CardDetailsPaymentMethod { ++ last4_digits: card_details.last_four, ++ expiry_month: Some(card_details.card_exp_month), ++ expiry_year: Some(card_details.card_exp_year), ++ card_holder_name: card_details.card_holder_name, ++ nick_name: card_details.nick_name, ++ issuer_country: card_details.card_issuing_country, ++ card_network: card_details.card_network, ++ card_issuer: card_details.card_issuer, ++ card_type: card_details.card_type, ++ card_isin: card_details.bin_number, ++ saved_to_locker: false, ++ co_badged_card_data: None, ++ }, ++ )), ++ Self::Card(card_details) => Ok(payment_methods::PaymentMethodsData::Card( ++ payment_methods::CardDetailsPaymentMethod { ++ expiry_month: Some(card_details.card_exp_month), ++ expiry_year: Some(card_details.card_exp_year), ++ card_holder_name: card_details.card_holder_name, ++ nick_name: card_details.nick_name, ++ issuer_country: card_details ++ .card_issuing_country ++ .map(|country| country.to_string()), ++ card_network: card_details.card_network, ++ card_issuer: card_details.card_issuer, ++ card_type: card_details ++ .card_type ++ .map(|card_type| card_type.to_string()), ++ saved_to_locker: false, ++ card_isin: None, ++ last4_digits: None, ++ co_badged_card_data: None, ++ }, ++ )), ++ } ++ } ++ ++ fn get_external_vault_token_data(&self) -> Option { ++ match self.clone() { ++ Self::ProxyCard(card_details) => Some(payment_methods::ExternalVaultTokenData { ++ tokenized_card_number: card_details.card_number, ++ }), ++ Self::Card(_) => None, ++ } ++ } + } + + #[cfg(feature = "v2")] +@@ -1684,6 +1952,7 @@ pub async fn create_payment_method_for_intent( + network_token_payment_method_data: None, + network_token_requestor_reference_id: None, + external_vault_source: None, ++ external_vault_token_data: None, + }, + storage_scheme, + ) +@@ -1694,6 +1963,180 @@ pub async fn create_payment_method_for_intent( + Ok(response) + } + ++#[cfg(feature = "v2")] ++#[instrument(skip_all)] ++#[allow(clippy::too_many_arguments)] ++pub async fn create_payment_method_for_confirm( ++ state: &SessionState, ++ customer_id: &id_type::GlobalCustomerId, ++ payment_method_id: id_type::GlobalPaymentMethodId, ++ external_vault_source: Option, ++ merchant_id: &id_type::MerchantId, ++ key_store: &domain::MerchantKeyStore, ++ storage_scheme: enums::MerchantStorageScheme, ++ payment_method_type: storage_enums::PaymentMethod, ++ payment_method_subtype: storage_enums::PaymentMethodType, ++ encrypted_payment_method_billing_address: Option< ++ Encryptable, ++ >, ++ encrypted_payment_method_data: Option>, ++ encrypted_external_vault_token_data: Option< ++ Encryptable, ++ >, ++) -> CustomResult { ++ let db = &*state.store; ++ let key_manager_state = &state.into(); ++ let current_time = common_utils::date_time::now(); ++ ++ let response = db ++ .insert_payment_method( ++ key_manager_state, ++ key_store, ++ domain::PaymentMethod { ++ customer_id: customer_id.to_owned(), ++ merchant_id: merchant_id.to_owned(), ++ id: payment_method_id, ++ locker_id: None, ++ payment_method_type: Some(payment_method_type), ++ payment_method_subtype: Some(payment_method_subtype), ++ payment_method_data: encrypted_payment_method_data, ++ connector_mandate_details: None, ++ customer_acceptance: None, ++ client_secret: None, ++ status: enums::PaymentMethodStatus::Inactive, ++ network_transaction_id: None, ++ created_at: current_time, ++ last_modified: current_time, ++ last_used_at: current_time, ++ payment_method_billing_address: encrypted_payment_method_billing_address, ++ updated_by: None, ++ version: common_types::consts::API_VERSION, ++ locker_fingerprint_id: None, ++ network_token_locker_id: None, ++ network_token_payment_method_data: None, ++ network_token_requestor_reference_id: None, ++ external_vault_source, ++ external_vault_token_data: encrypted_external_vault_token_data, ++ }, ++ storage_scheme, ++ ) ++ .await ++ .change_context(errors::ApiErrorResponse::InternalServerError) ++ .attach_printable("Failed to add payment method in db")?; ++ ++ Ok(response) ++} ++ ++#[cfg(feature = "v2")] ++#[instrument(skip_all)] ++#[allow(clippy::too_many_arguments)] ++pub async fn get_external_vault_token( ++ state: &SessionState, ++ key_store: &domain::MerchantKeyStore, ++ storage_scheme: enums::MerchantStorageScheme, ++ payment_token: String, ++ vault_token: payment_method_data::VaultToken, ++ payment_method_type: &storage_enums::PaymentMethod, ++) -> CustomResult { ++ let db = &*state.store; ++ ++ let pm_token_data = ++ utils::retrieve_payment_token_data(state, payment_token, Some(payment_method_type)).await?; ++ ++ let payment_method_id = match pm_token_data { ++ storage::PaymentTokenData::PermanentCard(card_token_data) => { ++ card_token_data.payment_method_id ++ } ++ storage::PaymentTokenData::TemporaryGeneric(_) => { ++ Err(errors::ApiErrorResponse::NotImplemented { ++ message: errors::NotImplementedMessage::Reason( ++ "TemporaryGeneric Token not implemented".to_string(), ++ ), ++ })? ++ } ++ storage::PaymentTokenData::AuthBankDebit(_) => { ++ Err(errors::ApiErrorResponse::NotImplemented { ++ message: errors::NotImplementedMessage::Reason( ++ "AuthBankDebit Token not implemented".to_string(), ++ ), ++ })? ++ } ++ }; ++ ++ let payment_method = db ++ .find_payment_method(&state.into(), key_store, &payment_method_id, storage_scheme) ++ .await ++ .change_context(errors::ApiErrorResponse::PaymentMethodNotFound) ++ .attach_printable("Payment method not found")?; ++ ++ let external_vault_token_data = payment_method ++ .external_vault_token_data ++ .clone() ++ .map(Encryptable::into_inner) ++ .ok_or(errors::ApiErrorResponse::InternalServerError) ++ .attach_printable("Missing vault token data")?; ++ ++ let decrypted_addtional_payment_method_data = payment_method ++ .payment_method_data ++ .clone() ++ .map(Encryptable::into_inner) ++ .ok_or(errors::ApiErrorResponse::InternalServerError) ++ .attach_printable("Failed to convert payment method data")?; ++ ++ convert_from_saved_payment_method_data( ++ decrypted_addtional_payment_method_data, ++ external_vault_token_data, ++ vault_token, ++ ) ++ .attach_printable("Failed to convert payment method data") ++} ++ ++#[cfg(feature = "v2")] ++fn convert_from_saved_payment_method_data( ++ vault_additional_data: payment_methods::PaymentMethodsData, ++ external_vault_token_data: payment_methods::ExternalVaultTokenData, ++ vault_token: payment_method_data::VaultToken, ++) -> RouterResult { ++ match vault_additional_data { ++ payment_methods::PaymentMethodsData::Card(card_details) => { ++ Ok(payment_method_data::ExternalVaultPaymentMethodData::Card( ++ Box::new(domain::ExternalVaultCard { ++ card_number: external_vault_token_data.tokenized_card_number, ++ card_exp_month: card_details.expiry_month.ok_or( ++ errors::ApiErrorResponse::MissingRequiredField { ++ field_name: "card_details.expiry_month", ++ }, ++ )?, ++ card_exp_year: card_details.expiry_year.ok_or( ++ errors::ApiErrorResponse::MissingRequiredField { ++ field_name: "card_details.expiry_year", ++ }, ++ )?, ++ card_holder_name: card_details.card_holder_name, ++ bin_number: card_details.card_isin, ++ last_four: card_details.last4_digits, ++ nick_name: card_details.nick_name, ++ card_issuing_country: card_details.issuer_country, ++ card_network: card_details.card_network, ++ card_issuer: card_details.card_issuer, ++ card_type: card_details.card_type, ++ card_cvc: vault_token.card_cvc, ++ co_badged_card_data: None, // Co-badged data is not supported in external vault ++ bank_code: None, // Bank code is not stored in external vault ++ }), ++ )) ++ } ++ payment_methods::PaymentMethodsData::BankDetails(_) ++ | payment_methods::PaymentMethodsData::WalletDetails(_) => { ++ Err(errors::ApiErrorResponse::UnprocessableEntity { ++ message: "External vaulting is not supported for this payment method type" ++ .to_string(), ++ } ++ .into()) ++ } ++ } ++} ++ + #[cfg(feature = "v2")] + /// Update the connector_mandate_details of the payment method with + /// new token details for the payment +@@ -3014,13 +3457,13 @@ pub async fn payment_methods_session_confirm( + ) + .attach_printable("Failed to create payment method request")?; + +- let (payment_method_response, payment_method) = create_payment_method_core( ++ let (payment_method_response, payment_method) = Box::pin(create_payment_method_core( + &state, + &req_state, + create_payment_method_request.clone(), + &merchant_context, + &profile, +- ) ++ )) + .await?; + + let parent_payment_method_token = generate_id(consts::ID_LENGTH, "token"); +diff --git a/crates/router/src/core/payment_methods/vault.rs b/crates/router/src/core/payment_methods/vault.rs +index 133fea41..7e2c5876 100644 +--- a/crates/router/src/core/payment_methods/vault.rs ++++ b/crates/router/src/core/payment_methods/vault.rs +@@ -1544,7 +1544,7 @@ pub async fn insert_cvc_using_payment_token( + fulfillment_time: i64, + encryption_key: &masking::Secret>, + ) -> RouterResult<()> { +- let card_cvc = domain::PaymentMethodVaultingData::from(payment_method_data) ++ let card_cvc = domain::PaymentMethodVaultingData::try_from(payment_method_data)? + .get_card() + .and_then(|card| card.card_cvc.clone()); + +diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs +index 2dfb3d25..d1d7c33d 100644 +--- a/crates/router/src/core/payments.rs ++++ b/crates/router/src/core/payments.rs +@@ -1563,6 +1563,11 @@ where + .to_not_found_response(errors::ApiErrorResponse::CustomerNotFound) + .attach_printable("Failed while fetching/creating customer")?; + ++ operation ++ .to_domain()? ++ .create_or_fetch_payment_method(state, &merchant_context, &profile, &mut payment_data) ++ .await?; ++ + // consume the req merchant_connector_id and set it in the payment_data + let connector = operation + .to_domain()? +@@ -1613,6 +1618,15 @@ where + updated_customer, + ) + .await?; ++ ++ // update payment method if its a successful transaction ++ if router_data.status.is_success() { ++ operation ++ .to_domain()? ++ .update_payment_method(state, &merchant_context, &mut payment_data) ++ .await; ++ } ++ + let payments_response_operation = Box::new(PaymentResponse); + + payments_response_operation +diff --git a/crates/router/src/core/payments/operations.rs b/crates/router/src/core/payments/operations.rs +index 1c793209..b9c36a1f 100644 +--- a/crates/router/src/core/payments/operations.rs ++++ b/crates/router/src/core/payments/operations.rs +@@ -403,6 +403,17 @@ pub trait Domain: Send + Sync { + Ok(()) + } + ++ // does not propagate error to not affect the payment flow ++ // must add debugger in case of internal error ++ #[cfg(feature = "v2")] ++ async fn update_payment_method<'a>( ++ &'a self, ++ state: &SessionState, ++ merchant_context: &domain::MerchantContext, ++ payment_data: &mut D, ++ ) { ++ } ++ + /// This function is used to apply the 3DS authentication strategy + async fn apply_three_ds_authentication_strategy<'a>( + &'a self, +diff --git a/crates/router/src/core/payments/operations/external_vault_proxy_payment_intent.rs b/crates/router/src/core/payments/operations/external_vault_proxy_payment_intent.rs +index 7e58dc95..56cf72a6 100644 +--- a/crates/router/src/core/payments/operations/external_vault_proxy_payment_intent.rs ++++ b/crates/router/src/core/payments/operations/external_vault_proxy_payment_intent.rs +@@ -1,8 +1,12 @@ + use api_models::payments::ExternalVaultProxyPaymentsRequest; + use async_trait::async_trait; + use common_enums::enums; +-use common_utils::types::keymanager::ToEncryptable; +-use error_stack::ResultExt; ++use common_utils::{ ++ crypto::Encryptable, ++ ext_traits::{AsyncExt, ValueExt}, ++ types::keymanager::ToEncryptable, ++}; ++use error_stack::{report, ResultExt}; + use hyperswitch_domain_models::{ + payment_method_data::PaymentMethodData, payments::PaymentConfirmData, + }; +@@ -14,6 +18,7 @@ use super::{Domain, GetTracker, Operation, PostUpdateTracker, UpdateTracker, Val + use crate::{ + core::{ + errors::{self, CustomResult, RouterResult, StorageErrorExt}, ++ payment_methods::{self, PaymentMethodExt}, + payments::{ + self, + operations::{self, ValidateStatusForOperation}, +@@ -336,6 +341,95 @@ impl Domain( ++ &'a self, ++ state: &SessionState, ++ merchant_context: &domain::MerchantContext, ++ business_profile: &domain::Profile, ++ payment_data: &mut PaymentConfirmData, ++ ) -> CustomResult<(), errors::ApiErrorResponse> { ++ match ( ++ payment_data.payment_intent.customer_id.clone(), ++ payment_data.external_vault_pmd.clone(), ++ payment_data.payment_attempt.customer_acceptance.clone(), ++ payment_data.payment_attempt.payment_token.clone(), ++ ) { ++ (Some(customer_id), Some(hyperswitch_domain_models::payment_method_data::ExternalVaultPaymentMethodData::Card(card_details)), Some(_), None) => { ++ ++ let payment_method_data = ++ api::PaymentMethodCreateData::ProxyCard(api::ProxyCardDetails::from(*card_details)); ++ let billing = payment_data ++ .payment_address ++ .get_payment_method_billing() ++ .cloned() ++ .map(From::from); ++ ++ let req = api::PaymentMethodCreate { ++ payment_method_type: payment_data.payment_attempt.payment_method_type, ++ payment_method_subtype: payment_data.payment_attempt.payment_method_subtype, ++ metadata: None, ++ customer_id, ++ payment_method_data, ++ billing, ++ psp_tokenization: None, ++ network_tokenization: None, ++ }; ++ ++ let (_pm_response, payment_method) = Box::pin(payment_methods::create_payment_method_core( ++ state, ++ &state.get_req_state(), ++ req, ++ merchant_context, ++ business_profile, ++ )) ++ .await?; ++ ++ payment_data.payment_method = Some(payment_method); ++ } ++ (_, Some(hyperswitch_domain_models::payment_method_data::ExternalVaultPaymentMethodData::VaultToken(vault_token)), None, Some(payment_token)) => { ++ payment_data.external_vault_pmd = Some(payment_methods::get_external_vault_token( ++ state, ++ merchant_context.get_merchant_key_store(), ++ merchant_context.get_merchant_account().storage_scheme, ++ payment_token.clone(), ++ vault_token.clone(), ++ &payment_data.payment_attempt.payment_method_type ++ ) ++ .await?); ++ } ++ _ => { ++ router_env::logger::debug!( ++ "No payment method to create or fetch for external vault proxy payment intent" ++ ); ++ } ++ } ++ ++ Ok(()) ++ } ++ ++ #[cfg(feature = "v2")] ++ async fn update_payment_method<'a>( ++ &'a self, ++ state: &SessionState, ++ merchant_context: &domain::MerchantContext, ++ payment_data: &mut PaymentConfirmData, ++ ) { ++ if let (true, Some(payment_method_id)) = ( ++ payment_data.payment_attempt.customer_acceptance.is_some(), ++ payment_data.payment_attempt.payment_method_id.clone(), ++ ) { ++ payment_methods::update_payment_method_status_internal( ++ state, ++ merchant_context.get_merchant_key_store(), ++ merchant_context.get_merchant_account().storage_scheme, ++ common_enums::PaymentMethodStatus::Active, ++ &payment_method_id, ++ ) ++ .await ++ .map_err(|err| router_env::logger::error!(err=?err)); ++ }; ++ } ++ + #[instrument(skip_all)] + async fn populate_payment_data<'a>( + &'a self, +diff --git a/crates/router/src/core/payments/operations/payment_confirm_intent.rs b/crates/router/src/core/payments/operations/payment_confirm_intent.rs +index c2f3e414..ccbe540d 100644 +--- a/crates/router/src/core/payments/operations/payment_confirm_intent.rs ++++ b/crates/router/src/core/payments/operations/payment_confirm_intent.rs +@@ -496,14 +496,15 @@ impl Domain { ++ Err(UnifiedConnectorServiceError::NotImplemented(format!( ++ "Unimplemented payment method subtype: {payment_method_type:?}" ++ )) ++ .into()) ++ } + } + } + pub fn build_unified_connector_service_auth_metadata( +diff --git a/crates/router/src/types/api/payment_methods.rs b/crates/router/src/types/api/payment_methods.rs +index df3f4d46..ed05d5ae 100644 +--- a/crates/router/src/types/api/payment_methods.rs ++++ b/crates/router/src/types/api/payment_methods.rs +@@ -10,9 +10,9 @@ pub use api_models::payment_methods::{ + PaymentMethodIntentCreate, PaymentMethodListData, PaymentMethodListResponseForSession, + PaymentMethodMigrate, PaymentMethodMigrateResponse, PaymentMethodResponse, + PaymentMethodResponseData, PaymentMethodUpdate, PaymentMethodUpdateData, PaymentMethodsData, +- RequestPaymentMethodTypes, TokenDataResponse, TokenDetailsResponse, TokenizePayloadEncrypted, +- TokenizePayloadRequest, TokenizedCardValue1, TokenizedCardValue2, TokenizedWalletValue1, +- TokenizedWalletValue2, TotalPaymentMethodCountResponse, ++ ProxyCardDetails, RequestPaymentMethodTypes, TokenDataResponse, TokenDetailsResponse, ++ TokenizePayloadEncrypted, TokenizePayloadRequest, TokenizedCardValue1, TokenizedCardValue2, ++ TokenizedWalletValue1, TokenizedWalletValue2, TotalPaymentMethodCountResponse, + }; + #[cfg(feature = "v1")] + pub use api_models::payment_methods::{ +diff --git a/v2_compatible_migrations/2025-07-29-080133_add-external_vault_token_data-column-to-payment-methods/down.sql b/v2_compatible_migrations/2025-07-29-080133_add-external_vault_token_data-column-to-payment-methods/down.sql +new file mode 100644 +index 00000000..322b2e59 +--- /dev/null ++++ b/v2_compatible_migrations/2025-07-29-080133_add-external_vault_token_data-column-to-payment-methods/down.sql +@@ -0,0 +1,2 @@ ++-- This file should undo anything in `up.sql` ++ALTER TABLE payment_methods DROP COLUMN IF EXISTS external_vault_token_data; +\ No newline at end of file +diff --git a/v2_compatible_migrations/2025-07-29-080133_add-external_vault_token_data-column-to-payment-methods/up.sql b/v2_compatible_migrations/2025-07-29-080133_add-external_vault_token_data-column-to-payment-methods/up.sql +new file mode 100644 +index 00000000..516ff653 +--- /dev/null ++++ b/v2_compatible_migrations/2025-07-29-080133_add-external_vault_token_data-column-to-payment-methods/up.sql +@@ -0,0 +1 @@ ++ALTER TABLE payment_methods ADD COLUMN IF NOT EXISTS external_vault_token_data BYTEA; +\ No newline at end of file + +----- END CHUNK ----- \ No newline at end of file diff --git a/raw/84/8446ffbf5992a97d79d129cade997effc60fcd85.txt b/raw/84/8446ffbf5992a97d79d129cade997effc60fcd85.txt new file mode 100644 index 0000000000000000000000000000000000000000..45c504ebab160f2ecee3a2dccdfcc5c6ad7323d2 --- /dev/null +++ b/raw/84/8446ffbf5992a97d79d129cade997effc60fcd85.txt @@ -0,0 +1,423 @@ +ROUTE: juspay/hyperswitch@8446ffbf5992a97d79d129cade997effc60fcd85 +REPO: https://github.com/juspay/hyperswitch +COMMIT: 8446ffbf5992a97d79d129cade997effc60fcd85 +AUTHOR: AnkitKmrGupta <143015358+AnkitKmrGupta@users.noreply.github.com> +DATE: 2025-08-26T12:31:41 + +=== ISSUE_AND_PR === +[PR #9036] fix(routing): activating multiple configs in decision engine +URL: https://github.com/juspay/hyperswitch/pull/9036 +BODY: +## Type of Change + + +- [x] Bugfix +- [ ] New feature +- [ ] Enhancement +- [ ] Refactoring +- [ ] Dependency updates +- [ ] Documentation +- [ ] CI/CD + +Taged Issue +https://github.com/juspay/hyperswitch-cloud/issues/10731 + +### Summary + +This PR refactors **Decision Engine dynamic routing setup** handling inside `link_routing_config` and `create_specific_dynamic_routing_setup` to improve reliability when updating dynamic routing configs. + +### Key Changes + +1. **Added `enable_decision_engine_dynamic_routing_setup` import** + + * Alongside `update_decision_engine_dynamic_routing_setup` in `helpers.rs`. + +2. **Enhanced error handling for SuccessRate & Elimination routing configs** + + * Now, we first attempt to update the DE config via `update_decision_engine_dynamic_routing_setup`. + * If the update fails, we gracefully fallback to **enabling** the config using `enable_decision_engine_dynamic_routing_setup` with parsed payloads: + + * `SuccessBasedRoutingConfig` + * `EliminationRoutingConfig` + +3. **Improved error messages & traceability** + + * Distinct error messages for update vs. enable flow. + * Clearer attachable printables for debugging. + +4. **Removed redundant `enable_decision_engine_dynamic_routing_setup` call** in + `create_specific_dynamic_routing_setup` to avoid duplicate execution, since setup is now properly handled within `link_routing_config`. + +### Why this change? + +* Previously, DE config updates could silently fail without retry/fallback. +* This introduces a safer mechanism: + + * Try **update** → fallback to **enable** with correct payload. +* Ensures merchant routing configs remain in sync with Decision Engine even if updates fail. + +### Impact + +* More reliable DE config synchronization. +* Clearer error logs. +* Slight increase in control-flow complexity inside `link_routing_config`, but safer handling overall. + +**Screenshots + +Screenshot 2025-08-25 at 3 18 05 PM +Screenshot 2025-08-25 at 3 18 47 PM +Screenshot 2025-08-25 at 3 19 12 PM +Screenshot 2025-08-25 at 3 19 37 PM + + +**Curls and Responses + +create + +``` +curl --location 'http://localhost:8080/account/merchant_1756108708/business_profile/pro_hawNVdPoyuXr2njSINGY/dynamic_routing/success_based/create?enable=dynamic_connector_selection' \ +--header 'Content-Type: application/json' \ +--header 'api-key:*****' \ +--data '{ + "decision_engine_configs": { + "defaultLatencyThreshold": 90, + "defaultBucketSize": 200, + "defaultHedgingPercent": 5, + "subLevelInputConfig": [ + { + "paymentMethodType": "card", + "paymentMethod": "credit", + "bucketSize": 250, + "hedgingPercent": 1 + } + ] + } +}' +``` + +response + +``` +{ + "id": "routing_tVG4bP14dqo4TP7UVPV9", + "profile_id": "pro_hawNVdPoyuXr2njSINGY", + "name": "Success rate based dynamic routing algorithm", + "kind": "dynamic", + "description": "", + "created_at": 1756115463, + "modified_at": 1756115463, + "algorithm_for": "payment", + "decision_engine_routing_id": null +} +``` + +activate + +``` +curl --location 'http://localhost:8080/routing/routing_tVG4bP14dqo4TP7UVPV9/activate' \ +--header 'Content-Type: application/json' \ +--header 'api-key: dev_oxFyweqWmRlpg3ZXpKnr5nRQp4JJbrB4uDs85G3mWdCN9F0ZOAtSIvAnfNPhqV1q' \ +--data '{}' +``` + +response + +``` +{ + "id": "routing_tVG4bP14dqo4TP7UVPV9", + "profile_id": "pro_hawNVdPoyuXr2njSINGY", + "name": "Success rate based dynamic routing algorithm", + "kind": "dynamic", + "description": "", + "created_at": 1756115463, + "modified_at": 1756115463, + "algorithm_for": "payment", + "decision_engine_routing_id": null +} +``` + +create(new) + +``` +curl --location 'http://localhost:8080/account/merchant_1756108708/business_profile/pro_hawNVdPoyuXr2njSINGY/dynamic_routing/success_based/create?enable=dynamic_connector_selection' \ +--header 'Content-Type: application/json' \ +--header 'api-key:****' \ +--data '{ + "decision_engine_configs": { + "defaultLatencyThreshold": 90, + "defaultBucketSize": 200, + "defaultHedgingPercent": 5, + "subLevelInputConfig": [ + { + "paymentMethodType": "card", + "paymentMethod": "credit", + "bucketSize": 250, + "hedgingPercent": 1 + } + ] + } +}' +``` + +response + +``` +{ + "id": "routing_Jhz8tJy37C12jH19m90F", + "profile_id": "pro_hawNVdPoyuXr2njSINGY", + "name": "Success rate based dynamic routing algorithm", + "kind": "dynamic", + "description": "", + "created_at": 1756115557, + "modified_at": 1756115557, + "algorithm_for": "payment", + "decision_engine_routing_id": null +} +``` + +activate(new) +``` +curl --location 'http://localhost:8080/routing/routing_Jhz8tJy37C12jH19m90F/activate' \ +--header 'Content-Type: application/json' \ +--header 'api-key: dev_oxFyweqWmRlpg3ZXpKnr5nRQp4JJbrB4uDs85G3mWdCN9F0ZOAtSIvAnfNPhqV1q' \ +--data '{}' +``` + +response +``` +{ + "id": "routing_Jhz8tJy37C12jH19m90F", + "profile_id": "pro_hawNVdPoyuXr2njSINGY", + "name": "Success rate based dynamic routing algorithm", + "kind": "dynamic", + "description": "", + "created_at": 1756115557, + "modified_at": 1756115557, + "algorithm_for": "payment", + "decision_engine_routing_id": null +} + +``` +activate(old) + +``` +curl --location 'http://localhost:8080/routing/routing_tVG4bP14dqo4TP7UVPV9/activate' \ +--header 'Content-Type: application/json' \ +--header 'api-key: dev_oxFyweqWmRlpg3ZXpKnr5nRQp4JJbrB4uDs85G3mWdCN9F0ZOAtSIvAnfNPhqV1q' \ +--data '{}' +``` + +response + +``` +{ + "id": "routing_tVG4bP14dqo4TP7UVPV9", + "profile_id": "pro_hawNVdPoyuXr2njSINGY", + "name": "Success rate based dynamic routing algorithm", + "kind": "dynamic", + "description": "", + "created_at": 1756115463, + "modified_at": 1756115463, + "algorithm_for": "payment", + "decision_engine_routing_id": null +} + + +``` +COMMENTS: +- semanticdiff-com[bot]: Review changes with  SemanticDiff +
+Changed Files +
+ +| File | Status | +| :--- | :--- | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9036/changes#crates/router/src/core/routing.rs)  [crates/router/src/core/routing\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9036/changes#crates/router/src/core/routing.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9036/changes#crates/router/src/core/routing.rs)  28% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9036/changes#crates/router/src/core/routing/helpers.rs)  [crates/router/src/core/routing/helpers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9036/changes#crates/router/src/core/routing/helpers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9036/changes#crates/router/src/core/routing/helpers.rs)  1% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9036/changes#crates/api_models/src/open_router.rs)  [crates/api\_models/src/open\_router\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9036/changes#crates/api_models/src/open_router.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9036/changes#crates/api_models/src/open_router.rs)  0% smaller | + +
+- Sarthak1799: Attach screenshots of the cases as well @AnkitKmrGupta + +=== COMMIT === +SUBJECT: fix(routing): activating multiple configs in decision engine (#9036) +BODY: +Co-authored-by: Ankit Gupta +Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> + +=== FILES === +Summary: 3 files changed, +77 -26 +- crates/api_models/src/open_router.rs (+1 -1) +- crates/router/src/core/routing.rs (+75 -11) +- crates/router/src/core/routing/helpers.rs (+1 -14) + +=== PATCH === +diff --git a/crates/api_models/src/open_router.rs b/crates/api_models/src/open_router.rs +index c2e6bc76..94d31a73 100644 +--- a/crates/api_models/src/open_router.rs ++++ b/crates/api_models/src/open_router.rs +@@ -251,7 +251,7 @@ pub struct DecisionEngineConfigSetupRequest { + #[derive(Debug, Serialize, Deserialize, Clone)] + pub struct GetDecisionEngineConfigRequest { + pub merchant_id: String, +- pub config: DecisionEngineDynamicAlgorithmType, ++ pub algorithm: DecisionEngineDynamicAlgorithmType, + } + + #[derive(Debug, Serialize, Deserialize, Clone)] +diff --git a/crates/router/src/core/routing.rs b/crates/router/src/core/routing.rs +index 6094c982..0078bfce 100644 +--- a/crates/router/src/core/routing.rs ++++ b/crates/router/src/core/routing.rs +@@ -28,7 +28,9 @@ use external_services::grpc_client::dynamic_routing::{ + success_rate_client::SuccessBasedDynamicRouting, + }; + #[cfg(all(feature = "v1", feature = "dynamic_routing"))] +-use helpers::update_decision_engine_dynamic_routing_setup; ++use helpers::{ ++ enable_decision_engine_dynamic_routing_setup, update_decision_engine_dynamic_routing_setup, ++}; + use hyperswitch_domain_models::{mandates, payment_address}; + use payment_methods::helpers::StorageErrorExt; + use rustc_hash::FxHashSet; +@@ -694,7 +696,15 @@ pub async fn link_routing_config( + #[cfg(all(feature = "dynamic_routing", feature = "v1"))] + { + if state.conf.open_router.dynamic_routing_enabled { +- update_decision_engine_dynamic_routing_setup( ++ let existing_config = helpers::get_decision_engine_active_dynamic_routing_algorithm( ++ &state, ++ business_profile.get_id(), ++ api_models::open_router::DecisionEngineDynamicAlgorithmType::SuccessRate, ++ ) ++ .await; ++ ++ if let Ok(Some(_config)) = existing_config { ++ update_decision_engine_dynamic_routing_setup( + &state, + business_profile.get_id(), + routing_algorithm.algorithm_data.clone(), +@@ -706,6 +716,27 @@ pub async fn link_routing_config( + .attach_printable( + "Failed to update the success rate routing config in Decision Engine", + )?; ++ } else { ++ let data: routing_types::SuccessBasedRoutingConfig = ++ routing_algorithm.algorithm_data ++ .clone() ++ .parse_value("SuccessBasedRoutingConfig") ++ .change_context(errors::ApiErrorResponse::InternalServerError) ++ .attach_printable( ++ "unable to deserialize SuccessBasedRoutingConfig from routing algorithm data", ++ )?; ++ ++ enable_decision_engine_dynamic_routing_setup( ++ &state, ++ business_profile.get_id(), ++ routing_types::DynamicRoutingType::SuccessRateBasedRouting, ++ &mut dynamic_routing_ref, ++ Some(routing_types::DynamicRoutingPayload::SuccessBasedRoutingPayload(data)), ++ ) ++ .await ++ .change_context(errors::ApiErrorResponse::InternalServerError) ++ .attach_printable("Unable to setup decision engine dynamic routing")?; ++ } + } + } + } else if routing_algorithm.name == helpers::ELIMINATION_BASED_DYNAMIC_ROUTING_ALGORITHM +@@ -725,18 +756,51 @@ pub async fn link_routing_config( + #[cfg(all(feature = "dynamic_routing", feature = "v1"))] + { + if state.conf.open_router.dynamic_routing_enabled { +- update_decision_engine_dynamic_routing_setup( ++ let existing_config = helpers::get_decision_engine_active_dynamic_routing_algorithm( + &state, + business_profile.get_id(), +- routing_algorithm.algorithm_data.clone(), +- routing_types::DynamicRoutingType::EliminationRouting, +- &mut dynamic_routing_ref, ++ api_models::open_router::DecisionEngineDynamicAlgorithmType::Elimination, + ) +- .await +- .change_context(errors::ApiErrorResponse::InternalServerError) +- .attach_printable( +- "Failed to update the elimination routing config in Decision Engine", +- )?; ++ .await; ++ ++ if let Ok(Some(_config)) = existing_config { ++ update_decision_engine_dynamic_routing_setup( ++ &state, ++ business_profile.get_id(), ++ routing_algorithm.algorithm_data.clone(), ++ routing_types::DynamicRoutingType::EliminationRouting, ++ &mut dynamic_routing_ref, ++ ) ++ .await ++ .change_context(errors::ApiErrorResponse::InternalServerError) ++ .attach_printable( ++ "Failed to update the elimination routing config in Decision Engine", ++ )?; ++ } else { ++ let data: routing_types::EliminationRoutingConfig = ++ routing_algorithm.algorithm_data ++ .clone() ++ .parse_value("EliminationRoutingConfig") ++ .change_context(errors::ApiErrorResponse::InternalServerError) ++ .attach_printable( ++ "unable to deserialize EliminationRoutingConfig from routing algorithm data", ++ )?; ++ ++ enable_decision_engine_dynamic_routing_setup( ++ &state, ++ business_profile.get_id(), ++ routing_types::DynamicRoutingType::EliminationRouting, ++ &mut dynamic_routing_ref, ++ Some( ++ routing_types::DynamicRoutingPayload::EliminationRoutingPayload( ++ data, ++ ), ++ ), ++ ) ++ .await ++ .change_context(errors::ApiErrorResponse::InternalServerError) ++ .attach_printable("Unable to setup decision engine dynamic routing")?; ++ } + } + } + } else if routing_algorithm.name == helpers::CONTRACT_BASED_DYNAMIC_ROUTING_ALGORITHM { +diff --git a/crates/router/src/core/routing/helpers.rs b/crates/router/src/core/routing/helpers.rs +index 290feb9e..0b1395ed 100644 +--- a/crates/router/src/core/routing/helpers.rs ++++ b/crates/router/src/core/routing/helpers.rs +@@ -2307,19 +2307,6 @@ pub async fn create_specific_dynamic_routing_setup( + } + }; + +- if state.conf.open_router.dynamic_routing_enabled { +- enable_decision_engine_dynamic_routing_setup( +- state, +- business_profile.get_id(), +- dynamic_routing_type, +- &mut dynamic_routing_algo_ref, +- Some(payload), +- ) +- .await +- .change_context(errors::ApiErrorResponse::InternalServerError) +- .attach_printable("Unable to setup decision engine dynamic routing")?; +- } +- + let record = db + .insert_routing_algorithm(algo) + .await +@@ -2599,7 +2586,7 @@ pub async fn get_decision_engine_active_dynamic_routing_algorithm( + ); + let request = open_router::GetDecisionEngineConfigRequest { + merchant_id: profile_id.get_string_repr().to_owned(), +- config: dynamic_routing_type, ++ algorithm: dynamic_routing_type, + }; + let response: Option = + routing_utils::ConfigApiClient::send_decision_engine_request( + +----- END CHUNK ----- \ No newline at end of file diff --git a/raw/84/84a3492550118f4ad2a48beb50e87625605b6a82.txt b/raw/84/84a3492550118f4ad2a48beb50e87625605b6a82.txt new file mode 100644 index 0000000000000000000000000000000000000000..c758a63d1cfba7a5d1a1e94a4c1c84d639dc8e3e --- /dev/null +++ b/raw/84/84a3492550118f4ad2a48beb50e87625605b6a82.txt @@ -0,0 +1,402 @@ +ROUTE: juspay/hyperswitch@84a3492550118f4ad2a48beb50e87625605b6a82 +REPO: https://github.com/juspay/hyperswitch +COMMIT: 84a3492550118f4ad2a48beb50e87625605b6a82 +AUTHOR: Amisha Prabhat <55580080+Aprabhat19@users.noreply.github.com> +DATE: 2025-08-21T18:02:36 + +=== ISSUE_AND_PR === +[PR #8879] feat(revenue): Add support for hard-decline switch for revenue-recovery service +URL: https://github.com/juspay/hyperswitch/pull/8879 +BODY: +## Type of Change + + +- [ ] Bugfix +- [ ] New feature +- [ ] Enhancement +- [ ] Refactoring +- [ ] Dependency updates +- [ ] Documentation +- [ ] CI/CD + +## Description +Add support for hard-decline switch for revenue-recovery service. If we encounter a hard-decline we would not call the external service . This PR also adds support for gsm apis in v2 + +### Additional Changes + +- [ ] This PR modifies the API contract +- [ ] This PR modifies the database schema +- [ ] This PR modifies application configuration/environment variables + + + + +## Motivation and Context + + + +## How did you test it? +- hit this curl +``` curl + curl --location 'http://localhost:8080/v2/gsm' \ +--header 'Authorization: admin-api-key=test_admin' \ +--header 'Content-Type: application/json' \ + --data '{ + "connector": "authipay", + "flow": "revenue_recovery", + "sub_flow": "sub_flow", + "code": "100", + "message": "Insuffiecient Funds", + "status": "Failure", + "decision": "retry", +"clear_pan_possible":false, +"step_up_possible":false, + "error_category": "hard_decline" +}' +``` +- Response ```{"connector":"authipay","flow":"revenue_recovery","sub_flow":"sub_flow","code":"100","message":"Insuffiecient Funds","status":"Failure","router_error":null,"decision":"retry","step_up_possible":false,"unified_code":null,"unified_message":null,"error_category":"hard_decline","clear_pan_possible":false,"feature":"retry","feature_data":{"retry":{"step_up_possible":false,"clear_pan_possible":false,"alternate_network_possible":false,"decision":"retry"}}}% ``` + +- Db entry would be present +Screenshot 2025-08-21 at 5 45 52 PM + + +## Checklist + + +- [ ] I formatted the code `cargo +nightly fmt --all` +- [ ] I addressed lints thrown by `cargo clippy` +- [ ] I reviewed the submitted code +- [ ] I added unit tests for my changes where possible +COMMENTS: +- semanticdiff-com[bot]: Review changes with  SemanticDiff +
+Changed Files +
+ +| File | Status | +| :--- | :--- | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8879/changes#crates/router/src/lib.rs)  [crates/router/src/lib\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8879/changes#crates/router/src/lib.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8879/changes#crates/router/src/lib.rs)  76% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8879/changes#crates/router/src/types/storage/revenue_recovery.rs)  [crates/router/src/types/storage/revenue\_recovery\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8879/changes#crates/router/src/types/storage/revenue_recovery.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8879/changes#crates/router/src/types/storage/revenue_recovery.rs)  70% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8879/changes#api-reference/v1/openapi_spec_v1.json)  [api\-reference/v1/openapi\_spec\_v1\.json](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8879/changes#api-reference/v1/openapi_spec_v1.json) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8879/changes#api-reference/v1/openapi_spec_v1.json)  50% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8879/changes#api-reference/v2/openapi_spec_v2.json)  [api\-reference/v2/openapi\_spec\_v2\.json](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8879/changes#api-reference/v2/openapi_spec_v2.json) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8879/changes#api-reference/v2/openapi_spec_v2.json)  50% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8879/changes#crates/common_enums/src/enums.rs)  [crates/common\_enums/src/enums\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8879/changes#crates/common_enums/src/enums.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8879/changes#crates/common_enums/src/enums.rs)  43% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8879/changes#crates/router/src/routes/app.rs)  [crates/router/src/routes/app\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8879/changes#crates/router/src/routes/app.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8879/changes#crates/router/src/routes/app.rs)  6% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8879/changes#crates/router/src/core/revenue_recovery/types.rs)  [crates/router/src/core/revenue\_recovery/types\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8879/changes#crates/router/src/core/revenue_recovery/types.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8879/changes#crates/router/src/core/revenue_recovery/types.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8879/changes#crates/router/src/routes/gsm.rs)  [crates/router/src/routes/gsm\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8879/changes#crates/router/src/routes/gsm.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8879/changes#crates/router/src/routes/gsm.rs)  0% smaller | + +
+- hrithikesh026 [crates/router/src/routes/gsm.rs:10]: You must add equivalent v2 endpoints as well, like `/v2/gsm` +- hrithikesh026 [crates/router/src/core/revenue_recovery/types.rs:807]: This can be a const +- hrithikesh026 [crates/router/src/core/revenue_recovery/types.rs:824]: ```suggestion + .and_then(|gsm_record| gsm_record.error_category) + .map(|gsm_error_category| gsm_error_category == common_enums::ErrorCategory::HardDecline) + + .unwrap_or(true); +``` + +=== COMMIT === +SUBJECT: feat(revenue): Add support for hard-decline switch for revenue-recovery service (#8879) +BODY: +Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> +Co-authored-by: chikke srujan <121822803+srujanchikke@users.noreply.github.com> + +=== FILES === +Summary: 8 files changed, +78 -21 +- api-reference/v1/openapi_spec_v1.json (+3 -1) +- api-reference/v2/openapi_spec_v2.json (+3 -1) +- crates/common_enums/src/enums.rs (+5 -1) +- crates/router/src/core/revenue_recovery/types.rs (+31 -3) +- crates/router/src/lib.rs (+2 -1) +- crates/router/src/routes/app.rs (+12 -1) +- crates/router/src/routes/gsm.rs (+8 -5) +- crates/router/src/types/storage/revenue_recovery.rs (+14 -8) + +=== PATCH === +diff --git a/api-reference/v1/openapi_spec_v1.json b/api-reference/v1/openapi_spec_v1.json +index 83ec5821..3f54ca3a 100644 +--- a/api-reference/v1/openapi_spec_v1.json ++++ b/api-reference/v1/openapi_spec_v1.json +@@ -14641,7 +14641,9 @@ + "processor_downtime", + "processor_decline_unauthorized", + "issue_with_payment_method", +- "processor_decline_incorrect_data" ++ "processor_decline_incorrect_data", ++ "hard_decline", ++ "soft_decline" + ] + }, + "EventClass": { +diff --git a/api-reference/v2/openapi_spec_v2.json b/api-reference/v2/openapi_spec_v2.json +index d7d67a6d..d212afa8 100644 +--- a/api-reference/v2/openapi_spec_v2.json ++++ b/api-reference/v2/openapi_spec_v2.json +@@ -10724,7 +10724,9 @@ + "processor_downtime", + "processor_decline_unauthorized", + "issue_with_payment_method", +- "processor_decline_incorrect_data" ++ "processor_decline_incorrect_data", ++ "hard_decline", ++ "soft_decline" + ] + }, + "ErrorDetails": { +diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs +index 56170159..bf93c6fa 100644 +--- a/crates/common_enums/src/enums.rs ++++ b/crates/common_enums/src/enums.rs +@@ -8385,6 +8385,8 @@ pub enum ErrorCategory { + ProcessorDeclineUnauthorized, + IssueWithPaymentMethod, + ProcessorDeclineIncorrectData, ++ HardDecline, ++ SoftDecline, + } + + impl ErrorCategory { +@@ -8393,7 +8395,9 @@ impl ErrorCategory { + Self::ProcessorDowntime | Self::ProcessorDeclineUnauthorized => true, + Self::IssueWithPaymentMethod + | Self::ProcessorDeclineIncorrectData +- | Self::FrmDecline => false, ++ | Self::FrmDecline ++ | Self::HardDecline ++ | Self::SoftDecline => false, + } + } + } +diff --git a/crates/router/src/core/revenue_recovery/types.rs b/crates/router/src/core/revenue_recovery/types.rs +index 00a66152..1bccb513 100644 +--- a/crates/router/src/core/revenue_recovery/types.rs ++++ b/crates/router/src/core/revenue_recovery/types.rs +@@ -49,7 +49,7 @@ use crate::{ + }; + + type RecoveryResult = error_stack::Result; +- ++pub const REVENUE_RECOVERY: &str = "revenue_recovery"; + /// The status of Passive Churn Payments + #[derive(Clone, Debug, serde::Deserialize, serde::Serialize)] + pub enum RevenueRecoveryPaymentsAttemptStatus { +@@ -559,7 +559,7 @@ impl Action { + revenue_recovery_payment_data, + ) + .await; +- let db = &*state.store; ++ + match response { + Ok(_payment_data) => match payment_attempt.status.foreign_into() { + RevenueRecoveryPaymentsAttemptStatus::Succeeded => { +@@ -757,7 +757,35 @@ impl Action { + payment_attempt: &PaymentAttempt, + payment_intent: &PaymentIntent, + ) -> RecoveryResult { ++ let db = &*state.store; + let next_retry_count = pt.retry_count + 1; ++ let error_message = payment_attempt ++ .error ++ .as_ref() ++ .map(|details| details.message.clone()); ++ let error_code = payment_attempt ++ .error ++ .as_ref() ++ .map(|details| details.code.clone()); ++ let connector_name = payment_attempt ++ .connector ++ .clone() ++ .ok_or(errors::RecoveryError::ValueNotFound) ++ .attach_printable("unable to derive payment connector from payment attempt")?; ++ let gsm_record = helpers::get_gsm_record( ++ state, ++ error_code, ++ error_message, ++ connector_name, ++ REVENUE_RECOVERY.to_string(), ++ ) ++ .await; ++ let is_hard_decline = gsm_record ++ .and_then(|gsm_record| gsm_record.error_category) ++ .map(|gsm_error_category| { ++ gsm_error_category == common_enums::ErrorCategory::HardDecline ++ }) ++ .unwrap_or(false); + let schedule_time = revenue_recovery_payment_data + .get_schedule_time_based_on_retry_type( + state, +@@ -765,6 +793,7 @@ impl Action { + next_retry_count, + payment_attempt, + payment_intent, ++ is_hard_decline, + ) + .await; + +@@ -775,7 +804,6 @@ impl Action { + } + } + } +- + // TODO: Move these to impl based functions + async fn record_back_to_billing_connector( + state: &SessionState, +diff --git a/crates/router/src/lib.rs b/crates/router/src/lib.rs +index 828986ae..4584bee1 100644 +--- a/crates/router/src/lib.rs ++++ b/crates/router/src/lib.rs +@@ -219,7 +219,8 @@ pub fn mk_app( + server_app = server_app + .service(routes::UserDeprecated::server(state.clone())) + .service(routes::ProcessTrackerDeprecated::server(state.clone())) +- .service(routes::ProcessTracker::server(state.clone())); ++ .service(routes::ProcessTracker::server(state.clone())) ++ .service(routes::Gsm::server(state.clone())); + } + } + +diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs +index f5e7eee7..cf684a68 100644 +--- a/crates/router/src/routes/app.rs ++++ b/crates/router/src/routes/app.rs +@@ -2292,7 +2292,7 @@ impl ProfileNew { + + pub struct Gsm; + +-#[cfg(all(feature = "olap", feature = "v1"))] ++#[cfg(all(feature = "v1", feature = "olap"))] + impl Gsm { + pub fn server(state: AppState) -> Scope { + web::scope("/gsm") +@@ -2304,6 +2304,17 @@ impl Gsm { + } + } + ++#[cfg(all(feature = "v2", feature = "olap"))] ++impl Gsm { ++ pub fn server(state: AppState) -> Scope { ++ web::scope("/v2/gsm") ++ .app_data(web::Data::new(state)) ++ .service(web::resource("").route(web::post().to(gsm::create_gsm_rule))) ++ .service(web::resource("/get").route(web::post().to(gsm::get_gsm_rule))) ++ .service(web::resource("/update").route(web::post().to(gsm::update_gsm_rule))) ++ .service(web::resource("/delete").route(web::post().to(gsm::delete_gsm_rule))) ++ } ++} + pub struct Chat; + + #[cfg(feature = "olap")] +diff --git a/crates/router/src/routes/gsm.rs b/crates/router/src/routes/gsm.rs +index 77a0cb0a..886b24bb 100644 +--- a/crates/router/src/routes/gsm.rs ++++ b/crates/router/src/routes/gsm.rs +@@ -7,7 +7,10 @@ use crate::{ + core::{api_locking, gsm}, + services::{api, authentication as auth}, + }; +- ++#[cfg(feature = "v1")] ++const ADMIN_API_AUTH: auth::AdminApiAuth = auth::AdminApiAuth; ++#[cfg(feature = "v2")] ++const ADMIN_API_AUTH: auth::V2AdminApiAuth = auth::V2AdminApiAuth; + /// Gsm - Create + /// + /// To create a Gsm Rule +@@ -40,7 +43,7 @@ pub async fn create_gsm_rule( + &req, + payload, + |state, _, payload, _| gsm::create_gsm_rule(state, payload), +- &auth::AdminApiAuth, ++ &ADMIN_API_AUTH, + api_locking::LockAction::NotApplicable, + )) + .await +@@ -77,7 +80,7 @@ pub async fn get_gsm_rule( + &req, + gsm_retrieve_req, + |state, _, gsm_retrieve_req, _| gsm::retrieve_gsm_rule(state, gsm_retrieve_req), +- &auth::AdminApiAuth, ++ &ADMIN_API_AUTH, + api_locking::LockAction::NotApplicable, + )) + .await +@@ -115,7 +118,7 @@ pub async fn update_gsm_rule( + &req, + payload, + |state, _, payload, _| gsm::update_gsm_rule(state, payload), +- &auth::AdminApiAuth, ++ &ADMIN_API_AUTH, + api_locking::LockAction::NotApplicable, + )) + .await +@@ -154,7 +157,7 @@ pub async fn delete_gsm_rule( + &req, + payload, + |state, _, payload, _| gsm::delete_gsm_rule(state, payload), +- &auth::AdminApiAuth, ++ &ADMIN_API_AUTH, + api_locking::LockAction::NotApplicable, + )) + .await +diff --git a/crates/router/src/types/storage/revenue_recovery.rs b/crates/router/src/types/storage/revenue_recovery.rs +index 4b0dd2f2..1c1a076f 100644 +--- a/crates/router/src/types/storage/revenue_recovery.rs ++++ b/crates/router/src/types/storage/revenue_recovery.rs +@@ -1,7 +1,7 @@ + use std::fmt::Debug; + + use common_enums::enums; +-use common_utils::{ext_traits::ValueExt, id_type}; ++use common_utils::{date_time, ext_traits::ValueExt, id_type}; + use external_services::grpc_client::{self as external_grpc_client, GrpcHeaders}; + use hyperswitch_domain_models::{ + business_profile, merchant_account, merchant_connector_account, merchant_key_store, +@@ -38,6 +38,7 @@ impl RevenueRecoveryPaymentData { + retry_count: i32, + payment_attempt: &PaymentAttempt, + payment_intent: &PaymentIntent, ++ is_hard_decline: bool, + ) -> Option { + match self.retry_algorithm { + enums::RevenueRecoveryAlgorithmType::Monitoring => { +@@ -53,13 +54,18 @@ impl RevenueRecoveryPaymentData { + .await + } + enums::RevenueRecoveryAlgorithmType::Smart => { +- revenue_recovery::get_schedule_time_for_smart_retry( +- state, +- payment_attempt, +- payment_intent, +- retry_count, +- ) +- .await ++ if is_hard_decline { ++ None ++ } else { ++ // TODO: Integrate the smart retry call to return back a schedule time ++ revenue_recovery::get_schedule_time_for_smart_retry( ++ state, ++ payment_attempt, ++ payment_intent, ++ retry_count, ++ ) ++ .await ++ } + } + } + } + +----- END CHUNK ----- \ No newline at end of file diff --git a/raw/8d/8d398c623d21f667a28224f78f0851394dd57477.txt b/raw/8d/8d398c623d21f667a28224f78f0851394dd57477.txt new file mode 100644 index 0000000000000000000000000000000000000000..f04b59f6c923b8d566a44fa556dbefce69930325 --- /dev/null +++ b/raw/8d/8d398c623d21f667a28224f78f0851394dd57477.txt @@ -0,0 +1,660 @@ +ROUTE: juspay/hyperswitch@8d398c623d21f667a28224f78f0851394dd57477 +REPO: https://github.com/juspay/hyperswitch +COMMIT: 8d398c623d21f667a28224f78f0851394dd57477 +AUTHOR: Anurag +DATE: 2025-08-21T14:01:02 + +=== ISSUE_AND_PR === +[PR #9006] fix(connector): [STRIPE] Populate Error Message in Incremental Authorization Flow +URL: https://github.com/juspay/hyperswitch/pull/9006 +BODY: +## Type of Change + + +- [x] Bugfix +- [ ] New feature +- [ ] Enhancement +- [ ] Refactoring +- [ ] Dependency updates +- [ ] Documentation +- [ ] CI/CD + +Closes these issues - +[Issue 1](https://github.com/juspay/hyperswitch/issues/9003) +[Issue 2](https://github.com/juspay/hyperswitch/issues/9004) + +## Description + + +Populated Error Message in Incremental Authorization Flow. Added check for same amount in incremental authorization requests. + +### Additional Changes + +- [ ] This PR modifies the API contract +- [ ] This PR modifies the database schema +- [ ] This PR modifies application configuration/environment variables + + + + +## Motivation and Context + + + +## How did you test it? + + +Postman Test + +1. Payments - Create + +Request: + +``` +curl --location 'http://localhost:8080/payments' \ +--header 'Content-Type: application/json' \ +--header 'Accept: application/json' \ +--header 'api-key: dev_jVOnDLj6Q2nOHSSL8NIMQUws6P8WIRE9QNZ6toLt4gB7DqXuObIkVwPiXLJsY16n' \ +--data-raw '{ + "amount": 6500, + "currency": "USD", + "confirm": true, + "capture_method": "manual", + "capture_on": "2022-09-10T10:11:12Z", + "amount_to_capture": 6500, + "customer_id": "StripeCustomer", + "email": "abcdef123@gmail.com", + "name": "John Doe", + "phone": "999999999", + "phone_country_code": "+65", + "description": "Its my first payment request", + "authentication_type": "no_three_ds", + "return_url": "https://duck.com", + "billing": { + "address": { + "first_name": "John", + "last_name": "Doe", + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "city": "San Fransico", + "state": "California", + "zip": "94122", + "country": "US" + } + }, + "payment_method": "card", + "payment_method_type": "credit", + "payment_method_data": { + "card": { + "card_number": "4242424242424242", + "card_exp_month": "03", + "card_exp_year": "2030", + "card_holder_name": "joseph Doe", + "card_cvc": "737" + } + }, + "browser_info": { + "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36", + "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8", + "language": "nl-NL", + "color_depth": 24, + "screen_height": 723, + "screen_width": 1536, + "time_zone": 0, + "java_enabled": true, + "java_script_enabled": true, + "ip_address": "127.0.0.1" + }, + "shipping": { + "address": { + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "city": "San Fransico", + "state": "California", + "zip": "94122", + "country": "US", + "first_name": "John", + "last_name": "Doe" + } + }, + "statement_descriptor_name": "joseph", + "statement_descriptor_suffix": "JS", + "metadata": { + "udf1": "value1", + "new_customer": "true", + "login_date": "2025-07-25T11:46:12Z" + }, + "request_incremental_authorization": true +}' +``` + +Response: + +``` +{ + "payment_id": "pay_fXzLwsUeDagw7Cdyp8Sh", + "merchant_id": "merchant_1755689870", + "status": "requires_capture", + "amount": 6500, + "net_amount": 6500, + "shipping_cost": null, + "amount_capturable": 6500, + "amount_received": 0, + "connector": "stripe", + "client_secret": "pay_fXzLwsUeDagw7Cdyp8Sh_secret_Uoa82RaRfj6xcV3MnUtO", + "created": "2025-08-20T12:16:31.560Z", + "currency": "USD", + "customer_id": "StripeCustomer", + "customer": { + "id": "StripeCustomer", + "name": "John Doe", + "email": "abcdef123@gmail.com", + "phone": "999999999", + "phone_country_code": "+65" + }, + "description": "Its my first payment request", + "refunds": null, + "disputes": null, + "mandate_id": null, + "mandate_data": null, + "setup_future_usage": null, + "off_session": null, + "capture_on": null, + "capture_method": "manual", + "payment_method": "card", + "payment_method_data": { + "card": { + "last4": "4242", + "card_type": null, + "card_network": null, + "card_issuer": null, + "card_issuing_country": null, + "card_isin": "424242", + "card_extended_bin": null, + "card_exp_month": "03", + "card_exp_year": "2030", + "card_holder_name": "joseph Doe", + "payment_checks": { + "cvc_check": "pass", + "address_line1_check": "pass", + "address_postal_code_check": "pass" + }, + "authentication_data": null + }, + "billing": null + }, + "payment_token": null, + "shipping": { + "address": { + "city": "San Fransico", + "country": "US", + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "zip": "94122", + "state": "California", + "first_name": "John", + "last_name": "Doe" + }, + "phone": null, + "email": null + }, + "billing": { + "address": { + "city": "San Fransico", + "country": "US", + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "zip": "94122", + "state": "California", + "first_name": "John", + "last_name": "Doe" + }, + "phone": null, + "email": null + }, + "order_details": null, + "email": "abcdef123@gmail.com", + "name": "John Doe", + "phone": "999999999", + "return_url": "https://duck.com/", + "authentication_type": "no_three_ds", + "statement_descriptor_name": "joseph", + "statement_descriptor_suffix": "JS", + "next_action": null, + "cancellation_reason": null, + "error_code": null, + "error_message": null, + "unified_code": null, + "unified_message": null, + "payment_experience": null, + "payment_method_type": "credit", + "connector_label": null, + "business_country": null, + "business_label": "default", + "business_sub_label": null, + "allowed_payment_method_types": null, + "ephemeral_key": { + "customer_id": "StripeCustomer", + "created_at": 1755692191, + "expires": 1755695791, + "secret": "epk_c558a24e699a4b9db808d953a8df38f5" + }, + "manual_retry_allowed": false, + "connector_transaction_id": "pi_3RyAwOE9cSvqiivY17rwXSCJ", + "frm_message": null, + "metadata": { + "udf1": "value1", + "login_date": "2025-07-25T11:46:12Z", + "new_customer": "true" + }, + "connector_metadata": null, + "feature_metadata": null, + "reference_id": "pi_3RyAwOE9cSvqiivY17rwXSCJ", + "payment_link": null, + "profile_id": "pro_PMx2Y9TaHmSY8wUiC8kP", + "surcharge_details": null, + "attempt_count": 1, + "merchant_decision": null, + "merchant_connector_id": "mca_7VMxMHsmscuHwnVdYZPE", + "incremental_authorization_allowed": true, + "authorization_count": null, + "incremental_authorizations": null, + "external_authentication_details": null, + "external_3ds_authentication_attempted": false, + "expires_on": "2025-08-20T12:31:31.560Z", + "fingerprint": null, + "browser_info": { + "language": "nl-NL", + "time_zone": 0, + "ip_address": "127.0.0.1", + "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36", + "color_depth": 24, + "java_enabled": true, + "screen_width": 1536, + "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8", + "screen_height": 723, + "java_script_enabled": true + }, + "payment_channel": null, + "payment_method_id": null, + "payment_method_status": null, + "updated": "2025-08-20T12:16:32.579Z", + "split_payments": null, + "frm_metadata": null, + "extended_authorization_applied": null, + "capture_before": null, + "merchant_order_reference_id": null, + "order_tax_amount": null, + "connector_mandate_id": null, + "card_discovery": "manual", + "force_3ds_challenge": false, + "force_3ds_challenge_trigger": false, + "issuer_error_code": null, + "issuer_error_message": null, + "is_iframe_redirection_enabled": null, + "whole_connector_response": null +} +``` + +2. Payments - Incremental Authorization (with same amount) + +Request: + +``` +curl --location 'http://localhost:8080/payments/pay_fXzLwsUeDagw7Cdyp8Sh/incremental_authorization' \ +--header 'Content-Type: application/json' \ +--header 'api-key: dev_jVOnDLj6Q2nOHSSL8NIMQUws6P8WIRE9QNZ6toLt4gB7DqXuObIkVwPiXLJsY16n' \ +--data '{ + "amount": 6500 +}' +``` + +Response: + +``` +{ + "error": { + "type": "invalid_request", + "message": "Amount should be greater than original authorized amount", + "code": "IR_16" + } +} +``` + +3. Payments - Incremental Authorization (exceeding the maximum amount of time the flow can be called in Stripe) + +Request: + +``` +curl --location 'http://localhost:8080/payments/pay_gIQKmooikg2npSvaM9xZ/incremental_authorization' \ +--header 'Content-Type: application/json' \ +--header 'api-key: dev_jVOnDLj6Q2nOHSSL8NIMQUws6P8WIRE9QNZ6toLt4gB7DqXuObIkVwPiXLJsY16n' \ +--data '{ + "amount": 6511 +}' +``` + +Response: + +``` +{ + "payment_id": "pay_gIQKmooikg2npSvaM9xZ", + "merchant_id": "merchant_1755689870", + "status": "requires_capture", + "amount": 6510, + "net_amount": 6510, + "shipping_cost": null, + "amount_capturable": 6510, + "amount_received": null, + "connector": "stripe", + "client_secret": "pay_gIQKmooikg2npSvaM9xZ_secret_cmcrBTpMQL6Prbvudezo", + "created": "2025-08-20T13:28:31.692Z", + "currency": "USD", + "customer_id": null, + "customer": { + "id": null, + "name": "John Doe", + "email": "abcdef123@gmail.com", + "phone": "999999999", + "phone_country_code": "+65" + }, + "description": "Its my first payment request", + "refunds": null, + "disputes": null, + "mandate_id": null, + "mandate_data": null, + "setup_future_usage": null, + "off_session": null, + "capture_on": null, + "capture_method": "manual", + "payment_method": "card", + "payment_method_data": { + "card": { + "last4": "4242", + "card_type": null, + "card_network": null, + "card_issuer": null, + "card_issuing_country": null, + "card_isin": "424242", + "card_extended_bin": null, + "card_exp_month": "03", + "card_exp_year": "2030", + "card_holder_name": "joseph Doe", + "payment_checks": { + "cvc_check": "pass", + "address_line1_check": "pass", + "address_postal_code_check": "pass" + }, + "authentication_data": null + }, + "billing": null + }, + "payment_token": null, + "shipping": null, + "billing": null, + "order_details": null, + "email": null, + "name": null, + "phone": null, + "return_url": "https://duck.com/", + "authentication_type": "no_three_ds", + "statement_descriptor_name": "joseph", + "statement_descriptor_suffix": "JS", + "next_action": null, + "cancellation_reason": null, + "error_code": null, + "error_message": null, + "unified_code": null, + "unified_message": null, + "payment_experience": null, + "payment_method_type": "credit", + "connector_label": null, + "business_country": null, + "business_label": "default", + "business_sub_label": null, + "allowed_payment_method_types": null, + "ephemeral_key": null, + "manual_retry_allowed": false, + "connector_transaction_id": "pi_3RyC44E9cSvqiivY14N3VxbQ", + "frm_message": null, + "metadata": { + "udf1": "value1", + "login_date": "2025-07-25T11:46:12Z", + "new_customer": "true" + }, + "connector_metadata": null, + "feature_metadata": { + "redirect_response": null, + "search_tags": null, + "apple_pay_recurring_details": null, + "gateway_system": "direct" + }, + "reference_id": "pi_3RyC44E9cSvqiivY14N3VxbQ", + "payment_link": null, + "profile_id": "pro_PMx2Y9TaHmSY8wUiC8kP", + "surcharge_details": null, + "attempt_count": 1, + "merchant_decision": null, + "merchant_connector_id": "mca_7VMxMHsmscuHwnVdYZPE", + "incremental_authorization_allowed": true, + "authorization_count": 11, + "incremental_authorizations": [ + { + "authorization_id": "auth_RI9tMBRwaju7LpkDhNrT_1", + "amount": 6501, + "status": "success", + "error_code": null, + "error_message": null, + "previously_authorized_amount": 6500 + }, + { + "authorization_id": "auth_BoyLq9eHomflrMn5f2kD_2", + "amount": 6502, + "status": "success", + "error_code": null, + "error_message": null, + "previously_authorized_amount": 6501 + }, + { + "authorization_id": "auth_LZZQWDEHw57lbLcqqKv2_3", + "amount": 6503, + "status": "success", + "error_code": null, + "error_message": null, + "previously_authorized_amount": 6502 + }, + { + "authorization_id": "auth_RQeNDy0sdQnaLEW7f4Rm_4", + "amount": 6504, + "status": "success", + "error_code": null, + "error_message": null, + "previously_authorized_amount": 6503 + }, + { + "authorization_id": "auth_2MRj0ANmGIW6BvFARHAe_5", + "amount": 6505, + "status": "success", + "error_code": null, + "error_message": null, + "previously_authorized_amount": 6504 + }, + { + "authorization_id": "auth_egVuyLWfl6jGIZKdgLrt_6", + "amount": 6506, + "status": "success", + "error_code": null, + "error_message": null, + "previously_authorized_amount": 6505 + }, + { + "authorization_id": "auth_M33NayFU2GQicIGYMMkU_7", + "amount": 6507, + "status": "success", + "error_code": null, + "error_message": null, + "previously_authorized_amount": 6506 + }, + { + "authorization_id": "auth_UHtSahoOk1wVd8yacnJx_8", + "amount": 6508, + "status": "success", + "error_code": null, + "error_message": null, + "previously_authorized_amount": 6507 + }, + { + "authorization_id": "auth_IejW3q4wdP5LcRouVvGs_9", + "amount": 6509, + "status": "success", + "error_code": null, + "error_message": null, + "previously_authorized_amount": 6508 + }, + { + "authorization_id": "auth_sZNDStbUEPdqMMEZMlOV_10", + "amount": 6510, + "status": "success", + "error_code": null, + "error_message": null, + "previously_authorized_amount": 6509 + }, + { + "authorization_id": "auth_33dxNtWv6DiOdu3kGC4l_11", + "amount": 6511, + "status": "failure", + "error_code": "No error code", + "error_message": "The PaymentIntent has reached the maximum number of 10 allowed increments and cannot be incremented further.", + "previously_authorized_amount": 6510 + } + ], + "external_authentication_details": null, + "external_3ds_authentication_attempted": false, + "expires_on": "2025-08-20T13:43:31.691Z", + "fingerprint": null, + "browser_info": { + "language": "nl-NL", + "time_zone": 0, + "ip_address": "127.0.0.1", + "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36", + "color_depth": 24, + "java_enabled": true, + "screen_width": 1536, + "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8", + "screen_height": 723, + "java_script_enabled": true + }, + "payment_channel": null, + "payment_method_id": null, + "network_transaction_id": null, + "payment_method_status": null, + "updated": "2025-08-20T13:29:27.355Z", + "split_payments": null, + "frm_metadata": null, + "extended_authorization_applied": null, + "capture_before": null, + "merchant_order_reference_id": null, + "order_tax_amount": null, + "connector_mandate_id": null, + "card_discovery": "manual", + "force_3ds_challenge": false, + "force_3ds_challenge_trigger": false, + "issuer_error_code": null, + "issuer_error_message": null, + "is_iframe_redirection_enabled": null, + "whole_connector_response": null, + "enable_partial_authorization": null +} +``` + +## Checklist + + +- [x] I formatted the code `cargo +nightly fmt --all` +- [x] I addressed lints thrown by `cargo clippy` +- [x] I reviewed the submitted code +- [ ] I added unit tests for my changes where possible +COMMENTS: +- semanticdiff-com[bot]: Review changes with  SemanticDiff +
+Changed Files +
+ +| File | Status | +| :--- | :--- | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9006/changes#crates/hyperswitch_connectors/src/connectors/stripe.rs)  [crates/hyperswitch\_connectors/src/connectors/stripe\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9006/changes#crates/hyperswitch_connectors/src/connectors/stripe.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9006/changes#crates/hyperswitch_connectors/src/connectors/stripe.rs)  49% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9006/changes#crates/router/src/core/payments/operations/payments_incremental_authorization.rs)  [crates/router/src/core/payments/operations/payments\_incremental\_authorization\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9006/changes#crates/router/src/core/payments/operations/payments_incremental_authorization.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9006/changes#crates/router/src/core/payments/operations/payments_incremental_authorization.rs)  0% smaller | + +
+- sai-harsha-vardhan [crates/router/src/core/payments/operations/payments_incremental_authorization.rs:104]: can we instead use `>=`? + +=== COMMIT === +SUBJECT: fix(connector): [STRIPE] Populate Error Message in Incremental Authorization Flow (#9006) +BODY: +Co-authored-by: Anurag Singh + +=== FILES === +Summary: 2 files changed, +4 -3 +- crates/hyperswitch_connectors/src/connectors/stripe.rs (+3 -2) +- crates/router/src/core/payments/operations/payments_incremental_authorization.rs (+1 -1) + +=== PATCH === +diff --git a/crates/hyperswitch_connectors/src/connectors/stripe.rs b/crates/hyperswitch_connectors/src/connectors/stripe.rs +index fc27effe..b7810310 100644 +--- a/crates/hyperswitch_connectors/src/connectors/stripe.rs ++++ b/crates/hyperswitch_connectors/src/connectors/stripe.rs +@@ -1086,7 +1086,7 @@ impl + MinorUnit::new(req.request.total_amount), + req.request.currency, + )?; +- let connector_req = stripe::StripeIncrementalAuthRequest { amount }; ++ let connector_req = stripe::StripeIncrementalAuthRequest { amount }; // Incremental authorization can be done a maximum of 10 times in Stripe + + Ok(RequestContent::FormUrlEncoded(Box::new(connector_req))) + } +@@ -1162,7 +1162,8 @@ impl + .unwrap_or_else(|| NO_ERROR_CODE.to_string()), + message: response + .error +- .code ++ .message ++ .clone() + .unwrap_or_else(|| NO_ERROR_MESSAGE.to_string()), + reason: response.error.message.map(|message| { + response +diff --git a/crates/router/src/core/payments/operations/payments_incremental_authorization.rs b/crates/router/src/core/payments/operations/payments_incremental_authorization.rs +index a32f89ef..862fcd8f 100644 +--- a/crates/router/src/core/payments/operations/payments_incremental_authorization.rs ++++ b/crates/router/src/core/payments/operations/payments_incremental_authorization.rs +@@ -101,7 +101,7 @@ impl + + // Incremental authorization should be performed on an amount greater than the original authorized amount (in this case, greater than the net_amount which is sent for authorization) + // request.amount is the total amount that should be authorized in incremental authorization which should be greater than the original authorized amount +- if payment_attempt.get_total_amount() > request.amount { ++ if payment_attempt.get_total_amount() >= request.amount { + Err(errors::ApiErrorResponse::PreconditionFailed { + message: "Amount should be greater than original authorized amount".to_owned(), + })? + +----- END CHUNK ----- \ No newline at end of file diff --git a/raw/a5/a56d78a46a3ee80cdb2b48f9abfd2cd7b297e328.txt b/raw/a5/a56d78a46a3ee80cdb2b48f9abfd2cd7b297e328.txt new file mode 100644 index 0000000000000000000000000000000000000000..d4289494594e9db0b3a421f541abd9184354af8f --- /dev/null +++ b/raw/a5/a56d78a46a3ee80cdb2b48f9abfd2cd7b297e328.txt @@ -0,0 +1,208 @@ +ROUTE: juspay/hyperswitch@a56d78a46a3ee80cdb2b48f9abfd2cd7b297e328 +REPO: https://github.com/juspay/hyperswitch +COMMIT: a56d78a46a3ee80cdb2b48f9abfd2cd7b297e328 +AUTHOR: Sahkal Poddar +DATE: 2025-08-20T09:36:00 + +=== ISSUE_AND_PR === +[PR #8890] fix(authentication): changed required value for juspayThreedsserver config +URL: https://github.com/juspay/hyperswitch/pull/8890 +BODY: +## Type of Change + + +- [x] Bugfix + +## Description + +Changed required value for juspayThreedsserver config + + +## How did you test it? + +Screenshot 2025-08-11 at 12 18 19 PM + + +## Checklist + + +- [x] I formatted the code `cargo +nightly fmt --all` +- [x] I addressed lints thrown by `cargo clippy` +- [x] I reviewed the submitted code +- [ ] I added unit tests for my changes where possible +COMMENTS: +- semanticdiff-com[bot]: Review changes with  SemanticDiff + +=== COMMIT === +SUBJECT: fix(authentication): changed required value for juspayThreedsserver config (#8890) + +=== FILES === +Summary: 3 files changed, +26 -89 +- crates/connector_configs/toml/development.toml (+11 -50) +- crates/connector_configs/toml/production.toml (+14 -0) +- crates/connector_configs/toml/sandbox.toml (+1 -39) + +=== PATCH === +diff --git a/crates/connector_configs/toml/development.toml b/crates/connector_configs/toml/development.toml +index d007b4a9..83544e40 100644 +--- a/crates/connector_configs/toml/development.toml ++++ b/crates/connector_configs/toml/development.toml +@@ -6122,58 +6122,19 @@ key1="API Token" + [inespay.connector_webhook_details] + merchant_secret="API Key" + +-[juspaythreedsserver] +-[juspaythreedsserver.metadata.mcc] +-name="mcc" +-label="MCC" +-placeholder="Enter MCC" +-required=false +-type="Text" +- +-[juspaythreedsserver.metadata.merchant_country_code] +-name="merchant_country_code" +-label="3 digit numeric country code" +-placeholder="Enter 3 digit numeric country code" +-required=false +-type="Text" +-[juspaythreedsserver.metadata.merchant_name] +-name="merchant_name" +-label="Name of the merchant" +-placeholder="Enter Name of the merchant" +-required=false +-type="Text" + [juspaythreedsserver.metadata.three_ds_requestor_name] +-name="three_ds_requestor_name" +-label="ThreeDS requestor name" +-placeholder="Enter ThreeDS requestor name" +-required=false +-type="Text" ++name = "three_ds_requestor_name" ++label = "ThreeDS requestor name" ++placeholder = "Enter ThreeDS requestor name" ++required = false ++type = "Text" + [juspaythreedsserver.metadata.three_ds_requestor_id] +-name="three_ds_requestor_id" +-label="ThreeDS request id" +-placeholder="Enter ThreeDS request id" +-required=false +-type="Text" +-[juspaythreedsserver.metadata.acquirer_bin] +-name="acquirer_bin" +-label="Acquirer Bin" +-placeholder="Enter Acquirer Bin" +-required=true +-type="Text" +-[juspaythreedsserver.metadata.acquirer_country_code] +-name="acquirer_country_code" +-label="Acquirer Country Code" +-placeholder="Enter Acquirer Country Code" +-required=true +-type="Text" +-[juspaythreedsserver.metadata.acquirer_merchant_id] +-name="acquirer_merchant_id" +-label="Acquirer Merchant Id" +-placeholder="Enter Acquirer Merchant Id" +-required=true +-type="Text" +-[juspaythreedsserver.connector_auth.HeaderKey] +-api_key="API Key" ++name = "three_ds_requestor_id" ++label = "ThreeDS request id" ++placeholder = "Enter ThreeDS request id" ++required = false ++type = "Text" ++[juspaythreedsserver.connector_auth.NoKey] + + [hipay] + [[hipay.credit]] +diff --git a/crates/connector_configs/toml/production.toml b/crates/connector_configs/toml/production.toml +index aa6dac8d..019d842b 100644 +--- a/crates/connector_configs/toml/production.toml ++++ b/crates/connector_configs/toml/production.toml +@@ -5312,6 +5312,20 @@ api_key = "API Key" + [sift.connector_auth.HeaderKey] + api_key = "API Key" + ++[juspaythreedsserver.metadata.three_ds_requestor_name] ++name = "three_ds_requestor_name" ++label = "ThreeDS requestor name" ++placeholder = "Enter ThreeDS requestor name" ++required = false ++type = "Text" ++[juspaythreedsserver.metadata.three_ds_requestor_id] ++name = "three_ds_requestor_id" ++label = "ThreeDS request id" ++placeholder = "Enter ThreeDS request id" ++required = false ++type = "Text" ++[juspaythreedsserver.connector_auth.NoKey] ++ + [hyperwallet] + [hyperwallet.connector_auth.BodyKey] + api_key = "Password" +diff --git a/crates/connector_configs/toml/sandbox.toml b/crates/connector_configs/toml/sandbox.toml +index 138c28b7..85713150 100644 +--- a/crates/connector_configs/toml/sandbox.toml ++++ b/crates/connector_configs/toml/sandbox.toml +@@ -6098,26 +6098,7 @@ key1 = "API Token" + [inespay.connector_webhook_details] + merchant_secret = "API Key" + +-[juspaythreedsserver] +-[juspaythreedsserver.metadata.mcc] +-name = "mcc" +-label = "MCC" +-placeholder = "Enter MCC" +-required = false +-type = "Text" + +-[juspaythreedsserver.metadata.merchant_country_code] +-name = "merchant_country_code" +-label = "3 digit numeric country code" +-placeholder = "Enter 3 digit numeric country code" +-required = false +-type = "Text" +-[juspaythreedsserver.metadata.merchant_name] +-name = "merchant_name" +-label = "Name of the merchant" +-placeholder = "Enter Name of the merchant" +-required = false +-type = "Text" + [juspaythreedsserver.metadata.three_ds_requestor_name] + name = "three_ds_requestor_name" + label = "ThreeDS requestor name" +@@ -6130,26 +6111,7 @@ label = "ThreeDS request id" + placeholder = "Enter ThreeDS request id" + required = false + type = "Text" +-[juspaythreedsserver.metadata.acquirer_bin] +-name = "acquirer_bin" +-label = "Acquirer Bin" +-placeholder = "Enter Acquirer Bin" +-required = true +-type = "Text" +-[juspaythreedsserver.metadata.acquirer_country_code] +-name = "acquirer_country_code" +-label = "Acquirer Country Code" +-placeholder = "Enter Acquirer Country Code" +-required = true +-type = "Text" +-[juspaythreedsserver.metadata.acquirer_merchant_id] +-name = "acquirer_merchant_id" +-label = "Acquirer Merchant Id" +-placeholder = "Enter Acquirer Merchant Id" +-required = true +-type = "Text" +-[juspaythreedsserver.connector_auth.HeaderKey] +-api_key = "API Key" ++[juspaythreedsserver.connector_auth.NoKey] + + + [hipay] + +----- END CHUNK ----- \ No newline at end of file diff --git a/raw/a8/a819b4639b1e4279b117f4693cb0716b08e5e2e9.txt b/raw/a8/a819b4639b1e4279b117f4693cb0716b08e5e2e9.txt new file mode 100644 index 0000000000000000000000000000000000000000..ac74e7aa9a7ec2faaa199136ff0daaf06fbadee6 --- /dev/null +++ b/raw/a8/a819b4639b1e4279b117f4693cb0716b08e5e2e9.txt @@ -0,0 +1,136 @@ +ROUTE: juspay/hyperswitch@a819b4639b1e4279b117f4693cb0716b08e5e2e9 +REPO: https://github.com/juspay/hyperswitch +COMMIT: a819b4639b1e4279b117f4693cb0716b08e5e2e9 +AUTHOR: Mrudul Vajpayee <124863642+mrudulvajpayee4935@users.noreply.github.com> +DATE: 2025-08-21T11:03:37 + +=== ISSUE_AND_PR === +[PR #9007] feat(payment-link): update traditional chinese paymentlink exp msg +URL: https://github.com/juspay/hyperswitch/pull/9007 +BODY: +## Type of Change + + +- [x] Bugfix +- [ ] New feature +- [ ] Enhancement +- [ ] Refactoring +- [ ] Dependency updates +- [ ] Documentation +- [ ] CI/CD + +## Description + +We need to update payment link expired msg for traditional chinese locale. + +### Additional Changes + +- [ ] This PR modifies the API contract +- [ ] This PR modifies the database schema +- [ ] This PR modifies application configuration/environment variables + + + + +## Motivation and Context + +Raised by the merchant to update the locale to the correct one as shared by them. + +## How did you test it? + +``` +curl --location 'http://localhost:8080/payments' \ +--header 'Content-Type: application/json' \ +--header 'Accept: application/json' \ +--header 'api-key: **' \ +--header 'Accept-Language: zh_hant' \ +--data '{ + "amount": 10, + "setup_future_usage": "off_session", + "profile_id":"pro_vAgaZjm1nZmCss6jud6A", + "currency": "EUR", + "payment_link": true, + "session_expiry": 60, + "return_url": "https://google.com", + "payment_link_config": { + "display_sdk_only":false, + "theme": "#14356F", + "logo": "https://logo.com/wp-content/uploads/2020/08/zurich.svg", + "seller_name": "Zurich Inc." + } +}' +``` +image + +Expected traditional chinese: +image + + +## Checklist + + +- [x] I formatted the code `cargo +nightly fmt --all` +- [x] I addressed lints thrown by `cargo clippy` +- [ ] I reviewed the submitted code +- [ ] I added unit tests for my changes where possible +COMMENTS: +- semanticdiff-com[bot]: Review changes with  SemanticDiff +
+Changed Files +
+ +| File | Status | +| :--- | :--- | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9007/changes#crates/router/src/core/payment_link/locale.js)  [crates/router/src/core/payment\_link/locale\.js](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9007/changes#crates/router/src/core/payment_link/locale.js) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9007/changes#crates/router/src/core/payment_link/locale.js)  0% smaller | + +
+ +=== COMMIT === +SUBJECT: feat(payment-link): update traditional chinese paymentlink exp msg (#9007) + +=== FILES === +Summary: 1 files changed, +2 -2 +- crates/router/src/core/payment_link/locale.js (+2 -2) + +=== PATCH === +diff --git a/crates/router/src/core/payment_link/locale.js b/crates/router/src/core/payment_link/locale.js +index e07285a1..1b2d5c41 100644 +--- a/crates/router/src/core/payment_link/locale.js ++++ b/crates/router/src/core/payment_link/locale.js +@@ -586,7 +586,7 @@ const locales = { + }, + zh_hant: { + expiresOn: "連結到期日期:", +- refId: "參考編號", ++ refId: "參考編號:", + requestedBy: "請求者 ", + payNow: "立即付款", + addPaymentMethod: "新增付款方式", +@@ -600,7 +600,7 @@ const locales = { + paymentTakingLonger: "抱歉!您的付款處理時間比預期長。請稍後再查看。", + paymentLinkExpired: "付款連結已過期", + paymentReceived: "我們已成功收到您的付款", +- paymentLinkExpiredMessage: "抱歉,此支付链接已过期。 请使用以下参考进行进一步调查。", ++ paymentLinkExpiredMessage: "抱歉,此付款連結已過期。
請使用以下參考進行進一步調查。", + paidSuccessfully: "付款成功", + paymentPending: "付款待處理", + paymentFailed: "付款失敗!", + +----- END CHUNK ----- \ No newline at end of file diff --git a/raw/aa/aaf5ea9886cd11222ee2eced21e098182c0388ac.txt b/raw/aa/aaf5ea9886cd11222ee2eced21e098182c0388ac.txt new file mode 100644 index 0000000000000000000000000000000000000000..83b4269469d0609c8a81bb0e84d5624a70351712 --- /dev/null +++ b/raw/aa/aaf5ea9886cd11222ee2eced21e098182c0388ac.txt @@ -0,0 +1,215 @@ +ROUTE: juspay/hyperswitch@aaf5ea9886cd11222ee2eced21e098182c0388ac +REPO: https://github.com/juspay/hyperswitch +COMMIT: aaf5ea9886cd11222ee2eced21e098182c0388ac +AUTHOR: Mrudul Vajpayee <124863642+mrudulvajpayee4935@users.noreply.github.com> +DATE: 2025-08-26T16:13:12 + +=== ISSUE_AND_PR === +[PR #9064] feat(payment-link): handle locale in payment links +URL: https://github.com/juspay/hyperswitch/pull/9064 +BODY: +## Type of Change + + +- [x] Bugfix +- [ ] New feature +- [ ] Enhancement +- [ ] Refactoring +- [ ] Dependency updates +- [ ] Documentation +- [ ] CI/CD + +## Description + +Change Underscore(_) to hyphen(-) in payment link locale according to ISO standards. + +### Additional Changes + +- [x] This PR modifies the API contract +- [ ] This PR modifies the database schema +- [ ] This PR modifies application configuration/environment variables + + + + +## Motivation and Context + +We need to follow ISO standards when accepting the locale for payment links. + + +## How did you test it? + +``` +curl --location 'http://localhost:8080/payments' \ +--header 'Content-Type: application/json' \ +--header 'Accept: application/json' \ +--header 'api-key: **' \ +--header 'Accept-Language: zh-hant' \ +--data '{ + "amount": 10, + "setup_future_usage": "off_session", + "currency": "EUR", + "payment_link": true, + "session_expiry": 60, + "return_url": "https://google.com", + "payment_link_config": { + "theme": "#14356f", + "logo": "https://logo.com/wp-content/uploads/2020/08/zurich.svg", + "seller_name": "Zurich Inc." + } +}' +``` +``` +zh-hant - should see traditional chinese +zh_hant - english +zh-hant-abcdef - traditional chinese +zh - simplified chinese +Zh - simplified chinese +ZH-HANT - traditional chinese +zh-abcdef - simplified chinese +``` +image +image +image + + +## Checklist + + +- [x] I formatted the code `cargo +nightly fmt --all` +- [x] I addressed lints thrown by `cargo clippy` +- [ ] I reviewed the submitted code +- [ ] I added unit tests for my changes where possible +COMMENTS: +- semanticdiff-com[bot]: Review changes with  SemanticDiff +
+Changed Files +
+ +| File | Status | +| :--- | :--- | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9064/changes#crates/router/src/core/payment_link/locale.js)  [crates/router/src/core/payment\_link/locale\.js](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9064/changes#crates/router/src/core/payment_link/locale.js) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9064/changes#crates/router/src/core/payment_link/locale.js)  59% smaller | + +
+- kashif-m [crates/router/src/services/api/generic_link_response/context.rs:20]: Don't change it here bro, this is used for reading the file names under router/locales - https://github.com/juspay/hyperswitch/tree/main/crates/router/locales + +=== COMMIT === +SUBJECT: feat(payment-link): handle locale in payment links (#9064) + +=== FILES === +Summary: 1 files changed, +10 -12 +- crates/router/src/core/payment_link/locale.js (+10 -12) + +=== PATCH === +diff --git a/crates/router/src/core/payment_link/locale.js b/crates/router/src/core/payment_link/locale.js +index 1b2d5c41..46103ea9 100644 +--- a/crates/router/src/core/payment_link/locale.js ++++ b/crates/router/src/core/payment_link/locale.js +@@ -3,11 +3,11 @@ The languages supported by locale.js are: + 1) English (en) + 2) Hebrew (he) + 3) French (fr) +- 4) British English (en_gb) ++ 4) British English (en-gb) + 5) Arabic (ar) + 6) Japanese (ja) + 7) German (de) +- 8) Belgian French (fr_be) ++ 8) Belgian French (fr-be) + 9) Spanish (es) + 10) Catalan (ca) + 11) Portuguese (pt) +@@ -17,7 +17,7 @@ The languages supported by locale.js are: + 15) Swedish (sv) + 16) Russian (ru) + 17) Chinese (zh) +- 19) Traditional Chinese (zh_hant) ++ 19) Traditional Chinese (zh-hant) + */ + const locales = { + en: { +@@ -119,7 +119,7 @@ const locales = { + errorCode: "Code d'erreur", + errorMessage: "Message d'erreur" + }, +- en_gb: { ++ "en-gb": { + expiresOn: "Link expires on: ", + refId: "Ref Id: ", + requestedBy: "Requested by ", +@@ -151,7 +151,6 @@ const locales = { + notAllowed: "You are not allowed to view this content.", + errorCode: "Error code", + errorMessage: "Error Message" +- + }, + ar: { + expiresOn: "الرابط ينتهي في: ", +@@ -252,7 +251,7 @@ const locales = { + errorCode: "Fehlercode", + errorMessage: "Fehlermeldung" + }, +- fr_be: { ++ "fr-be": { + expiresOn: "Le lien expire le: ", + refId: "ID de référence: ", + requestedBy: "Demandé par ", +@@ -284,7 +283,6 @@ const locales = { + notAllowed: "Vous n'êtes pas autorisé à voir ce contenu.", + errorCode: "Code d'erreur", + errorMessage: "Message d'erreur" +- + }, + es: { + expiresOn: "El enlace expira el: ", +@@ -384,7 +382,6 @@ const locales = { + notAllowed: "Você não tem permissão para ver este conteúdo.", + errorCode: "Código de erro", + errorMessage: "Mensagem de erro" +- + }, + it: { + expiresOn: "Link scade il: ", +@@ -584,7 +581,7 @@ const locales = { + errorCode: "错误代码", + errorMessage: "错误信息" + }, +- zh_hant: { ++ "zh-hant": { + expiresOn: "連結到期日期:", + refId: "參考編號:", + requestedBy: "請求者 ", +@@ -628,10 +625,11 @@ function getLanguage(localeStr) { + var language = parts[0]; + var country = parts.length > 1 ? parts[1] : null; + +- var key = `${language}_${country}`; ++ var key = language + '-' + country; + switch (key) { +- case 'en_gb': return 'en_gb'; +- case 'fr_be': return 'fr_be'; ++ case 'en-gb': return 'en-gb'; ++ case 'fr-be': return 'fr-be'; ++ case 'zh-hant': return 'zh-hant'; + default: return language; + } + } + +----- END CHUNK ----- \ No newline at end of file diff --git a/raw/ad/ad05dc4176114dad3420a78af238d3842160e464.txt b/raw/ad/ad05dc4176114dad3420a78af238d3842160e464.txt new file mode 100644 index 0000000000000000000000000000000000000000..75e0005cac632c1a9af1a348a8f50573dd5febe3 --- /dev/null +++ b/raw/ad/ad05dc4176114dad3420a78af238d3842160e464.txt @@ -0,0 +1,1619 @@ +ROUTE: juspay/hyperswitch@ad05dc4176114dad3420a78af238d3842160e464 +REPO: https://github.com/juspay/hyperswitch +COMMIT: ad05dc4176114dad3420a78af238d3842160e464 +AUTHOR: Shankar Singh C <83439957+ShankarSinghC@users.noreply.github.com> +DATE: 2025-08-22T13:46:19 + +=== ISSUE_AND_PR === +[PR #9033] feat(router): add support to use signature_network and is_issuer_regulated as filters +URL: https://github.com/juspay/hyperswitch/pull/9033 +BODY: +## Type of Change + + +- [ ] Bugfix +- [x] New feature +- [ ] Enhancement +- [ ] Refactoring +- [ ] Dependency updates +- [ ] Documentation +- [ ] CI/CD + +## Description + +This pull request extends the analytics system to support two new payment attributes: `signature_network` and `is_issuer_regulated`, and introduces a new field, `is_debit_routed`, across the payments analytics pipeline. The changes ensure these fields are included in all relevant data structures, filters, and metric calculations, and are properly handled in query construction and result aggregation. + +**Query and grouping logic updates:** + +* Updated all relevant metric and distribution queries to include the new fields in both selection and grouping, ensuring these attributes are available in analytics results. +* Removed redundant or now-unnecessary select and group-by clauses for `signature_network` and `is_issuer_regulated` in the debit routing metrics query, as these are now handled more generically. + +These changes ensure that the analytics system can now report, filter, and aggregate on `signature_network`, `is_issuer_regulated`, and `is_debit_routed` across all relevant metrics and reports. + +### Additional Changes + +- [ ] This PR modifies the API contract +- [ ] This PR modifies the database schema +- [ ] This PR modifies application configuration/environment variables + + + + +## Motivation and Context + + + +## How did you test it? + +-> Enable debit routing for a profile and make some payments +-> metrics +``` +curl --location 'http://localhost:8080/analytics/v1/org/metrics/payments' \ +--header 'Content-Type: application/json' \ +--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiZGUyNjAxOWEtOGQwMS00ZDhmLThkYjQtM2EwMWRmOTAyMDk5IiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzU1ODYwMDk1Iiwicm9sZV9pZCI6Im9yZ19hZG1pbiIsImV4cCI6MTc1NjAzMjkyNSwib3JnX2lkIjoib3JnX3dsellTVzh1NElQanpDaGwyRVgwIiwicHJvZmlsZV9pZCI6InByb19lRzVmTHZjeEx1eXl0eDY1YnlIbSIsInRlbmFudF9pZCI6InB1YmxpYyJ9.uQI08_0OEWPlixxBxu0x3GzLxmsFLwX6UIq56ZImhEk' \ +--data '[ + { + "timeRange": { + "startTime": "2025-08-01T18:30:00Z", + "endTime": "2025-09-30T09:22:00Z" + }, + "filters": { + "routing_approach": [ + "debit_routing" + ], + "is_debit_routed": [true] + }, + "source": "BATCH", + "metrics": [ + "debit_routing" + ], + "delta": true + } +]' +``` +``` +{ + "queryData": [ + { + "payment_success_rate": null, + "payment_count": null, + "payment_success_count": null, + "payment_processed_amount": 0, + "payment_processed_amount_in_usd": null, + "payment_processed_count": null, + "payment_processed_amount_without_smart_retries": 0, + "payment_processed_amount_without_smart_retries_usd": null, + "payment_processed_count_without_smart_retries": null, + "avg_ticket_size": null, + "payment_error_message": null, + "retries_count": null, + "retries_amount_processed": 0, + "connector_success_rate": null, + "payments_success_rate_distribution": null, + "payments_success_rate_distribution_without_smart_retries": null, + "payments_success_rate_distribution_with_only_retries": null, + "payments_failure_rate_distribution": null, + "payments_failure_rate_distribution_without_smart_retries": null, + "payments_failure_rate_distribution_with_only_retries": null, + "failure_reason_count": 0, + "failure_reason_count_without_smart_retries": 0, + "debit_routed_transaction_count": 4, + "debit_routing_savings": 14, + "debit_routing_savings_in_usd": null, + "currency": "USD", + "status": null, + "connector": null, + "authentication_type": null, + "payment_method": null, + "payment_method_type": null, + "client_source": null, + "client_version": null, + "profile_id": null, + "card_network": null, + "merchant_id": null, + "card_last_4": null, + "card_issuer": null, + "error_reason": null, + "routing_approach": null, + "signature_network": null, + "is_issuer_regulated": null, + "is_debit_routed": null, + "time_range": { + "start_time": "2025-08-01T18:30:00.000Z", + "end_time": "2025-09-30T09:22:00.000Z" + }, + "time_bucket": "2025-08-01 18:30:00" + } + ], + "metaData": [ + { + "total_payment_processed_amount": 0, + "total_payment_processed_amount_in_usd": null, + "total_payment_processed_amount_without_smart_retries": 0, + "total_payment_processed_amount_without_smart_retries_usd": null, + "total_payment_processed_count": 0, + "total_payment_processed_count_without_smart_retries": 0, + "total_failure_reasons_count": 0, + "total_failure_reasons_count_without_smart_retries": 0 + } + ] +} +``` +-> case 2 +``` +curl --location 'http://localhost:8080/analytics/v1/org/metrics/payments' \ +--header 'Content-Type: application/json' \ +--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiZGUyNjAxOWEtOGQwMS00ZDhmLThkYjQtM2EwMWRmOTAyMDk5IiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzU1ODYwMDk1Iiwicm9sZV9pZCI6Im9yZ19hZG1pbiIsImV4cCI6MTc1NjAzMjkyNSwib3JnX2lkIjoib3JnX3dsellTVzh1NElQanpDaGwyRVgwIiwicHJvZmlsZV9pZCI6InByb19lRzVmTHZjeEx1eXl0eDY1YnlIbSIsInRlbmFudF9pZCI6InB1YmxpYyJ9.uQI08_0OEWPlixxBxu0x3GzLxmsFLwX6UIq56ZImhEk' \ +--data '[ + { + "timeRange": { + "startTime": "2025-08-01T18:30:00Z", + "endTime": "2025-09-30T09:22:00Z" + }, + "groupByNames": [ + + + "is_issuer_regulated" + + ], + "filters": { + "routing_approach": [ + "debit_routing" + ], + "is_debit_routed": [true] + }, + "source": "BATCH", + "metrics": [ + "debit_routing" + ], + "delta": true + } +]' +``` +``` +{ + "queryData": [ + { + "payment_success_rate": null, + "payment_count": null, + "payment_success_count": null, + "payment_processed_amount": 0, + "payment_processed_amount_in_usd": null, + "payment_processed_count": null, + "payment_processed_amount_without_smart_retries": 0, + "payment_processed_amount_without_smart_retries_usd": null, + "payment_processed_count_without_smart_retries": null, + "avg_ticket_size": null, + "payment_error_message": null, + "retries_count": null, + "retries_amount_processed": 0, + "connector_success_rate": null, + "payments_success_rate_distribution": null, + "payments_success_rate_distribution_without_smart_retries": null, + "payments_success_rate_distribution_with_only_retries": null, + "payments_failure_rate_distribution": null, + "payments_failure_rate_distribution_without_smart_retries": null, + "payments_failure_rate_distribution_with_only_retries": null, + "failure_reason_count": 0, + "failure_reason_count_without_smart_retries": 0, + "debit_routed_transaction_count": 3, + "debit_routing_savings": 3, + "debit_routing_savings_in_usd": null, + "currency": "USD", + "status": null, + "connector": null, + "authentication_type": null, + "payment_method": null, + "payment_method_type": null, + "client_source": null, + "client_version": null, + "profile_id": null, + "card_network": null, + "merchant_id": null, + "card_last_4": null, + "card_issuer": null, + "error_reason": null, + "routing_approach": null, + "signature_network": null, + "is_issuer_regulated": true, + "is_debit_routed": null, + "time_range": { + "start_time": "2025-08-01T18:30:00.000Z", + "end_time": "2025-09-30T09:22:00.000Z" + }, + "time_bucket": "2025-08-01 18:30:00" + }, + { + "payment_success_rate": null, + "payment_count": null, + "payment_success_count": null, + "payment_processed_amount": 0, + "payment_processed_amount_in_usd": null, + "payment_processed_count": null, + "payment_processed_amount_without_smart_retries": 0, + "payment_processed_amount_without_smart_retries_usd": null, + "payment_processed_count_without_smart_retries": null, + "avg_ticket_size": null, + "payment_error_message": null, + "retries_count": null, + "retries_amount_processed": 0, + "connector_success_rate": null, + "payments_success_rate_distribution": null, + "payments_success_rate_distribution_without_smart_retries": null, + "payments_success_rate_distribution_with_only_retries": null, + "payments_failure_rate_distribution": null, + "payments_failure_rate_distribution_without_smart_retries": null, + "payments_failure_rate_distribution_with_only_retries": null, + "failure_reason_count": 0, + "failure_reason_count_without_smart_retries": 0, + "debit_routed_transaction_count": 1, + "debit_routing_savings": 11, + "debit_routing_savings_in_usd": null, + "currency": "USD", + "status": null, + "connector": null, + "authentication_type": null, + "payment_method": null, + "payment_method_type": null, + "client_source": null, + "client_version": null, + "profile_id": null, + "card_network": null, + "merchant_id": null, + "card_last_4": null, + "card_issuer": null, + "error_reason": null, + "routing_approach": null, + "signature_network": null, + "is_issuer_regulated": false, + "is_debit_routed": null, + "time_range": { + "start_time": "2025-08-01T18:30:00.000Z", + "end_time": "2025-09-30T09:22:00.000Z" + }, + "time_bucket": "2025-08-01 18:30:00" + } + ], + "metaData": [ + { + "total_payment_processed_amount": 0, + "total_payment_processed_amount_in_usd": null, + "total_payment_processed_amount_without_smart_retries": 0, + "total_payment_processed_amount_without_smart_retries_usd": null, + "total_payment_processed_count": 0, + "total_payment_processed_count_without_smart_retries": 0, + "total_failure_reasons_count": 0, + "total_failure_reasons_count_without_smart_retries": 0 + } + ] +} +``` +-> Case 3 +``` +curl --location 'http://localhost:8080/analytics/v1/org/metrics/payments' \ +--header 'Content-Type: application/json' \ +--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiZGUyNjAxOWEtOGQwMS00ZDhmLThkYjQtM2EwMWRmOTAyMDk5IiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzU1ODYwMDk1Iiwicm9sZV9pZCI6Im9yZ19hZG1pbiIsImV4cCI6MTc1NjAzMjkyNSwib3JnX2lkIjoib3JnX3dsellTVzh1NElQanpDaGwyRVgwIiwicHJvZmlsZV9pZCI6InByb19lRzVmTHZjeEx1eXl0eDY1YnlIbSIsInRlbmFudF9pZCI6InB1YmxpYyJ9.uQI08_0OEWPlixxBxu0x3GzLxmsFLwX6UIq56ZImhEk' \ +--data '[ + { + "timeRange": { + "startTime": "2025-08-01T18:30:00Z", + "endTime": "2025-09-30T09:22:00Z" + }, + "groupByNames": [ + "card_network" + + + + ], + "filters": { + "routing_approach": [ + "debit_routing" + ], + "is_debit_routed": [true] + }, + "source": "BATCH", + "metrics": [ + "debit_routing" + ], + "delta": true + } +]' +``` +``` +{ + "queryData": [ + { + "payment_success_rate": null, + "payment_count": null, + "payment_success_count": null, + "payment_processed_amount": 0, + "payment_processed_amount_in_usd": null, + "payment_processed_count": null, + "payment_processed_amount_without_smart_retries": 0, + "payment_processed_amount_without_smart_retries_usd": null, + "payment_processed_count_without_smart_retries": null, + "avg_ticket_size": null, + "payment_error_message": null, + "retries_count": null, + "retries_amount_processed": 0, + "connector_success_rate": null, + "payments_success_rate_distribution": null, + "payments_success_rate_distribution_without_smart_retries": null, + "payments_success_rate_distribution_with_only_retries": null, + "payments_failure_rate_distribution": null, + "payments_failure_rate_distribution_without_smart_retries": null, + "payments_failure_rate_distribution_with_only_retries": null, + "failure_reason_count": 0, + "failure_reason_count_without_smart_retries": 0, + "debit_routed_transaction_count": 3, + "debit_routing_savings": 3, + "debit_routing_savings_in_usd": null, + "currency": "USD", + "status": null, + "connector": null, + "authentication_type": null, + "payment_method": null, + "payment_method_type": null, + "client_source": null, + "client_version": null, + "profile_id": null, + "card_network": "Star", + "merchant_id": null, + "card_last_4": null, + "card_issuer": null, + "error_reason": null, + "routing_approach": null, + "signature_network": null, + "is_issuer_regulated": null, + "is_debit_routed": null, + "time_range": { + "start_time": "2025-08-01T18:30:00.000Z", + "end_time": "2025-09-30T09:22:00.000Z" + }, + "time_bucket": "2025-08-01 18:30:00" + }, + { + "payment_success_rate": null, + "payment_count": null, + "payment_success_count": null, + "payment_processed_amount": 0, + "payment_processed_amount_in_usd": null, + "payment_processed_count": null, + "payment_processed_amount_without_smart_retries": 0, + "payment_processed_amount_without_smart_retries_usd": null, + "payment_processed_count_without_smart_retries": null, + "avg_ticket_size": null, + "payment_error_message": null, + "retries_count": null, + "retries_amount_processed": 0, + "connector_success_rate": null, + "payments_success_rate_distribution": null, + "payments_success_rate_distribution_without_smart_retries": null, + "payments_success_rate_distribution_with_only_retries": null, + "payments_failure_rate_distribution": null, + "payments_failure_rate_distribution_without_smart_retries": null, + "payments_failure_rate_distribution_with_only_retries": null, + "failure_reason_count": 0, + "failure_reason_count_without_smart_retries": 0, + "debit_routed_transaction_count": 1, + "debit_routing_savings": 11, + "debit_routing_savings_in_usd": null, + "currency": "USD", + "status": null, + "connector": null, + "authentication_type": null, + "payment_method": null, + "payment_method_type": null, + "client_source": null, + "client_version": null, + "profile_id": null, + "card_network": "Accel", + "merchant_id": null, + "card_last_4": null, + "card_issuer": null, + "error_reason": null, + "routing_approach": null, + "signature_network": null, + "is_issuer_regulated": null, + "is_debit_routed": null, + "time_range": { + "start_time": "2025-08-01T18:30:00.000Z", + "end_time": "2025-09-30T09:22:00.000Z" + }, + "time_bucket": "2025-08-01 18:30:00" + } + ], + "metaData": [ + { + "total_payment_processed_amount": 0, + "total_payment_processed_amount_in_usd": null, + "total_payment_processed_amount_without_smart_retries": 0, + "total_payment_processed_amount_without_smart_retries_usd": null, + "total_payment_processed_count": 0, + "total_payment_processed_count_without_smart_retries": 0, + "total_failure_reasons_count": 0, + "total_failure_reasons_count_without_smart_retries": 0 + } + ] +} +``` +-> case 4 +``` +curl --location 'http://localhost:8080/analytics/v1/org/metrics/payments' \ +--header 'Content-Type: application/json' \ +--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiZGUyNjAxOWEtOGQwMS00ZDhmLThkYjQtM2EwMWRmOTAyMDk5IiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzU1ODYwMDk1Iiwicm9sZV9pZCI6Im9yZ19hZG1pbiIsImV4cCI6MTc1NjAzMjkyNSwib3JnX2lkIjoib3JnX3dsellTVzh1NElQanpDaGwyRVgwIiwicHJvZmlsZV9pZCI6InByb19lRzVmTHZjeEx1eXl0eDY1YnlIbSIsInRlbmFudF9pZCI6InB1YmxpYyJ9.uQI08_0OEWPlixxBxu0x3GzLxmsFLwX6UIq56ZImhEk' \ +--data '[ + { + "timeRange": { + "startTime": "2025-08-01T18:30:00Z", + "endTime": "2025-09-30T09:22:00Z" + }, + "groupByNames": [ + "card_network", + "is_issuer_regulated", + "signature_network" + ], + "filters": { + "routing_approach": [ + "debit_routing" + ], + "is_debit_routed": [true] + }, + "source": "BATCH", + "metrics": [ + "debit_routing" + ], + "delta": true + } +]' +``` +``` +{ + "queryData": [ + { + "payment_success_rate": null, + "payment_count": null, + "payment_success_count": null, + "payment_processed_amount": 0, + "payment_processed_amount_in_usd": null, + "payment_processed_count": null, + "payment_processed_amount_without_smart_retries": 0, + "payment_processed_amount_without_smart_retries_usd": null, + "payment_processed_count_without_smart_retries": null, + "avg_ticket_size": null, + "payment_error_message": null, + "retries_count": null, + "retries_amount_processed": 0, + "connector_success_rate": null, + "payments_success_rate_distribution": null, + "payments_success_rate_distribution_without_smart_retries": null, + "payments_success_rate_distribution_with_only_retries": null, + "payments_failure_rate_distribution": null, + "payments_failure_rate_distribution_without_smart_retries": null, + "payments_failure_rate_distribution_with_only_retries": null, + "failure_reason_count": 0, + "failure_reason_count_without_smart_retries": 0, + "debit_routed_transaction_count": 1, + "debit_routing_savings": 11, + "debit_routing_savings_in_usd": null, + "currency": "USD", + "status": null, + "connector": null, + "authentication_type": null, + "payment_method": null, + "payment_method_type": null, + "client_source": null, + "client_version": null, + "profile_id": null, + "card_network": "Accel", + "merchant_id": null, + "card_last_4": null, + "card_issuer": null, + "error_reason": null, + "routing_approach": null, + "signature_network": "Mastercard", + "is_issuer_regulated": false, + "is_debit_routed": null, + "time_range": { + "start_time": "2025-08-01T18:30:00.000Z", + "end_time": "2025-09-30T09:22:00.000Z" + }, + "time_bucket": "2025-08-01 18:30:00" + }, + { + "payment_success_rate": null, + "payment_count": null, + "payment_success_count": null, + "payment_processed_amount": 0, + "payment_processed_amount_in_usd": null, + "payment_processed_count": null, + "payment_processed_amount_without_smart_retries": 0, + "payment_processed_amount_without_smart_retries_usd": null, + "payment_processed_count_without_smart_retries": null, + "avg_ticket_size": null, + "payment_error_message": null, + "retries_count": null, + "retries_amount_processed": 0, + "connector_success_rate": null, + "payments_success_rate_distribution": null, + "payments_success_rate_distribution_without_smart_retries": null, + "payments_success_rate_distribution_with_only_retries": null, + "payments_failure_rate_distribution": null, + "payments_failure_rate_distribution_without_smart_retries": null, + "payments_failure_rate_distribution_with_only_retries": null, + "failure_reason_count": 0, + "failure_reason_count_without_smart_retries": 0, + "debit_routed_transaction_count": 3, + "debit_routing_savings": 3, + "debit_routing_savings_in_usd": null, + "currency": "USD", + "status": null, + "connector": null, + "authentication_type": null, + "payment_method": null, + "payment_method_type": null, + "client_source": null, + "client_version": null, + "profile_id": null, + "card_network": "Star", + "merchant_id": null, + "card_last_4": null, + "card_issuer": null, + "error_reason": null, + "routing_approach": null, + "signature_network": "Visa", + "is_issuer_regulated": true, + "is_debit_routed": null, + "time_range": { + "start_time": "2025-08-01T18:30:00.000Z", + "end_time": "2025-09-30T09:22:00.000Z" + }, + "time_bucket": "2025-08-01 18:30:00" + } + ], + "metaData": [ + { + "total_payment_processed_amount": 0, + "total_payment_processed_amount_in_usd": null, + "total_payment_processed_amount_without_smart_retries": 0, + "total_payment_processed_amount_without_smart_retries_usd": null, + "total_payment_processed_count": 0, + "total_payment_processed_count_without_smart_retries": 0, + "total_failure_reasons_count": 0, + "total_failure_reasons_count_without_smart_retries": 0 + } + ] +} +``` +-> Case 5 +``` +curl --location 'http://localhost:8080/analytics/v1/org/metrics/payments' \ +--header 'Content-Type: application/json' \ +--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiZGUyNjAxOWEtOGQwMS00ZDhmLThkYjQtM2EwMWRmOTAyMDk5IiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzU1ODYwMDk1Iiwicm9sZV9pZCI6Im9yZ19hZG1pbiIsImV4cCI6MTc1NjAzMjkyNSwib3JnX2lkIjoib3JnX3dsellTVzh1NElQanpDaGwyRVgwIiwicHJvZmlsZV9pZCI6InByb19lRzVmTHZjeEx1eXl0eDY1YnlIbSIsInRlbmFudF9pZCI6InB1YmxpYyJ9.uQI08_0OEWPlixxBxu0x3GzLxmsFLwX6UIq56ZImhEk' \ +--data '[ + { + "timeRange": { + "startTime": "2025-08-01T18:30:00Z", + "endTime": "2025-09-30T09:22:00Z" + }, + + + + + + "timeSeries": { + "granularity": "G_ONEDAY" + }, + "filters": { + "routing_approach": [ + "debit_routing" + ], + "is_debit_routed": [ + true + ] + }, + "source": "BATCH", + "metrics": [ + "debit_routing" + ], + "delta": true + } +]' +``` +``` +{ + "queryData": [ + { + "payment_success_rate": null, + "payment_count": null, + "payment_success_count": null, + "payment_processed_amount": 0, + "payment_processed_amount_in_usd": null, + "payment_processed_count": null, + "payment_processed_amount_without_smart_retries": 0, + "payment_processed_amount_without_smart_retries_usd": null, + "payment_processed_count_without_smart_retries": null, + "avg_ticket_size": null, + "payment_error_message": null, + "retries_count": null, + "retries_amount_processed": 0, + "connector_success_rate": null, + "payments_success_rate_distribution": null, + "payments_success_rate_distribution_without_smart_retries": null, + "payments_success_rate_distribution_with_only_retries": null, + "payments_failure_rate_distribution": null, + "payments_failure_rate_distribution_without_smart_retries": null, + "payments_failure_rate_distribution_with_only_retries": null, + "failure_reason_count": 0, + "failure_reason_count_without_smart_retries": 0, + "debit_routed_transaction_count": 4, + "debit_routing_savings": 14, + "debit_routing_savings_in_usd": null, + "currency": "USD", + "status": null, + "connector": null, + "authentication_type": null, + "payment_method": null, + "payment_method_type": null, + "client_source": null, + "client_version": null, + "profile_id": null, + "card_network": null, + "merchant_id": null, + "card_last_4": null, + "card_issuer": null, + "error_reason": null, + "routing_approach": null, + "signature_network": null, + "is_issuer_regulated": null, + "is_debit_routed": null, + "time_range": { + "start_time": "2025-08-22T00:00:00.000Z", + "end_time": "2025-08-22T23:00:00.000Z" + }, + "time_bucket": "2025-08-22 00:00:00" + } + ], + "metaData": [ + { + "total_payment_processed_amount": 0, + "total_payment_processed_amount_in_usd": null, + "total_payment_processed_amount_without_smart_retries": 0, + "total_payment_processed_amount_without_smart_retries_usd": null, + "total_payment_processed_count": 0, + "total_payment_processed_count_without_smart_retries": 0, + "total_failure_reasons_count": 0, + "total_failure_reasons_count_without_smart_retries": 0 + } + ] +} +``` +-> Case 6 +``` +curl --location 'http://localhost:8080/analytics/v1/org/metrics/payments' \ +--header 'Content-Type: application/json' \ +--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiZGUyNjAxOWEtOGQwMS00ZDhmLThkYjQtM2EwMWRmOTAyMDk5IiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzU1ODYwMDk1Iiwicm9sZV9pZCI6Im9yZ19hZG1pbiIsImV4cCI6MTc1NjAzMjkyNSwib3JnX2lkIjoib3JnX3dsellTVzh1NElQanpDaGwyRVgwIiwicHJvZmlsZV9pZCI6InByb19lRzVmTHZjeEx1eXl0eDY1YnlIbSIsInRlbmFudF9pZCI6InB1YmxpYyJ9.uQI08_0OEWPlixxBxu0x3GzLxmsFLwX6UIq56ZImhEk' \ +--data '[ + { + "timeRange": { + "startTime": "2025-08-01T18:30:00Z", + "endTime": "2025-09-30T09:22:00Z" + }, + "groupByNames": [ + "card_network", + "is_issuer_regulated", + "signature_network" + ], + + + + "filters": { + "routing_approach": [ + "debit_routing" + ], + "is_debit_routed": [ + true + ] + }, + "source": "BATCH", + "metrics": [ + "debit_routing" + ], + "delta": true + } +]' +``` +``` +{ + "queryData": [ + { + "payment_success_rate": null, + "payment_count": null, + "payment_success_count": null, + "payment_processed_amount": 0, + "payment_processed_amount_in_usd": null, + "payment_processed_count": null, + "payment_processed_amount_without_smart_retries": 0, + "payment_processed_amount_without_smart_retries_usd": null, + "payment_processed_count_without_smart_retries": null, + "avg_ticket_size": null, + "payment_error_message": null, + "retries_count": null, + "retries_amount_processed": 0, + "connector_success_rate": null, + "payments_success_rate_distribution": null, + "payments_success_rate_distribution_without_smart_retries": null, + "payments_success_rate_distribution_with_only_retries": null, + "payments_failure_rate_distribution": null, + "payments_failure_rate_distribution_without_smart_retries": null, + "payments_failure_rate_distribution_with_only_retries": null, + "failure_reason_count": 0, + "failure_reason_count_without_smart_retries": 0, + "debit_routed_transaction_count": 2, + "debit_routing_savings": 2, + "debit_routing_savings_in_usd": null, + "currency": "USD", + "status": null, + "connector": null, + "authentication_type": null, + "payment_method": null, + "payment_method_type": null, + "client_source": null, + "client_version": null, + "profile_id": null, + "card_network": "Star", + "merchant_id": null, + "card_last_4": null, + "card_issuer": null, + "error_reason": null, + "routing_approach": null, + "signature_network": "Visa", + "is_issuer_regulated": true, + "is_debit_routed": null, + "time_range": { + "start_time": "2025-08-01T18:30:00.000Z", + "end_time": "2025-09-30T09:22:00.000Z" + }, + "time_bucket": "2025-08-01 18:30:00" + }, + { + "payment_success_rate": null, + "payment_count": null, + "payment_success_count": null, + "payment_processed_amount": 0, + "payment_processed_amount_in_usd": null, + "payment_processed_count": null, + "payment_processed_amount_without_smart_retries": 0, + "payment_processed_amount_without_smart_retries_usd": null, + "payment_processed_count_without_smart_retries": null, + "avg_ticket_size": null, + "payment_error_message": null, + "retries_count": null, + "retries_amount_processed": 0, + "connector_success_rate": null, + "payments_success_rate_distribution": null, + "payments_success_rate_distribution_without_smart_retries": null, + "payments_success_rate_distribution_with_only_retries": null, + "payments_failure_rate_distribution": null, + "payments_failure_rate_distribution_without_smart_retries": null, + "payments_failure_rate_distribution_with_only_retries": null, + "failure_reason_count": 0, + "failure_reason_count_without_smart_retries": 0, + "debit_routed_transaction_count": 1, + "debit_routing_savings": 1, + "debit_routing_savings_in_usd": null, + "currency": "EUR", + "status": null, + "connector": null, + "authentication_type": null, + "payment_method": null, + "payment_method_type": null, + "client_source": null, + "client_version": null, + "profile_id": null, + "card_network": "Star", + "merchant_id": null, + "card_last_4": null, + "card_issuer": null, + "error_reason": null, + "routing_approach": null, + "signature_network": "Visa", + "is_issuer_regulated": true, + "is_debit_routed": null, + "time_range": { + "start_time": "2025-08-01T18:30:00.000Z", + "end_time": "2025-09-30T09:22:00.000Z" + }, + "time_bucket": "2025-08-01 18:30:00" + }, + { + "payment_success_rate": null, + "payment_count": null, + "payment_success_count": null, + "payment_processed_amount": 0, + "payment_processed_amount_in_usd": null, + "payment_processed_count": null, + "payment_processed_amount_without_smart_retries": 0, + "payment_processed_amount_without_smart_retries_usd": null, + "payment_processed_count_without_smart_retries": null, + "avg_ticket_size": null, + "payment_error_message": null, + "retries_count": null, + "retries_amount_processed": 0, + "connector_success_rate": null, + "payments_success_rate_distribution": null, + "payments_success_rate_distribution_without_smart_retries": null, + "payments_success_rate_distribution_with_only_retries": null, + "payments_failure_rate_distribution": null, + "payments_failure_rate_distribution_without_smart_retries": null, + "payments_failure_rate_distribution_with_only_retries": null, + "failure_reason_count": 0, + "failure_reason_count_without_smart_retries": 0, + "debit_routed_transaction_count": 1, + "is_issuer_regulated": false, + "is_debit_routed": null, + "currency": "EUR", + "status": null, + "connector": null, + "authentication_type": null, + "payment_method": null, + "payment_method_type": null, + "client_source": null, + "client_version": null, + "profile_id": null, + "card_network": "Accel", + "merchant_id": null, + "card_last_4": null, + "card_issuer": null, + "error_reason": null, + "routing_approach": null, + "signature_network": "Mastercard", + "is_issuer_regulated": false, + "is_debit_routed": null, + "time_range": { + "start_time": "2025-08-01T18:30:00.000Z", + "end_time": "2025-09-30T09:22:00.000Z" + }, + "time_bucket": "2025-08-01 18:30:00" + } + ], + "metaData": [ + { + "total_payment_processed_amount": 0, + "total_payment_processed_amount_in_usd": null, + "total_payment_processed_amount_without_smart_retries": 0, + "total_payment_processed_amount_without_smart_retries_usd": null, + "total_payment_processed_count": 0, + "total_payment_processed_count_without_smart_retries": 0, + "total_failure_reasons_count": 0, + "total_failure_reasons_count_without_smart_retries": 0 + } + ] +} +``` + + +## Checklist + + +- [x] I formatted the code `cargo +nightly fmt --all` +- [x] I addressed lints thrown by `cargo clippy` +- [x] I reviewed the submitted code +- [ ] I added unit tests for my changes where possible +COMMENTS: +- semanticdiff-com[bot]: Review changes with  SemanticDiff +
+Changed Files +
+ +| File | Status | +| :--- | :--- | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/accumulator.rs)  [crates/analytics/src/payments/accumulator\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/accumulator.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/accumulator.rs)  45% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/api_models/src/analytics/payments.rs)  [crates/api\_models/src/analytics/payments\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/api_models/src/analytics/payments.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/api_models/src/analytics/payments.rs)  9% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/core.rs)  [crates/analytics/src/payments/core\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/core.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/core.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/distribution.rs)  [crates/analytics/src/payments/distribution\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/distribution.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/distribution.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/distribution/payment_error_message.rs)  [crates/analytics/src/payments/distribution/payment\_error\_message\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/distribution/payment_error_message.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/distribution/payment_error_message.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/filters.rs)  [crates/analytics/src/payments/filters\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/filters.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/filters.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/metrics.rs)  [crates/analytics/src/payments/metrics\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/metrics.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/metrics.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/metrics/avg_ticket_size.rs)  [crates/analytics/src/payments/metrics/avg\_ticket\_size\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/metrics/avg_ticket_size.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/metrics/avg_ticket_size.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/metrics/connector_success_rate.rs)  [crates/analytics/src/payments/metrics/connector\_success\_rate\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/metrics/connector_success_rate.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/metrics/connector_success_rate.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/metrics/debit_routing.rs)  [crates/analytics/src/payments/metrics/debit\_routing\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/metrics/debit_routing.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/metrics/debit_routing.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/metrics/payment_count.rs)  [crates/analytics/src/payments/metrics/payment\_count\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/metrics/payment_count.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/metrics/payment_count.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/metrics/payment_processed_amount.rs)  [crates/analytics/src/payments/metrics/payment\_processed\_amount\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/metrics/payment_processed_amount.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/metrics/payment_processed_amount.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/metrics/payment_success_count.rs)  [crates/analytics/src/payments/metrics/payment\_success\_count\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/metrics/payment_success_count.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/metrics/payment_success_count.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/metrics/retries_count.rs)  [crates/analytics/src/payments/metrics/retries\_count\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/metrics/retries_count.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/metrics/retries_count.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/metrics/sessionized_metrics/avg_ticket_size.rs)  [crates/analytics/src/payments/metrics/sessionized\_metrics/avg\_ticket\_size\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/metrics/sessionized_metrics/avg_ticket_size.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/metrics/sessionized_metrics/avg_ticket_size.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/metrics/sessionized_metrics/connector_success_rate.rs)  [crates/analytics/src/payments/metrics/sessionized\_metrics/connector\_success\_rate\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/metrics/sessionized_metrics/connector_success_rate.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/metrics/sessionized_metrics/connector_success_rate.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/metrics/sessionized_metrics/debit_routing.rs)  [crates/analytics/src/payments/metrics/sessionized\_metrics/debit\_routing\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/metrics/sessionized_metrics/debit_routing.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/metrics/sessionized_metrics/debit_routing.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/metrics/sessionized_metrics/failure_reasons.rs)  [crates/analytics/src/payments/metrics/sessionized\_metrics/failure\_reasons\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/metrics/sessionized_metrics/failure_reasons.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/metrics/sessionized_metrics/failure_reasons.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/metrics/sessionized_metrics/payment_count.rs)  [crates/analytics/src/payments/metrics/sessionized\_metrics/payment\_count\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/metrics/sessionized_metrics/payment_count.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/metrics/sessionized_metrics/payment_count.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/metrics/sessionized_metrics/payment_processed_amount.rs)  [crates/analytics/src/payments/metrics/sessionized\_metrics/payment\_processed\_amount\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/metrics/sessionized_metrics/payment_processed_amount.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/metrics/sessionized_metrics/payment_processed_amount.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/metrics/sessionized_metrics/payment_success_count.rs)  [crates/analytics/src/payments/metrics/sessionized\_metrics/payment\_success\_count\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/metrics/sessionized_metrics/payment_success_count.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/metrics/sessionized_metrics/payment_success_count.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/metrics/sessionized_metrics/payments_distribution.rs)  [crates/analytics/src/payments/metrics/sessionized\_metrics/payments\_distribution\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/metrics/sessionized_metrics/payments_distribution.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/metrics/sessionized_metrics/payments_distribution.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/metrics/sessionized_metrics/retries_count.rs)  [crates/analytics/src/payments/metrics/sessionized\_metrics/retries\_count\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/metrics/sessionized_metrics/retries_count.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/metrics/sessionized_metrics/retries_count.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/metrics/sessionized_metrics/success_rate.rs)  [crates/analytics/src/payments/metrics/sessionized\_metrics/success\_rate\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/metrics/sessionized_metrics/success_rate.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/metrics/sessionized_metrics/success_rate.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/metrics/success_rate.rs)  [crates/analytics/src/payments/metrics/success\_rate\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/metrics/success_rate.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/metrics/success_rate.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/types.rs)  [crates/analytics/src/payments/types\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/types.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/payments/types.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/sqlx.rs)  [crates/analytics/src/sqlx\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/sqlx.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9033/changes#crates/analytics/src/sqlx.rs)  0% smaller | + +
+ +=== COMMIT === +SUBJECT: feat(router): add support to use signature_network and is_issuer_regulated as filters (#9033) +BODY: +Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> + +=== FILES === +Summary: 27 files changed, +158 -45 +- crates/analytics/src/payments/accumulator.rs (+3 -26) +- crates/analytics/src/payments/core.rs (+3 -0) +- crates/analytics/src/payments/distribution.rs (+3 -0) +- crates/analytics/src/payments/distribution/payment_error_message.rs (+3 -0) +- crates/analytics/src/payments/filters.rs (+3 -0) +- crates/analytics/src/payments/metrics.rs (+1 -0) +- crates/analytics/src/payments/metrics/avg_ticket_size.rs (+3 -0) +- crates/analytics/src/payments/metrics/connector_success_rate.rs (+3 -0) +- crates/analytics/src/payments/metrics/debit_routing.rs (+3 -17) +- crates/analytics/src/payments/metrics/payment_count.rs (+3 -0) +- crates/analytics/src/payments/metrics/payment_processed_amount.rs (+3 -0) +- crates/analytics/src/payments/metrics/payment_success_count.rs (+3 -0) +- crates/analytics/src/payments/metrics/retries_count.rs (+3 -0) +- crates/analytics/src/payments/metrics/sessionized_metrics/avg_ticket_size.rs (+3 -0) +- crates/analytics/src/payments/metrics/sessionized_metrics/connector_success_rate.rs (+3 -0) +- crates/analytics/src/payments/metrics/sessionized_metrics/debit_routing.rs (+3 -0) +- crates/analytics/src/payments/metrics/sessionized_metrics/failure_reasons.rs (+3 -0) +- crates/analytics/src/payments/metrics/sessionized_metrics/payment_count.rs (+3 -0) +- crates/analytics/src/payments/metrics/sessionized_metrics/payment_processed_amount.rs (+3 -0) +- crates/analytics/src/payments/metrics/sessionized_metrics/payment_success_count.rs (+3 -0) +- crates/analytics/src/payments/metrics/sessionized_metrics/payments_distribution.rs (+3 -0) +- crates/analytics/src/payments/metrics/sessionized_metrics/retries_count.rs (+3 -0) +- crates/analytics/src/payments/metrics/sessionized_metrics/success_rate.rs (+3 -0) +- crates/analytics/src/payments/metrics/success_rate.rs (+3 -0) +- crates/analytics/src/payments/types.rs (+24 -0) +- crates/analytics/src/sqlx.rs (+43 -0) +- crates/api_models/src/analytics/payments.rs (+21 -2) + +=== PATCH === +diff --git a/crates/analytics/src/payments/accumulator.rs b/crates/analytics/src/payments/accumulator.rs +index a266e136..6d7dca22 100644 +--- a/crates/analytics/src/payments/accumulator.rs ++++ b/crates/analytics/src/payments/accumulator.rs +@@ -63,8 +63,6 @@ pub struct ProcessedAmountAccumulator { + pub struct DebitRoutingAccumulator { + pub transaction_count: u64, + pub savings_amount: u64, +- pub signature_network: Option, +- pub is_issuer_regulated: Option, + } + + #[derive(Debug, Default)] +@@ -193,13 +191,7 @@ impl PaymentMetricAccumulator for SuccessRateAccumulator { + } + + impl PaymentMetricAccumulator for DebitRoutingAccumulator { +- type MetricOutput = ( +- Option, +- Option, +- Option, +- Option, +- Option, +- ); ++ type MetricOutput = (Option, Option, Option); + + fn add_metrics_bucket(&mut self, metrics: &PaymentMetricRow) { + if let Some(count) = metrics.count { +@@ -208,12 +200,6 @@ impl PaymentMetricAccumulator for DebitRoutingAccumulator { + if let Some(total) = metrics.total.as_ref().and_then(ToPrimitive::to_u64) { + self.savings_amount += total; + } +- if let Some(signature_network) = &metrics.signature_network { +- self.signature_network = Some(signature_network.clone()); +- } +- if let Some(is_issuer_regulated) = metrics.is_issuer_regulated { +- self.is_issuer_regulated = Some(is_issuer_regulated); +- } + } + + fn collect(self) -> Self::MetricOutput { +@@ -221,8 +207,6 @@ impl PaymentMetricAccumulator for DebitRoutingAccumulator { + Some(self.transaction_count), + Some(self.savings_amount), + Some(0), +- self.signature_network, +- self.is_issuer_regulated, + ) + } + } +@@ -484,13 +468,8 @@ impl PaymentMetricsAccumulator { + ) = self.payments_distribution.collect(); + let (failure_reason_count, failure_reason_count_without_smart_retries) = + self.failure_reasons_distribution.collect(); +- let ( +- debit_routed_transaction_count, +- debit_routing_savings, +- debit_routing_savings_in_usd, +- signature_network, +- is_issuer_regulated, +- ) = self.debit_routing.collect(); ++ let (debit_routed_transaction_count, debit_routing_savings, debit_routing_savings_in_usd) = ++ self.debit_routing.collect(); + + PaymentMetricsBucketValue { + payment_success_rate: self.payment_success_rate.collect(), +@@ -518,8 +497,6 @@ impl PaymentMetricsAccumulator { + debit_routed_transaction_count, + debit_routing_savings, + debit_routing_savings_in_usd, +- signature_network, +- is_issuer_regulated, + } + } + } +diff --git a/crates/analytics/src/payments/core.rs b/crates/analytics/src/payments/core.rs +index c1922ffe..f9746a2e 100644 +--- a/crates/analytics/src/payments/core.rs ++++ b/crates/analytics/src/payments/core.rs +@@ -441,6 +441,9 @@ pub async fn get_filters( + PaymentDimensions::CardIssuer => fil.card_issuer, + PaymentDimensions::ErrorReason => fil.error_reason, + PaymentDimensions::RoutingApproach => fil.routing_approach.map(|i| i.as_ref().to_string()), ++ PaymentDimensions::SignatureNetwork => fil.signature_network, ++ PaymentDimensions::IsIssuerRegulated => fil.is_issuer_regulated.map(|b| b.to_string()), ++ PaymentDimensions::IsDebitRouted => fil.is_debit_routed.map(|b| b.to_string()) + }) + .collect::>(); + res.query_data.push(FilterValue { +diff --git a/crates/analytics/src/payments/distribution.rs b/crates/analytics/src/payments/distribution.rs +index ab82e48f..09728d70 100644 +--- a/crates/analytics/src/payments/distribution.rs ++++ b/crates/analytics/src/payments/distribution.rs +@@ -38,6 +38,9 @@ pub struct PaymentDistributionRow { + pub count: Option, + pub error_message: Option, + pub routing_approach: Option>, ++ pub signature_network: Option, ++ pub is_issuer_regulated: Option, ++ pub is_debit_routed: Option, + #[serde(with = "common_utils::custom_serde::iso8601::option")] + pub start_bucket: Option, + #[serde(with = "common_utils::custom_serde::iso8601::option")] +diff --git a/crates/analytics/src/payments/distribution/payment_error_message.rs b/crates/analytics/src/payments/distribution/payment_error_message.rs +index 2022aad3..996c3070 100644 +--- a/crates/analytics/src/payments/distribution/payment_error_message.rs ++++ b/crates/analytics/src/payments/distribution/payment_error_message.rs +@@ -161,6 +161,9 @@ where + i.card_issuer.clone(), + i.error_reason.clone(), + i.routing_approach.as_ref().map(|i| i.0.clone()), ++ i.signature_network.clone(), ++ i.is_issuer_regulated, ++ i.is_debit_routed, + TimeRange { + start_time: match (granularity, i.start_bucket) { + (Some(g), Some(st)) => g.clip_to_start(st)?, +diff --git a/crates/analytics/src/payments/filters.rs b/crates/analytics/src/payments/filters.rs +index b6ebf094..10d8a9cd 100644 +--- a/crates/analytics/src/payments/filters.rs ++++ b/crates/analytics/src/payments/filters.rs +@@ -66,4 +66,7 @@ pub struct PaymentFilterRow { + pub error_reason: Option, + pub first_attempt: Option, + pub routing_approach: Option>, ++ pub signature_network: Option, ++ pub is_issuer_regulated: Option, ++ pub is_debit_routed: Option, + } +diff --git a/crates/analytics/src/payments/metrics.rs b/crates/analytics/src/payments/metrics.rs +index 914eac71..01336d11 100644 +--- a/crates/analytics/src/payments/metrics.rs ++++ b/crates/analytics/src/payments/metrics.rs +@@ -55,6 +55,7 @@ pub struct PaymentMetricRow { + pub routing_approach: Option>, + pub signature_network: Option, + pub is_issuer_regulated: Option, ++ pub is_debit_routed: Option, + #[serde(with = "common_utils::custom_serde::iso8601::option")] + pub start_bucket: Option, + #[serde(with = "common_utils::custom_serde::iso8601::option")] +diff --git a/crates/analytics/src/payments/metrics/avg_ticket_size.rs b/crates/analytics/src/payments/metrics/avg_ticket_size.rs +index 0dff94ce..cba10a06 100644 +--- a/crates/analytics/src/payments/metrics/avg_ticket_size.rs ++++ b/crates/analytics/src/payments/metrics/avg_ticket_size.rs +@@ -123,6 +123,9 @@ where + i.card_issuer.clone(), + i.error_reason.clone(), + i.routing_approach.as_ref().map(|i| i.0.clone()), ++ i.signature_network.clone(), ++ i.is_issuer_regulated, ++ i.is_debit_routed, + TimeRange { + start_time: match (granularity, i.start_bucket) { + (Some(g), Some(st)) => g.clip_to_start(st)?, +diff --git a/crates/analytics/src/payments/metrics/connector_success_rate.rs b/crates/analytics/src/payments/metrics/connector_success_rate.rs +index ac1c4efd..80463014 100644 +--- a/crates/analytics/src/payments/metrics/connector_success_rate.rs ++++ b/crates/analytics/src/payments/metrics/connector_success_rate.rs +@@ -118,6 +118,9 @@ where + i.card_issuer.clone(), + i.error_reason.clone(), + i.routing_approach.as_ref().map(|i| i.0.clone()), ++ i.signature_network.clone(), ++ i.is_issuer_regulated, ++ i.is_debit_routed, + TimeRange { + start_time: match (granularity, i.start_bucket) { + (Some(g), Some(st)) => g.clip_to_start(st)?, +diff --git a/crates/analytics/src/payments/metrics/debit_routing.rs b/crates/analytics/src/payments/metrics/debit_routing.rs +index 309b2131..f4f86caf 100644 +--- a/crates/analytics/src/payments/metrics/debit_routing.rs ++++ b/crates/analytics/src/payments/metrics/debit_routing.rs +@@ -57,13 +57,6 @@ where + .switch()?; + query_builder.add_select_column("currency").switch()?; + +- query_builder +- .add_select_column("signature_network") +- .switch()?; +- query_builder +- .add_select_column("is_issuer_regulated") +- .switch()?; +- + query_builder + .add_select_column(Aggregate::Min { + field: "created_at", +@@ -93,16 +86,6 @@ where + .switch()?; + } + +- query_builder +- .add_group_by_clause("signature_network") +- .attach_printable("Error grouping by signature_network") +- .switch()?; +- +- query_builder +- .add_group_by_clause("is_issuer_regulated") +- .attach_printable("Error grouping by is_issuer_regulated") +- .switch()?; +- + query_builder + .add_group_by_clause("currency") + .attach_printable("Error grouping by currency") +@@ -146,6 +129,9 @@ where + i.card_issuer.clone(), + i.error_reason.clone(), + i.routing_approach.as_ref().map(|i| i.0.clone()), ++ i.signature_network.clone(), ++ i.is_issuer_regulated, ++ i.is_debit_routed, + TimeRange { + start_time: match (granularity, i.start_bucket) { + (Some(g), Some(st)) => g.clip_to_start(st)?, +diff --git a/crates/analytics/src/payments/metrics/payment_count.rs b/crates/analytics/src/payments/metrics/payment_count.rs +index 6f9e9991..146f090b 100644 +--- a/crates/analytics/src/payments/metrics/payment_count.rs ++++ b/crates/analytics/src/payments/metrics/payment_count.rs +@@ -109,6 +109,9 @@ where + i.card_issuer.clone(), + i.error_reason.clone(), + i.routing_approach.as_ref().map(|i| i.0.clone()), ++ i.signature_network.clone(), ++ i.is_issuer_regulated, ++ i.is_debit_routed, + TimeRange { + start_time: match (granularity, i.start_bucket) { + (Some(g), Some(st)) => g.clip_to_start(st)?, +diff --git a/crates/analytics/src/payments/metrics/payment_processed_amount.rs b/crates/analytics/src/payments/metrics/payment_processed_amount.rs +index 1b635562..3e5c9daa 100644 +--- a/crates/analytics/src/payments/metrics/payment_processed_amount.rs ++++ b/crates/analytics/src/payments/metrics/payment_processed_amount.rs +@@ -123,6 +123,9 @@ where + i.card_issuer.clone(), + i.error_reason.clone(), + i.routing_approach.as_ref().map(|i| i.0.clone()), ++ i.signature_network.clone(), ++ i.is_issuer_regulated, ++ i.is_debit_routed, + TimeRange { + start_time: match (granularity, i.start_bucket) { + (Some(g), Some(st)) => g.clip_to_start(st)?, +diff --git a/crates/analytics/src/payments/metrics/payment_success_count.rs b/crates/analytics/src/payments/metrics/payment_success_count.rs +index fa1daad1..ee140ce4 100644 +--- a/crates/analytics/src/payments/metrics/payment_success_count.rs ++++ b/crates/analytics/src/payments/metrics/payment_success_count.rs +@@ -116,6 +116,9 @@ where + i.card_issuer.clone(), + i.error_reason.clone(), + i.routing_approach.as_ref().map(|i| i.0.clone()), ++ i.signature_network.clone(), ++ i.is_issuer_regulated, ++ i.is_debit_routed, + TimeRange { + start_time: match (granularity, i.start_bucket) { + (Some(g), Some(st)) => g.clip_to_start(st)?, +diff --git a/crates/analytics/src/payments/metrics/retries_count.rs b/crates/analytics/src/payments/metrics/retries_count.rs +index bf4546bf..5026dc4f 100644 +--- a/crates/analytics/src/payments/metrics/retries_count.rs ++++ b/crates/analytics/src/payments/metrics/retries_count.rs +@@ -113,6 +113,9 @@ where + i.card_issuer.clone(), + i.error_reason.clone(), + i.routing_approach.as_ref().map(|i| i.0.clone()), ++ i.signature_network.clone(), ++ i.is_issuer_regulated, ++ i.is_debit_routed, + TimeRange { + start_time: match (granularity, i.start_bucket) { + (Some(g), Some(st)) => g.clip_to_start(st)?, +diff --git a/crates/analytics/src/payments/metrics/sessionized_metrics/avg_ticket_size.rs b/crates/analytics/src/payments/metrics/sessionized_metrics/avg_ticket_size.rs +index 4c129e43..03567971 100644 +--- a/crates/analytics/src/payments/metrics/sessionized_metrics/avg_ticket_size.rs ++++ b/crates/analytics/src/payments/metrics/sessionized_metrics/avg_ticket_size.rs +@@ -124,6 +124,9 @@ where + i.card_issuer.clone(), + i.error_reason.clone(), + i.routing_approach.as_ref().map(|i| i.0.clone()), ++ i.signature_network.clone(), ++ i.is_issuer_regulated, ++ i.is_debit_routed, + TimeRange { + start_time: match (granularity, i.start_bucket) { + (Some(g), Some(st)) => g.clip_to_start(st)?, +diff --git a/crates/analytics/src/payments/metrics/sessionized_metrics/connector_success_rate.rs b/crates/analytics/src/payments/metrics/sessionized_metrics/connector_success_rate.rs +index c00b28e6..dcb0c5f1 100644 +--- a/crates/analytics/src/payments/metrics/sessionized_metrics/connector_success_rate.rs ++++ b/crates/analytics/src/payments/metrics/sessionized_metrics/connector_success_rate.rs +@@ -119,6 +119,9 @@ where + i.card_issuer.clone(), + i.error_reason.clone(), + i.routing_approach.as_ref().map(|i| i.0.clone()), ++ i.signature_network.clone(), ++ i.is_issuer_regulated, ++ i.is_debit_routed, + TimeRange { + start_time: match (granularity, i.start_bucket) { + (Some(g), Some(st)) => g.clip_to_start(st)?, +diff --git a/crates/analytics/src/payments/metrics/sessionized_metrics/debit_routing.rs b/crates/analytics/src/payments/metrics/sessionized_metrics/debit_routing.rs +index 6df1d265..51685b8f 100644 +--- a/crates/analytics/src/payments/metrics/sessionized_metrics/debit_routing.rs ++++ b/crates/analytics/src/payments/metrics/sessionized_metrics/debit_routing.rs +@@ -129,6 +129,9 @@ where + i.card_issuer.clone(), + i.error_reason.clone(), + i.routing_approach.as_ref().map(|i| i.0.clone()), ++ i.signature_network.clone(), ++ i.is_issuer_regulated, ++ i.is_debit_routed, + TimeRange { + start_time: match (granularity, i.start_bucket) { + (Some(g), Some(st)) => g.clip_to_start(st)?, +diff --git a/crates/analytics/src/payments/metrics/sessionized_metrics/failure_reasons.rs b/crates/analytics/src/payments/metrics/sessionized_metrics/failure_reasons.rs +index a9cab381..f5cf67dc 100644 +--- a/crates/analytics/src/payments/metrics/sessionized_metrics/failure_reasons.rs ++++ b/crates/analytics/src/payments/metrics/sessionized_metrics/failure_reasons.rs +@@ -184,6 +184,9 @@ where + i.card_issuer.clone(), + i.error_reason.clone(), + i.routing_approach.as_ref().map(|i| i.0.clone()), ++ i.signature_network.clone(), ++ i.is_issuer_regulated, ++ i.is_debit_routed, + TimeRange { + start_time: match (granularity, i.start_bucket) { + (Some(g), Some(st)) => g.clip_to_start(st)?, +diff --git a/crates/analytics/src/payments/metrics/sessionized_metrics/payment_count.rs b/crates/analytics/src/payments/metrics/sessionized_metrics/payment_count.rs +index a713b5fd..c85ad5e8 100644 +--- a/crates/analytics/src/payments/metrics/sessionized_metrics/payment_count.rs ++++ b/crates/analytics/src/payments/metrics/sessionized_metrics/payment_count.rs +@@ -110,6 +110,9 @@ where + i.card_issuer.clone(), + i.error_reason.clone(), + i.routing_approach.as_ref().map(|i| i.0.clone()), ++ i.signature_network.clone(), ++ i.is_issuer_regulated, ++ i.is_debit_routed, + TimeRange { + start_time: match (granularity, i.start_bucket) { + (Some(g), Some(st)) => g.clip_to_start(st)?, +diff --git a/crates/analytics/src/payments/metrics/sessionized_metrics/payment_processed_amount.rs b/crates/analytics/src/payments/metrics/sessionized_metrics/payment_processed_amount.rs +index d96a023c..793b22d2 100644 +--- a/crates/analytics/src/payments/metrics/sessionized_metrics/payment_processed_amount.rs ++++ b/crates/analytics/src/payments/metrics/sessionized_metrics/payment_processed_amount.rs +@@ -141,6 +141,9 @@ where + i.card_issuer.clone(), + i.error_reason.clone(), + i.routing_approach.as_ref().map(|i| i.0.clone()), ++ i.signature_network.clone(), ++ i.is_issuer_regulated, ++ i.is_debit_routed, + TimeRange { + start_time: match (granularity, i.start_bucket) { + (Some(g), Some(st)) => g.clip_to_start(st)?, +diff --git a/crates/analytics/src/payments/metrics/sessionized_metrics/payment_success_count.rs b/crates/analytics/src/payments/metrics/sessionized_metrics/payment_success_count.rs +index 54833d35..a6ec7e53 100644 +--- a/crates/analytics/src/payments/metrics/sessionized_metrics/payment_success_count.rs ++++ b/crates/analytics/src/payments/metrics/sessionized_metrics/payment_success_count.rs +@@ -117,6 +117,9 @@ where + i.card_issuer.clone(), + i.error_reason.clone(), + i.routing_approach.as_ref().map(|i| i.0.clone()), ++ i.signature_network.clone(), ++ i.is_issuer_regulated, ++ i.is_debit_routed, + TimeRange { + start_time: match (granularity, i.start_bucket) { + (Some(g), Some(st)) => g.clip_to_start(st)?, +diff --git a/crates/analytics/src/payments/metrics/sessionized_metrics/payments_distribution.rs b/crates/analytics/src/payments/metrics/sessionized_metrics/payments_distribution.rs +index e774d981..e76d9857 100644 +--- a/crates/analytics/src/payments/metrics/sessionized_metrics/payments_distribution.rs ++++ b/crates/analytics/src/payments/metrics/sessionized_metrics/payments_distribution.rs +@@ -120,6 +120,9 @@ where + i.card_issuer.clone(), + i.error_reason.clone(), + i.routing_approach.as_ref().map(|i| i.0.clone()), ++ i.signature_network.clone(), ++ i.is_issuer_regulated, ++ i.is_debit_routed, + TimeRange { + start_time: match (granularity, i.start_bucket) { + (Some(g), Some(st)) => g.clip_to_start(st)?, +diff --git a/crates/analytics/src/payments/metrics/sessionized_metrics/retries_count.rs b/crates/analytics/src/payments/metrics/sessionized_metrics/retries_count.rs +index b8920614..93b5af07 100644 +--- a/crates/analytics/src/payments/metrics/sessionized_metrics/retries_count.rs ++++ b/crates/analytics/src/payments/metrics/sessionized_metrics/retries_count.rs +@@ -113,6 +113,9 @@ where + i.card_issuer.clone(), + i.error_reason.clone(), + i.routing_approach.as_ref().map(|i| i.0.clone()), ++ i.signature_network.clone(), ++ i.is_issuer_regulated, ++ i.is_debit_routed, + TimeRange { + start_time: match (granularity, i.start_bucket) { + (Some(g), Some(st)) => g.clip_to_start(st)?, +diff --git a/crates/analytics/src/payments/metrics/sessionized_metrics/success_rate.rs b/crates/analytics/src/payments/metrics/sessionized_metrics/success_rate.rs +index 1a6e48d6..90bf10c8 100644 +--- a/crates/analytics/src/payments/metrics/sessionized_metrics/success_rate.rs ++++ b/crates/analytics/src/payments/metrics/sessionized_metrics/success_rate.rs +@@ -113,6 +113,9 @@ where + i.card_issuer.clone(), + i.error_reason.clone(), + i.routing_approach.as_ref().map(|i| i.0.clone()), ++ i.signature_network.clone(), ++ i.is_issuer_regulated, ++ i.is_debit_routed, + TimeRange { + start_time: match (granularity, i.start_bucket) { + (Some(g), Some(st)) => g.clip_to_start(st)?, +diff --git a/crates/analytics/src/payments/metrics/success_rate.rs b/crates/analytics/src/payments/metrics/success_rate.rs +index f6acb968..b5244c02 100644 +--- a/crates/analytics/src/payments/metrics/success_rate.rs ++++ b/crates/analytics/src/payments/metrics/success_rate.rs +@@ -112,6 +112,9 @@ where + i.card_issuer.clone(), + i.error_reason.clone(), + i.routing_approach.as_ref().map(|i| i.0.clone()), ++ i.signature_network.clone(), ++ i.is_issuer_regulated, ++ i.is_debit_routed, + TimeRange { + start_time: match (granularity, i.start_bucket) { + (Some(g), Some(st)) => g.clip_to_start(st)?, +diff --git a/crates/analytics/src/payments/types.rs b/crates/analytics/src/payments/types.rs +index 7bb23d7a..7bb3b127 100644 +--- a/crates/analytics/src/payments/types.rs ++++ b/crates/analytics/src/payments/types.rs +@@ -119,6 +119,30 @@ where + .attach_printable("Error adding routing approach filter")?; + } + ++ if !self.signature_network.is_empty() { ++ builder ++ .add_filter_in_range_clause( ++ PaymentDimensions::SignatureNetwork, ++ &self.signature_network, ++ ) ++ .attach_printable("Error adding signature network filter")?; ++ } ++ ++ if !self.is_issuer_regulated.is_empty() { ++ builder ++ .add_filter_in_range_clause( ++ PaymentDimensions::IsIssuerRegulated, ++ &self.is_issuer_regulated, ++ ) ++ .attach_printable("Error adding is issuer regulated filter")?; ++ } ++ ++ if !self.is_debit_routed.is_empty() { ++ builder ++ .add_filter_in_range_clause(PaymentDimensions::IsDebitRouted, &self.is_debit_routed) ++ .attach_printable("Error adding is debit routed filter")?; ++ } ++ + Ok(()) + } + } +diff --git a/crates/analytics/src/sqlx.rs b/crates/analytics/src/sqlx.rs +index 38746ce5..926c2868 100644 +--- a/crates/analytics/src/sqlx.rs ++++ b/crates/analytics/src/sqlx.rs +@@ -746,6 +746,11 @@ impl<'a> FromRow<'a, PgRow> for super::payments::metrics::PaymentMetricRow { + ColumnNotFound(_) => Ok(Default::default()), + e => Err(e), + })?; ++ let is_debit_routed: Option = ++ row.try_get("is_debit_routed").or_else(|e| match e { ++ ColumnNotFound(_) => Ok(Default::default()), ++ e => Err(e), ++ })?; + let total: Option = row.try_get("total").or_else(|e| match e { + ColumnNotFound(_) => Ok(Default::default()), + e => Err(e), +@@ -780,6 +785,7 @@ impl<'a> FromRow<'a, PgRow> for super::payments::metrics::PaymentMetricRow { + routing_approach, + signature_network, + is_issuer_regulated, ++ is_debit_routed, + total, + count, + start_bucket, +@@ -857,6 +863,22 @@ impl<'a> FromRow<'a, PgRow> for super::payments::distribution::PaymentDistributi + ColumnNotFound(_) => Ok(Default::default()), + e => Err(e), + })?; ++ ++ let signature_network: Option = ++ row.try_get("signature_network").or_else(|e| match e { ++ ColumnNotFound(_) => Ok(Default::default()), ++ e => Err(e), ++ })?; ++ let is_issuer_regulated: Option = ++ row.try_get("is_issuer_regulated").or_else(|e| match e { ++ ColumnNotFound(_) => Ok(Default::default()), ++ e => Err(e), ++ })?; ++ let is_debit_routed: Option = ++ row.try_get("is_debit_routed").or_else(|e| match e { ++ ColumnNotFound(_) => Ok(Default::default()), ++ e => Err(e), ++ })?; + let total: Option = row.try_get("total").or_else(|e| match e { + ColumnNotFound(_) => Ok(Default::default()), + e => Err(e), +@@ -900,6 +922,9 @@ impl<'a> FromRow<'a, PgRow> for super::payments::distribution::PaymentDistributi + count, + error_message, + routing_approach, ++ signature_network, ++ is_issuer_regulated, ++ is_debit_routed, + start_bucket, + end_bucket, + }) +@@ -979,6 +1004,21 @@ impl<'a> FromRow<'a, PgRow> for super::payments::filters::PaymentFilterRow { + ColumnNotFound(_) => Ok(Default::default()), + e => Err(e), + })?; ++ let signature_network: Option = ++ row.try_get("signature_network").or_else(|e| match e { ++ ColumnNotFound(_) => Ok(Default::default()), ++ e => Err(e), ++ })?; ++ let is_issuer_regulated: Option = ++ row.try_get("is_issuer_regulated").or_else(|e| match e { ++ ColumnNotFound(_) => Ok(Default::default()), ++ e => Err(e), ++ })?; ++ let is_debit_routed: Option = ++ row.try_get("is_debit_routed").or_else(|e| match e { ++ ColumnNotFound(_) => Ok(Default::default()), ++ e => Err(e), ++ })?; + Ok(Self { + currency, + status, +@@ -996,6 +1036,9 @@ impl<'a> FromRow<'a, PgRow> for super::payments::filters::PaymentFilterRow { + error_reason, + first_attempt, + routing_approach, ++ signature_network, ++ is_issuer_regulated, ++ is_debit_routed, + }) + } + } +diff --git a/crates/api_models/src/analytics/payments.rs b/crates/api_models/src/analytics/payments.rs +index 70583079..9c53002a 100644 +--- a/crates/api_models/src/analytics/payments.rs ++++ b/crates/api_models/src/analytics/payments.rs +@@ -45,6 +45,12 @@ pub struct PaymentFilters { + pub first_attempt: Vec, + #[serde(default)] + pub routing_approach: Vec, ++ #[serde(default)] ++ pub signature_network: Vec, ++ #[serde(default)] ++ pub is_issuer_regulated: Vec, ++ #[serde(default)] ++ pub is_debit_routed: Vec, + } + + #[derive( +@@ -87,6 +93,9 @@ pub enum PaymentDimensions { + CardIssuer, + ErrorReason, + RoutingApproach, ++ SignatureNetwork, ++ IsIssuerRegulated, ++ IsDebitRouted, + } + + #[derive( +@@ -208,6 +217,9 @@ pub struct PaymentMetricsBucketIdentifier { + pub card_issuer: Option, + pub error_reason: Option, + pub routing_approach: Option, ++ pub signature_network: Option, ++ pub is_issuer_regulated: Option, ++ pub is_debit_routed: Option, + #[serde(rename = "time_range")] + pub time_bucket: TimeRange, + // Coz FE sucks +@@ -234,6 +246,9 @@ impl PaymentMetricsBucketIdentifier { + card_issuer: Option, + error_reason: Option, + routing_approach: Option, ++ signature_network: Option, ++ is_issuer_regulated: Option, ++ is_debit_routed: Option, + normalized_time_range: TimeRange, + ) -> Self { + Self { +@@ -252,6 +267,9 @@ impl PaymentMetricsBucketIdentifier { + card_issuer, + error_reason, + routing_approach, ++ signature_network, ++ is_issuer_regulated, ++ is_debit_routed, + time_bucket: normalized_time_range, + start_time: normalized_time_range.start_time, + } +@@ -278,6 +296,9 @@ impl Hash for PaymentMetricsBucketIdentifier { + .clone() + .map(|i| i.to_string()) + .hash(state); ++ self.signature_network.hash(state); ++ self.is_issuer_regulated.hash(state); ++ self.is_debit_routed.hash(state); + self.time_bucket.hash(state); + } + } +@@ -319,8 +340,6 @@ pub struct PaymentMetricsBucketValue { + pub debit_routed_transaction_count: Option, + pub debit_routing_savings: Option, + pub debit_routing_savings_in_usd: Option, +- pub signature_network: Option, +- pub is_issuer_regulated: Option, + } + + #[derive(Debug, serde::Serialize)] + +----- END CHUNK ----- \ No newline at end of file diff --git a/raw/ad/ad247b7663e46e9e53c0c7011f1a3acee1ebe36c.txt b/raw/ad/ad247b7663e46e9e53c0c7011f1a3acee1ebe36c.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8f47669a8ff84eb72094989c634c512d41731f1 --- /dev/null +++ b/raw/ad/ad247b7663e46e9e53c0c7011f1a3acee1ebe36c.txt @@ -0,0 +1,2296 @@ +ROUTE: juspay/hyperswitch@ad247b7663e46e9e53c0c7011f1a3acee1ebe36c +REPO: https://github.com/juspay/hyperswitch +COMMIT: ad247b7663e46e9e53c0c7011f1a3acee1ebe36c +AUTHOR: sweta-sharma <77436883+swetasharma03@users.noreply.github.com> +DATE: 2025-08-24T19:59:51 + +=== ISSUE_AND_PR === +[PR #8795] feat(connector): [AFFIRM] BNPL flow added (Alpha) +URL: https://github.com/juspay/hyperswitch/pull/8795 +BODY: +## Type of Change + + +- [ ] Bugfix +- [ ] New feature +- [ ] Enhancement +- [ ] Refactoring +- [ ] Dependency updates +- [ ] Documentation +- [ ] CI/CD + +## Description + +BNPL flow added for affirm connector. +Only added mock server for affirm and not cypress because BNPL is currently not supported in cypress. + +### Additional Changes + +- [ ] This PR modifies the API contract +- [ ] This PR modifies the database schema +- [ ] This PR modifies application configuration/environment variables + + + + +## Motivation and Context + + + +## How did you test it? + +This is an alpha connector, also cypress doen't support pay_later PMs as of now. + +## Checklist + + +- [ ] I formatted the code `cargo +nightly fmt --all` +- [ ] I addressed lints thrown by `cargo clippy` +- [ ] I reviewed the submitted code +- [ ] I added unit tests for my changes where possible +COMMENTS: +- semanticdiff-com[bot]: Review changes with  SemanticDiff +
+Changed Files +
+ +| File | Status | +| :--- | :--- | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#crates/hyperswitch_connectors/src/default_implementations.rs)  [crates/hyperswitch\_connectors/src/default\_implementations\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#crates/hyperswitch_connectors/src/default_implementations.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#crates/hyperswitch_connectors/src/default_implementations.rs)  24% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#crates/common_enums/src/connector_enums.rs)  [crates/common\_enums/src/connector\_enums\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#crates/common_enums/src/connector_enums.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#crates/common_enums/src/connector_enums.rs)  11% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#crates/hyperswitch_connectors/src/connectors/affirm.rs)  [crates/hyperswitch\_connectors/src/connectors/affirm\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#crates/hyperswitch_connectors/src/connectors/affirm.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#crates/hyperswitch_connectors/src/connectors/affirm.rs)  7% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#crates/hyperswitch_connectors/src/connectors/affirm/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/affirm/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#crates/hyperswitch_connectors/src/connectors/affirm/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#crates/hyperswitch_connectors/src/connectors/affirm/transformers.rs)  6% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#api-reference/v1/openapi_spec_v1.json)  [api\-reference/v1/openapi\_spec\_v1\.json](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#api-reference/v1/openapi_spec_v1.json) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#api-reference/v1/openapi_spec_v1.json)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#api-reference/v2/openapi_spec_v2.json)  [api\-reference/v2/openapi\_spec\_v2\.json](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#api-reference/v2/openapi_spec_v2.json) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#api-reference/v2/openapi_spec_v2.json)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#config/config.example.toml)  [config/config\.example\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#config/config.example.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#config/deployments/integration_test.toml)  [config/deployments/integration\_test\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#config/deployments/integration_test.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#config/deployments/production.toml)  [config/deployments/production\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#config/deployments/production.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#config/deployments/sandbox.toml)  [config/deployments/sandbox\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#config/deployments/sandbox.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#config/development.toml)  [config/development\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#config/development.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#config/docker_compose.toml)  [config/docker\_compose\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#config/docker_compose.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#crates/connector_configs/src/connector.rs)  [crates/connector\_configs/src/connector\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#crates/connector_configs/src/connector.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#crates/connector_configs/src/connector.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#crates/connector_configs/toml/development.toml)  [crates/connector\_configs/toml/development\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#crates/connector_configs/toml/development.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#crates/connector_configs/toml/production.toml)  [crates/connector\_configs/toml/production\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#crates/connector_configs/toml/production.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#crates/connector_configs/toml/sandbox.toml)  [crates/connector\_configs/toml/sandbox\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#crates/connector_configs/toml/sandbox.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#crates/router/src/core/connector_validation.rs)  [crates/router/src/core/connector\_validation\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#crates/router/src/core/connector_validation.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#crates/router/src/core/connector_validation.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#crates/router/src/types/api/connector_mapping.rs)  [crates/router/src/types/api/connector\_mapping\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#crates/router/src/types/api/connector_mapping.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#crates/router/src/types/api/connector_mapping.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#crates/router/src/types/api/feature_matrix.rs)  [crates/router/src/types/api/feature\_matrix\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#crates/router/src/types/api/feature_matrix.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#crates/router/src/types/api/feature_matrix.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#crates/router/src/types/connector_transformers.rs)  [crates/router/src/types/connector\_transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#crates/router/src/types/connector_transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#crates/router/src/types/connector_transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#cypress-tests/cypress/e2e/configs/mock-server/Connectors/Affirm.ts)  [cypress\-tests/cypress/e2e/configs/mock\-server/Connectors/Affirm\.ts](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#cypress-tests/cypress/e2e/configs/mock-server/Connectors/Affirm.ts) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#cypress-tests/cypress/e2e/configs/mock-server/Connectors/Affirm.ts)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#cypress-tests/cypress/e2e/configs/mock-server/Creds.json)  [cypress\-tests/cypress/e2e/configs/mock\-server/Creds\.json](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#cypress-tests/cypress/e2e/configs/mock-server/Creds.json) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#cypress-tests/cypress/e2e/configs/mock-server/Creds.json)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#cypress-tests/cypress/e2e/configs/mock-server/router.ts)  [cypress\-tests/cypress/e2e/configs/mock\-server/router\.ts](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#cypress-tests/cypress/e2e/configs/mock-server/router.ts) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#cypress-tests/cypress/e2e/configs/mock-server/router.ts)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#loadtest/config/development.toml)  [loadtest/config/development\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8795/changes#loadtest/config/development.toml) | Unsupported file format | + +
+- swetasharma03: > devops changes look good. +> +> affirm ci is failing though: +> +> image + +Cypress not added for affirm because pay_later PM is not supported currently. Only added a mock server for it. +- pixincreate: > Cypress not added for affirm because pay_later PM is not supported currently. Only added a mock server for it. + +then what was the need for enabling it in github ci [here](https://github.com/juspay/hyperswitch/pull/8795/files#diff-4cf0537e55d1ee58adfba315769407f2ca49c006ffd13e8fc766f7ed9a87db75)? this will result in cypress ci against mock server to fail on all prs. +- likhinbopanna: @swetasharma03 Can you check cypress check is failing for alpha connectors ? +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/affirm.rs:5]: Dashboard config changes? +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/affirm.rs:5]: Payment config changes? +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/affirm/transformers.rs:210]: Why do we need all these values in metadata? +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/affirm/transformers.rs:272]: If any of these fields is mandatory please add them in `crates/payment_methods/src/configs/payment_connector_required_fields.rs` +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/affirm/transformers.rs:367]: Why is Authorized marked as Authorizing and not pending? +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/affirm/transformers.rs:374]: Why is Pending,Processing marked as Authorizing and not pending? +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/affirm/transformers.rs:387]: Mark this as Failure +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/affirm/transformers.rs:394]: Mark these as Failure +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/affirm/transformers.rs:396]: When will we get PartiallyRefunded status? +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/affirm/transformers.rs:376]: When will we get Refunded status? +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/affirm/transformers.rs:399]: Mark PartiallyVoided as Voided +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/affirm/transformers.rs:416]: Use MinorAmount +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/affirm/transformers.rs:332]: MinorAmount +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/affirm/transformers.rs:444]: MinorAmount +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/affirm/transformers.rs:448]: MinorAmount +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/affirm/transformers.rs:471]: MinorAmount +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/affirm/transformers.rs:501]: MinorAmount +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/affirm/transformers.rs:587]: When will we get refund failure status? +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/affirm/transformers.rs:782]: Why is Auth mapped to Authorizing +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/affirm/transformers.rs:783]: Lets mark this as failure? + +=== COMMIT === +SUBJECT: feat(connector): [AFFIRM] BNPL flow added (Alpha) (#8795) +BODY: +Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> +Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> + +=== FILES === +Summary: 24 files changed, +1380 -137 +- api-reference/v1/openapi_spec_v1.json (+2 -0) +- api-reference/v2/openapi_spec_v2.json (+2 -0) +- config/config.example.toml (+3 -0) +- config/deployments/integration_test.toml (+3 -0) +- config/deployments/production.toml (+3 -0) +- config/deployments/sandbox.toml (+3 -0) +- config/development.toml (+3 -0) +- config/docker_compose.toml (+3 -0) +- crates/common_enums/src/connector_enums.rs (+5 -0) +- crates/connector_configs/src/connector.rs (+2 -0) +- crates/connector_configs/toml/development.toml (+4 -1) +- crates/connector_configs/toml/production.toml (+4 -1) +- crates/connector_configs/toml/sandbox.toml (+4 -1) +- crates/hyperswitch_connectors/src/connectors/affirm.rs (+268 -48) +- crates/hyperswitch_connectors/src/connectors/affirm/transformers.rs (+689 -85) +- crates/hyperswitch_connectors/src/default_implementations.rs (+0 -1) +- crates/router/src/core/connector_validation.rs (+4 -0) +- crates/router/src/types/api/connector_mapping.rs (+3 -0) +- crates/router/src/types/api/feature_matrix.rs (+3 -0) +- crates/router/src/types/connector_transformers.rs (+1 -0) +- cypress-tests/cypress/e2e/configs/mock-server/Connectors/Affirm.ts (+359 -0) +- cypress-tests/cypress/e2e/configs/mock-server/Creds.json (+7 -0) +- cypress-tests/cypress/e2e/configs/mock-server/router.ts (+2 -0) +- loadtest/config/development.toml (+3 -0) + +=== PATCH === +diff --git a/api-reference/v1/openapi_spec_v1.json b/api-reference/v1/openapi_spec_v1.json +index 1097811d..2182ecbe 100644 +--- a/api-reference/v1/openapi_spec_v1.json ++++ b/api-reference/v1/openapi_spec_v1.json +@@ -11831,6 +11831,7 @@ + "paypal_test", + "aci", + "adyen", ++ "affirm", + "airwallex", + "archipel", + "authorizedotnet", +@@ -29839,6 +29840,7 @@ + "paypal_test", + "aci", + "adyen", ++ "affirm", + "airwallex", + "archipel", + "authorizedotnet", +diff --git a/api-reference/v2/openapi_spec_v2.json b/api-reference/v2/openapi_spec_v2.json +index 5bf81377..2d9164f8 100644 +--- a/api-reference/v2/openapi_spec_v2.json ++++ b/api-reference/v2/openapi_spec_v2.json +@@ -8375,6 +8375,7 @@ + "paypal_test", + "aci", + "adyen", ++ "affirm", + "airwallex", + "archipel", + "authorizedotnet", +@@ -23493,6 +23494,7 @@ + "paypal_test", + "aci", + "adyen", ++ "affirm", + "airwallex", + "archipel", + "authorizedotnet", +diff --git a/config/config.example.toml b/config/config.example.toml +index ab7f0ebd..00f7ba33 100644 +--- a/config/config.example.toml ++++ b/config/config.example.toml +@@ -604,6 +604,9 @@ seicomart = { country = "JP", currency = "JPY" } + pay_easy = { country = "JP", currency = "JPY" } + boleto = { country = "BR", currency = "BRL" } + ++[pm_filters.affirm] ++affirm = { country = "CA,US", currency = "CAD,USD" } ++ + [pm_filters.airwallex] + credit = { country = "AU,HK,SG,NZ,US", currency = "AED,AFN,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,BYN,BZD,CAD,CDF,CHF,CLP,CNY,COP,CRC,CUP,CVE,CZK,DJF,DKK,DOP,DZD,EGP,ERN,ETB,EUR,FJD,FKP,GBP,GEL,GHS,GIP,GMD,GNF,GTQ,GYD,HKD,HNL,HRK,HTG,HUF,IDR,ILS,INR,IQD,IRR,ISK,JMD,JOD,JPY,KES,KGS,KHR,KMF,KPW,KRW,KWD,KYD,KZT,LAK,LBP,LKR,LRD,LSL,LYD,MAD,MDL,MGA,MKD,MMK,MNT,MOP,MRU,MUR,MVR,MWK,MXN,MYR,MZN,NAD,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SDG,SEK,SGD,SHP,SLE,SLL,SOS,SRD,SSP,STN,SVC,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW,ZWL" } + debit = { country = "AU,HK,SG,NZ,US", currency = "AED,AFN,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,BYN,BZD,CAD,CDF,CHF,CLP,CNY,COP,CRC,CUP,CVE,CZK,DJF,DKK,DOP,DZD,EGP,ERN,ETB,EUR,FJD,FKP,GBP,GEL,GHS,GIP,GMD,GNF,GTQ,GYD,HKD,HNL,HRK,HTG,HUF,IDR,ILS,INR,IQD,IRR,ISK,JMD,JOD,JPY,KES,KGS,KHR,KMF,KPW,KRW,KWD,KYD,KZT,LAK,LBP,LKR,LRD,LSL,LYD,MAD,MDL,MGA,MKD,MMK,MNT,MOP,MRU,MUR,MVR,MWK,MXN,MYR,MZN,NAD,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SDG,SEK,SGD,SHP,SLE,SLL,SOS,SRD,SSP,STN,SVC,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW,ZWL" } +diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml +index a8c1fcfd..40a0bdb1 100644 +--- a/config/deployments/integration_test.toml ++++ b/config/deployments/integration_test.toml +@@ -332,6 +332,9 @@ seven_eleven = { country = "JP", currency = "JPY" } + sofort = { country = "AT,BE,DE,ES,CH,NL", currency = "CHF,EUR"} + paypal = { country = "AU,NZ,CN,JP,HK,MY,TH,KR,PH,ID,AE,KW,BR,ES,GB,SE,NO,SK,AT,NL,DE,HU,CY,LU,CH,BE,FR,DK,FI,RO,HR,UA,MT,SI,GI,PT,IE,CZ,EE,LT,LV,IT,PL,IS,CA,US", currency = "AUD,BRL,CAD,CZK,DKK,EUR,HKD,HUF,INR,JPY,MYR,MXN,NZD,NOK,PHP,PLN,RUB,GBP,SGD,SEK,CHF,THB,USD" } + ++[pm_filters.affirm] ++affirm = { country = "CA,US", currency = "CAD,USD" } ++ + swish = { country = "SE", currency = "SEK" } + touch_n_go = { country = "MY", currency = "MYR" } + trustly = { country = "ES,GB,SE,NO,AT,NL,DE,DK,FI,EE,LT,LV", currency = "CZK,DKK,EUR,GBP,NOK,SEK" } +diff --git a/config/deployments/production.toml b/config/deployments/production.toml +index 1900a06f..c4c37289 100644 +--- a/config/deployments/production.toml ++++ b/config/deployments/production.toml +@@ -354,6 +354,9 @@ vipps = { country = "NO", currency = "NOK" } + walley = { country = "SE,NO,DK,FI", currency = "DKK,EUR,NOK,SEK" } + we_chat_pay = { country = "AU,NZ,CN,JP,HK,SG,ES,GB,SE,NO,AT,NL,DE,CY,CH,BE,FR,DK,LI,MT,SI,GR,PT,IT,CA,US", currency = "AUD,CAD,CNY,EUR,GBP,HKD,JPY,NZD,SGD,USD" } + ++[pm_filters.affirm] ++affirm = { country = "CA,US", currency = "CAD,USD" } ++ + [pm_filters.airwallex] + credit = { country = "AU,HK,SG,NZ,US", currency = "AED,AFN,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,BYN,BZD,CAD,CDF,CHF,CLP,CNY,COP,CRC,CUP,CVE,CZK,DJF,DKK,DOP,DZD,EGP,ERN,ETB,EUR,FJD,FKP,GBP,GEL,GHS,GIP,GMD,GNF,GTQ,GYD,HKD,HNL,HRK,HTG,HUF,IDR,ILS,INR,IQD,IRR,ISK,JMD,JOD,JPY,KES,KGS,KHR,KMF,KPW,KRW,KWD,KYD,KZT,LAK,LBP,LKR,LRD,LSL,LYD,MAD,MDL,MGA,MKD,MMK,MNT,MOP,MRU,MUR,MVR,MWK,MXN,MYR,MZN,NAD,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SDG,SEK,SGD,SHP,SLE,SLL,SOS,SRD,SSP,STN,SVC,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW,ZWL" } + debit = { country = "AU,HK,SG,NZ,US", currency = "AED,AFN,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,BYN,BZD,CAD,CDF,CHF,CLP,CNY,COP,CRC,CUP,CVE,CZK,DJF,DKK,DOP,DZD,EGP,ERN,ETB,EUR,FJD,FKP,GBP,GEL,GHS,GIP,GMD,GNF,GTQ,GYD,HKD,HNL,HRK,HTG,HUF,IDR,ILS,INR,IQD,IRR,ISK,JMD,JOD,JPY,KES,KGS,KHR,KMF,KPW,KRW,KWD,KYD,KZT,LAK,LBP,LKR,LRD,LSL,LYD,MAD,MDL,MGA,MKD,MMK,MNT,MOP,MRU,MUR,MVR,MWK,MXN,MYR,MZN,NAD,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SDG,SEK,SGD,SHP,SLE,SLL,SOS,SRD,SSP,STN,SVC,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW,ZWL" } +diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml +index 3c707087..171b4bf0 100644 +--- a/config/deployments/sandbox.toml ++++ b/config/deployments/sandbox.toml +@@ -363,6 +363,9 @@ walley = { country = "SE,NO,DK,FI", currency = "DKK,EUR,NOK,SEK" } + we_chat_pay = { country = "AU,NZ,CN,JP,HK,SG,ES,GB,SE,NO,AT,NL,DE,CY,CH,BE,FR,DK,LI,MT,SI,GR,PT,IT,CA,US", currency = "AUD,CAD,CNY,EUR,GBP,HKD,JPY,NZD,SGD,USD" } + pix = { country = "BR", currency = "BRL" } + ++[pm_filters.affirm] ++affirm = { country = "CA,US", currency = "CAD,USD" } ++ + [pm_filters.airwallex] + credit = { country = "AU,HK,SG,NZ,US", currency = "AED,AFN,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,BYN,BZD,CAD,CDF,CHF,CLP,CNY,COP,CRC,CUP,CVE,CZK,DJF,DKK,DOP,DZD,EGP,ERN,ETB,EUR,FJD,FKP,GBP,GEL,GHS,GIP,GMD,GNF,GTQ,GYD,HKD,HNL,HRK,HTG,HUF,IDR,ILS,INR,IQD,IRR,ISK,JMD,JOD,JPY,KES,KGS,KHR,KMF,KPW,KRW,KWD,KYD,KZT,LAK,LBP,LKR,LRD,LSL,LYD,MAD,MDL,MGA,MKD,MMK,MNT,MOP,MRU,MUR,MVR,MWK,MXN,MYR,MZN,NAD,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SDG,SEK,SGD,SHP,SLE,SLL,SOS,SRD,SSP,STN,SVC,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW,ZWL" } + debit = { country = "AU,HK,SG,NZ,US", currency = "AED,AFN,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,BYN,BZD,CAD,CDF,CHF,CLP,CNY,COP,CRC,CUP,CVE,CZK,DJF,DKK,DOP,DZD,EGP,ERN,ETB,EUR,FJD,FKP,GBP,GEL,GHS,GIP,GMD,GNF,GTQ,GYD,HKD,HNL,HRK,HTG,HUF,IDR,ILS,INR,IQD,IRR,ISK,JMD,JOD,JPY,KES,KGS,KHR,KMF,KPW,KRW,KWD,KYD,KZT,LAK,LBP,LKR,LRD,LSL,LYD,MAD,MDL,MGA,MKD,MMK,MNT,MOP,MRU,MUR,MVR,MWK,MXN,MYR,MZN,NAD,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SDG,SEK,SGD,SHP,SLE,SLL,SOS,SRD,SSP,STN,SVC,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW,ZWL" } +diff --git a/config/development.toml b/config/development.toml +index 9380fa7e..a2d06e7d 100644 +--- a/config/development.toml ++++ b/config/development.toml +@@ -548,6 +548,9 @@ pay_easy = { country = "JP", currency = "JPY" } + pix = { country = "BR", currency = "BRL" } + boleto = { country = "BR", currency = "BRL" } + ++[pm_filters.affirm] ++affirm = { country = "CA,US", currency = "CAD,USD" } ++ + [pm_filters.airwallex] + credit = { country = "AU,HK,SG,NZ,US", currency = "AED,AFN,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,BYN,BZD,CAD,CDF,CHF,CLP,CNY,COP,CRC,CUP,CVE,CZK,DJF,DKK,DOP,DZD,EGP,ERN,ETB,EUR,FJD,FKP,GBP,GEL,GHS,GIP,GMD,GNF,GTQ,GYD,HKD,HNL,HRK,HTG,HUF,IDR,ILS,INR,IQD,IRR,ISK,JMD,JOD,JPY,KES,KGS,KHR,KMF,KPW,KRW,KWD,KYD,KZT,LAK,LBP,LKR,LRD,LSL,LYD,MAD,MDL,MGA,MKD,MMK,MNT,MOP,MRU,MUR,MVR,MWK,MXN,MYR,MZN,NAD,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SDG,SEK,SGD,SHP,SLE,SLL,SOS,SRD,SSP,STN,SVC,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW,ZWL" } + debit = { country = "AU,HK,SG,NZ,US", currency = "AED,AFN,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,BYN,BZD,CAD,CDF,CHF,CLP,CNY,COP,CRC,CUP,CVE,CZK,DJF,DKK,DOP,DZD,EGP,ERN,ETB,EUR,FJD,FKP,GBP,GEL,GHS,GIP,GMD,GNF,GTQ,GYD,HKD,HNL,HRK,HTG,HUF,IDR,ILS,INR,IQD,IRR,ISK,JMD,JOD,JPY,KES,KGS,KHR,KMF,KPW,KRW,KWD,KYD,KZT,LAK,LBP,LKR,LRD,LSL,LYD,MAD,MDL,MGA,MKD,MMK,MNT,MOP,MRU,MUR,MVR,MWK,MXN,MYR,MZN,NAD,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SDG,SEK,SGD,SHP,SLE,SLL,SOS,SRD,SSP,STN,SVC,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW,ZWL" } +diff --git a/config/docker_compose.toml b/config/docker_compose.toml +index dcf86bbc..544caf4c 100644 +--- a/config/docker_compose.toml ++++ b/config/docker_compose.toml +@@ -497,6 +497,9 @@ seven_eleven = { country = "JP", currency = "JPY" } + sofort = { country = "AT,BE,DE,ES,CH,NL", currency = "CHF,EUR"} + paypal = { country = "AU,NZ,CN,JP,HK,MY,TH,KR,PH,ID,AE,KW,BR,ES,GB,SE,NO,SK,AT,NL,DE,HU,CY,LU,CH,BE,FR,DK,FI,RO,HR,UA,MT,SI,GI,PT,IE,CZ,EE,LT,LV,IT,PL,IS,CA,US", currency = "AUD,BRL,CAD,CZK,DKK,EUR,HKD,HUF,INR,JPY,MYR,MXN,NZD,NOK,PHP,PLN,RUB,GBP,SGD,SEK,CHF,THB,USD" } + ++[pm_filters.affirm] ++affirm = { country = "CA,US", currency = "CAD,USD" } ++ + swish = { country = "SE", currency = "SEK" } + touch_n_go = { country = "MY", currency = "MYR" } + trustly = { country = "ES,GB,SE,NO,AT,NL,DE,DK,FI,EE,LT,LV", currency = "CZK,DKK,EUR,GBP,NOK,SEK" } +diff --git a/crates/common_enums/src/connector_enums.rs b/crates/common_enums/src/connector_enums.rs +index 9d73bc6b..c34d0cdf 100644 +--- a/crates/common_enums/src/connector_enums.rs ++++ b/crates/common_enums/src/connector_enums.rs +@@ -61,6 +61,7 @@ pub enum RoutableConnectors { + DummyConnector7, + Aci, + Adyen, ++ Affirm, + Airwallex, + // Amazonpay, + Archipel, +@@ -229,6 +230,7 @@ pub enum Connector { + DummyConnector7, + Aci, + Adyen, ++ Affirm, + Airwallex, + // Amazonpay, + Archipel, +@@ -427,6 +429,7 @@ impl Connector { + // Add Separate authentication support for connectors + | Self::Authipay + | Self::Adyen ++ | Self::Affirm + | Self::Adyenplatform + | Self::Airwallex + // | Self::Amazonpay +@@ -601,6 +604,7 @@ impl From for Connector { + RoutableConnectors::DummyConnector7 => Self::DummyConnector7, + RoutableConnectors::Aci => Self::Aci, + RoutableConnectors::Adyen => Self::Adyen, ++ RoutableConnectors::Affirm => Self::Affirm, + RoutableConnectors::Airwallex => Self::Airwallex, + RoutableConnectors::Archipel => Self::Archipel, + RoutableConnectors::Authorizedotnet => Self::Authorizedotnet, +@@ -732,6 +736,7 @@ impl TryFrom for RoutableConnectors { + Connector::DummyConnector7 => Ok(Self::DummyConnector7), + Connector::Aci => Ok(Self::Aci), + Connector::Adyen => Ok(Self::Adyen), ++ Connector::Affirm => Ok(Self::Affirm), + Connector::Airwallex => Ok(Self::Airwallex), + Connector::Archipel => Ok(Self::Archipel), + Connector::Authorizedotnet => Ok(Self::Authorizedotnet), +diff --git a/crates/connector_configs/src/connector.rs b/crates/connector_configs/src/connector.rs +index 7a77a241..c1cae71f 100644 +--- a/crates/connector_configs/src/connector.rs ++++ b/crates/connector_configs/src/connector.rs +@@ -190,6 +190,7 @@ pub struct ConnectorConfig { + pub katapult: Option, + pub aci: Option, + pub adyen: Option, ++ pub affirm: Option, + #[cfg(feature = "payouts")] + pub adyen_payout: Option, + #[cfg(feature = "payouts")] +@@ -398,6 +399,7 @@ impl ConnectorConfig { + Connector::Aci => Ok(connector_data.aci), + Connector::Authipay => Ok(connector_data.authipay), + Connector::Adyen => Ok(connector_data.adyen), ++ Connector::Affirm => Ok(connector_data.affirm), + Connector::Adyenplatform => Err("Use get_payout_connector_config".to_string()), + Connector::Airwallex => Ok(connector_data.airwallex), + Connector::Archipel => Ok(connector_data.archipel), +diff --git a/crates/connector_configs/toml/development.toml b/crates/connector_configs/toml/development.toml +index 5904ee6d..bdedcf9d 100644 +--- a/crates/connector_configs/toml/development.toml ++++ b/crates/connector_configs/toml/development.toml +@@ -6621,8 +6621,11 @@ key1="Merchant Acceptor Key" + merchant_secret="Source verification key" + + [affirm] +-[affirm.connector_auth.HeaderKey] ++[[affirm.pay_later]] ++ payment_method_type = "affirm" ++[affirm.connector_auth.BodyKey] + api_key = "API Key" ++key1 = "API Secret" + + [trustpayments] + [trustpayments.connector_auth.HeaderKey] +diff --git a/crates/connector_configs/toml/production.toml b/crates/connector_configs/toml/production.toml +index c3d6fe5c..21c9f20f 100644 +--- a/crates/connector_configs/toml/production.toml ++++ b/crates/connector_configs/toml/production.toml +@@ -5275,8 +5275,11 @@ key1="Merchant Acceptor Key" + merchant_secret="Source verification key" + + [affirm] +-[affirm.connector_auth.HeaderKey] ++[[affirm.pay_later]] ++ payment_method_type = "affirm" ++[affirm.connector_auth.BodyKey] + api_key = "API Key" ++key1 = "API Secret" + + [trustpayments] + [trustpayments.connector_auth.HeaderKey] +diff --git a/crates/connector_configs/toml/sandbox.toml b/crates/connector_configs/toml/sandbox.toml +index 77cbac84..597c3fb7 100644 +--- a/crates/connector_configs/toml/sandbox.toml ++++ b/crates/connector_configs/toml/sandbox.toml +@@ -6604,8 +6604,11 @@ key1="Merchant Acceptor Key" + merchant_secret="Source verification key" + + [affirm] +-[affirm.connector_auth.HeaderKey] ++[[affirm.pay_later]] ++ payment_method_type = "affirm" ++[affirm.connector_auth.BodyKey] + api_key = "API Key" ++key1 = "API Secret" + + [trustpayments] + [trustpayments.connector_auth.HeaderKey] +diff --git a/crates/hyperswitch_connectors/src/connectors/affirm.rs b/crates/hyperswitch_connectors/src/connectors/affirm.rs +index 30735dcf..9d1f0ed4 100644 +--- a/crates/hyperswitch_connectors/src/connectors/affirm.rs ++++ b/crates/hyperswitch_connectors/src/connectors/affirm.rs +@@ -2,12 +2,14 @@ pub mod transformers; + + use std::sync::LazyLock; + ++use base64::Engine; + use common_enums::enums; + use common_utils::{ ++ consts::BASE64_ENGINE, + errors::CustomResult, + ext_traits::BytesExt, + request::{Method, Request, RequestBuilder, RequestContent}, +- types::{AmountConvertor, StringMinorUnit, StringMinorUnitForConnector}, ++ types::{AmountConvertor, MinorUnit, MinorUnitForConnector}, + }; + use error_stack::{report, ResultExt}; + use hyperswitch_domain_models::{ +@@ -15,20 +17,25 @@ use hyperswitch_domain_models::{ + router_data::{AccessToken, ConnectorAuthType, ErrorResponse, RouterData}, + router_flow_types::{ + access_token_auth::AccessTokenAuth, +- payments::{Authorize, Capture, PSync, PaymentMethodToken, Session, SetupMandate, Void}, ++ payments::{ ++ Authorize, Capture, CompleteAuthorize, PSync, PaymentMethodToken, Session, ++ SetupMandate, Void, ++ }, + refunds::{Execute, RSync}, + }, + router_request_types::{ +- AccessTokenRequestData, PaymentMethodTokenizationData, PaymentsAuthorizeData, +- PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData, +- RefundsData, SetupMandateRequestData, ++ AccessTokenRequestData, CompleteAuthorizeData, PaymentMethodTokenizationData, ++ PaymentsAuthorizeData, PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, ++ PaymentsSyncData, RefundsData, SetupMandateRequestData, + }, + router_response_types::{ +- ConnectorInfo, PaymentsResponseData, RefundsResponseData, SupportedPaymentMethods, ++ ConnectorInfo, PaymentMethodDetails, PaymentsResponseData, RefundsResponseData, ++ SupportedPaymentMethods, SupportedPaymentMethodsExt, + }, + types::{ +- PaymentsAuthorizeRouterData, PaymentsCaptureRouterData, PaymentsSyncRouterData, +- RefundSyncRouterData, RefundsRouterData, ++ PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData, ++ PaymentsCompleteAuthorizeRouterData, PaymentsSyncRouterData, RefundSyncRouterData, ++ RefundsRouterData, + }, + }; + use hyperswitch_interfaces::{ +@@ -42,20 +49,20 @@ use hyperswitch_interfaces::{ + types::{self, Response}, + webhooks, + }; +-use masking::{ExposeInterface, Mask}; ++use masking::{Mask, PeekInterface}; + use transformers as affirm; + + use crate::{constants::headers, types::ResponseRouterData, utils}; + + #[derive(Clone)] + pub struct Affirm { +- amount_converter: &'static (dyn AmountConvertor + Sync), ++ amount_converter: &'static (dyn AmountConvertor + Sync), + } + + impl Affirm { + pub fn new() -> &'static Self { + &Self { +- amount_converter: &StringMinorUnitForConnector, ++ amount_converter: &MinorUnitForConnector, + } + } + } +@@ -65,6 +72,7 @@ impl api::PaymentSession for Affirm {} + impl api::ConnectorAccessToken for Affirm {} + impl api::MandateSetup for Affirm {} + impl api::PaymentAuthorize for Affirm {} ++impl api::PaymentsCompleteAuthorize for Affirm {} + impl api::PaymentSync for Affirm {} + impl api::PaymentCapture for Affirm {} + impl api::PaymentVoid for Affirm {} +@@ -105,9 +113,6 @@ impl ConnectorCommon for Affirm { + + fn get_currency_unit(&self) -> api::CurrencyUnit { + api::CurrencyUnit::Minor +- // TODO! Check connector documentation, on which unit they are processing the currency. +- // If the connector accepts amount in lower unit ( i.e cents for USD) then return api::CurrencyUnit::Minor, +- // if connector accepts amount in base unit (i.e dollars for USD) then return api::CurrencyUnit::Base + } + + fn common_get_content_type(&self) -> &'static str { +@@ -124,9 +129,15 @@ impl ConnectorCommon for Affirm { + ) -> CustomResult)>, errors::ConnectorError> { + let auth = affirm::AffirmAuthType::try_from(auth_type) + .change_context(errors::ConnectorError::FailedToObtainAuthType)?; ++ let encoded_api_key = BASE64_ENGINE.encode(format!( ++ "{}:{}", ++ auth.public_key.peek(), ++ auth.private_key.peek() ++ )); ++ + Ok(vec![( + headers::AUTHORIZATION.to_string(), +- auth.api_key.expose().into_masked(), ++ format!("Basic {encoded_api_key}").into_masked(), + )]) + } + +@@ -144,10 +155,10 @@ impl ConnectorCommon for Affirm { + router_env::logger::info!(connector_response=?response); + + Ok(ErrorResponse { +- status_code: res.status_code, ++ status_code: response.status_code, + code: response.code, + message: response.message, +- reason: response.reason, ++ reason: Some(response.error_type), + attempt_status: None, + connector_transaction_id: None, + network_advice_code: None, +@@ -208,9 +219,11 @@ impl ConnectorIntegration CustomResult { +- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into()) ++ let endpoint = self.base_url(connectors); ++ ++ Ok(format!("{endpoint}/v2/checkout/direct")) + } + + fn get_request_body( +@@ -257,7 +270,7 @@ impl ConnectorIntegration, + res: Response, + ) -> CustomResult { +- let response: affirm::AffirmPaymentsResponse = res ++ let response: affirm::AffirmResponseWrapper = res + .response + .parse_struct("Affirm PaymentsAuthorizeResponse") + .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; +@@ -279,6 +292,90 @@ impl ConnectorIntegration ++ for Affirm ++{ ++ fn get_headers( ++ &self, ++ req: &PaymentsCompleteAuthorizeRouterData, ++ connectors: &Connectors, ++ ) -> CustomResult)>, errors::ConnectorError> { ++ self.build_headers(req, connectors) ++ } ++ ++ fn get_content_type(&self) -> &'static str { ++ self.common_get_content_type() ++ } ++ ++ fn get_url( ++ &self, ++ _req: &PaymentsCompleteAuthorizeRouterData, ++ connectors: &Connectors, ++ ) -> CustomResult { ++ let endpoint = self.base_url(connectors); ++ ++ Ok(format!("{endpoint}/v1/transactions")) ++ } ++ ++ fn get_request_body( ++ &self, ++ req: &PaymentsCompleteAuthorizeRouterData, ++ _connectors: &Connectors, ++ ) -> CustomResult { ++ let connector_req = affirm::AffirmCompleteAuthorizeRequest::try_from(req)?; ++ Ok(RequestContent::Json(Box::new(connector_req))) ++ } ++ ++ fn build_request( ++ &self, ++ req: &PaymentsCompleteAuthorizeRouterData, ++ connectors: &Connectors, ++ ) -> CustomResult, errors::ConnectorError> { ++ Ok(Some( ++ RequestBuilder::new() ++ .method(Method::Post) ++ .url(&types::PaymentsCompleteAuthorizeType::get_url( ++ self, req, connectors, ++ )?) ++ .attach_default_headers() ++ .headers(types::PaymentsCompleteAuthorizeType::get_headers( ++ self, req, connectors, ++ )?) ++ .set_body(types::PaymentsCompleteAuthorizeType::get_request_body( ++ self, req, connectors, ++ )?) ++ .build(), ++ )) ++ } ++ ++ fn handle_response( ++ &self, ++ data: &PaymentsCompleteAuthorizeRouterData, ++ event_builder: Option<&mut ConnectorEvent>, ++ res: Response, ++ ) -> CustomResult { ++ let response: affirm::AffirmCompleteAuthorizeResponse = res ++ .response ++ .parse_struct("Affirm PaymentsCompleteAuthorizeResponse") ++ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; ++ event_builder.map(|i| i.set_response_body(&response)); ++ router_env::logger::info!(connector_response=?response); ++ RouterData::try_from(ResponseRouterData { ++ response, ++ data: data.clone(), ++ http_code: res.status_code, ++ }) ++ } ++ ++ fn get_error_response( ++ &self, ++ res: Response, ++ event_builder: Option<&mut ConnectorEvent>, ++ ) -> CustomResult { ++ self.build_error_response(res, event_builder) ++ } ++} ++ + impl ConnectorIntegration for Affirm { + fn get_headers( + &self, +@@ -294,10 +391,17 @@ impl ConnectorIntegration for Aff + + fn get_url( + &self, +- _req: &PaymentsSyncRouterData, +- _connectors: &Connectors, ++ req: &PaymentsSyncRouterData, ++ connectors: &Connectors, + ) -> CustomResult { +- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into()) ++ let endpoint = self.base_url(connectors); ++ let transaction_id = req ++ .request ++ .connector_transaction_id ++ .get_connector_transaction_id() ++ .change_context(errors::ConnectorError::MissingConnectorTransactionID)?; ++ ++ Ok(format!("{endpoint}/v1/transactions/{transaction_id}",)) + } + + fn build_request( +@@ -321,7 +425,7 @@ impl ConnectorIntegration for Aff + event_builder: Option<&mut ConnectorEvent>, + res: Response, + ) -> CustomResult { +- let response: affirm::AffirmPaymentsResponse = res ++ let response: affirm::AffirmResponseWrapper = res + .response + .parse_struct("affirm PaymentsSyncResponse") + .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; +@@ -358,18 +462,31 @@ impl ConnectorIntegration fo + + fn get_url( + &self, +- _req: &PaymentsCaptureRouterData, +- _connectors: &Connectors, ++ req: &PaymentsCaptureRouterData, ++ connectors: &Connectors, + ) -> CustomResult { +- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into()) ++ let endpoint = self.base_url(connectors); ++ let transaction_id = req.request.connector_transaction_id.clone(); ++ ++ Ok(format!( ++ "{endpoint}/v1/transactions/{transaction_id}/capture" ++ )) + } + + fn get_request_body( + &self, +- _req: &PaymentsCaptureRouterData, ++ req: &PaymentsCaptureRouterData, + _connectors: &Connectors, + ) -> CustomResult { +- Err(errors::ConnectorError::NotImplemented("get_request_body method".to_string()).into()) ++ let amount = utils::convert_amount( ++ self.amount_converter, ++ req.request.minor_amount_to_capture, ++ req.request.currency, ++ )?; ++ ++ let connector_router_data = affirm::AffirmRouterData::from((amount, req)); ++ let connector_req = affirm::AffirmCaptureRequest::try_from(&connector_router_data)?; ++ Ok(RequestContent::Json(Box::new(connector_req))) + } + + fn build_request( +@@ -398,7 +515,7 @@ impl ConnectorIntegration fo + event_builder: Option<&mut ConnectorEvent>, + res: Response, + ) -> CustomResult { +- let response: affirm::AffirmPaymentsResponse = res ++ let response: affirm::AffirmCaptureResponse = res + .response + .parse_struct("Affirm PaymentsCaptureResponse") + .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; +@@ -420,7 +537,86 @@ impl ConnectorIntegration fo + } + } + +-impl ConnectorIntegration for Affirm {} ++impl ConnectorIntegration for Affirm { ++ fn get_headers( ++ &self, ++ req: &PaymentsCancelRouterData, ++ connectors: &Connectors, ++ ) -> CustomResult)>, errors::ConnectorError> { ++ self.build_headers(req, connectors) ++ } ++ ++ fn get_content_type(&self) -> &'static str { ++ self.common_get_content_type() ++ } ++ ++ fn get_url( ++ &self, ++ req: &PaymentsCancelRouterData, ++ connectors: &Connectors, ++ ) -> CustomResult { ++ let endpoint = self.base_url(connectors); ++ let transaction_id = req.request.connector_transaction_id.clone(); ++ ++ Ok(format!("{endpoint}/v1/transactions/{transaction_id}/void")) ++ } ++ ++ fn get_request_body( ++ &self, ++ req: &PaymentsCancelRouterData, ++ _connectors: &Connectors, ++ ) -> CustomResult { ++ let connector_req = affirm::AffirmCancelRequest::try_from(req)?; ++ Ok(RequestContent::Json(Box::new(connector_req))) ++ } ++ ++ fn build_request( ++ &self, ++ req: &PaymentsCancelRouterData, ++ connectors: &Connectors, ++ ) -> CustomResult, errors::ConnectorError> { ++ Ok(Some( ++ RequestBuilder::new() ++ .method(Method::Post) ++ .url(&types::PaymentsVoidType::get_url(self, req, connectors)?) ++ .attach_default_headers() ++ .headers(types::PaymentsVoidType::get_headers(self, req, connectors)?) ++ .set_body(types::PaymentsVoidType::get_request_body( ++ self, req, connectors, ++ )?) ++ .build(), ++ )) ++ } ++ ++ fn handle_response( ++ &self, ++ data: &PaymentsCancelRouterData, ++ event_builder: Option<&mut ConnectorEvent>, ++ res: Response, ++ ) -> CustomResult { ++ let response: affirm::AffirmCancelResponse = res ++ .response ++ .parse_struct("GetnetPaymentsVoidResponse") ++ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; ++ ++ event_builder.map(|i| i.set_response_body(&response)); ++ router_env::logger::info!(connector_response=?response); ++ ++ RouterData::try_from(ResponseRouterData { ++ response, ++ data: data.clone(), ++ http_code: res.status_code, ++ }) ++ } ++ ++ fn get_error_response( ++ &self, ++ res: Response, ++ event_builder: Option<&mut ConnectorEvent>, ++ ) -> CustomResult { ++ self.build_error_response(res, event_builder) ++ } ++} + + impl ConnectorIntegration for Affirm { + fn get_headers( +@@ -437,10 +633,15 @@ impl ConnectorIntegration for Affirm + + fn get_url( + &self, +- _req: &RefundsRouterData, +- _connectors: &Connectors, ++ req: &RefundsRouterData, ++ connectors: &Connectors, + ) -> CustomResult { +- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into()) ++ let endpoint = self.base_url(connectors); ++ let transaction_id = req.request.connector_transaction_id.clone(); ++ ++ Ok(format!( ++ "{endpoint}/v1/transactions/{transaction_id}/refund" ++ )) + } + + fn get_request_body( +@@ -484,10 +685,10 @@ impl ConnectorIntegration for Affirm + event_builder: Option<&mut ConnectorEvent>, + res: Response, + ) -> CustomResult, errors::ConnectorError> { +- let response: affirm::RefundResponse = +- res.response +- .parse_struct("affirm RefundResponse") +- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; ++ let response: affirm::AffirmRefundResponse = res ++ .response ++ .parse_struct("affirm RefundResponse") ++ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; + event_builder.map(|i| i.set_response_body(&response)); + router_env::logger::info!(connector_response=?response); + RouterData::try_from(ResponseRouterData { +@@ -521,10 +722,13 @@ impl ConnectorIntegration for Affirm { + + fn get_url( + &self, +- _req: &RefundSyncRouterData, +- _connectors: &Connectors, ++ req: &RefundSyncRouterData, ++ connectors: &Connectors, + ) -> CustomResult { +- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into()) ++ let endpoint = self.base_url(connectors); ++ let transaction_id = req.request.connector_transaction_id.clone(); ++ ++ Ok(format!("{endpoint}/v1/transactions/{transaction_id}")) + } + + fn build_request( +@@ -538,9 +742,6 @@ impl ConnectorIntegration for Affirm { + .url(&types::RefundSyncType::get_url(self, req, connectors)?) + .attach_default_headers() + .headers(types::RefundSyncType::get_headers(self, req, connectors)?) +- .set_body(types::RefundSyncType::get_request_body( +- self, req, connectors, +- )?) + .build(), + )) + } +@@ -551,7 +752,7 @@ impl ConnectorIntegration for Affirm { + event_builder: Option<&mut ConnectorEvent>, + res: Response, + ) -> CustomResult { +- let response: affirm::RefundResponse = res ++ let response: affirm::AffirmRsyncResponse = res + .response + .parse_struct("affirm RefundSyncResponse") + .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; +@@ -597,12 +798,31 @@ impl webhooks::IncomingWebhook for Affirm { + } + } + +-static AFFIRM_SUPPORTED_PAYMENT_METHODS: LazyLock = +- LazyLock::new(SupportedPaymentMethods::new); ++static AFFIRM_SUPPORTED_PAYMENT_METHODS: LazyLock = LazyLock::new(|| { ++ let supported_capture_methods = vec![ ++ enums::CaptureMethod::Automatic, ++ enums::CaptureMethod::Manual, ++ ]; ++ ++ let mut affirm_supported_payment_methods = SupportedPaymentMethods::new(); ++ ++ affirm_supported_payment_methods.add( ++ enums::PaymentMethod::PayLater, ++ enums::PaymentMethodType::Affirm, ++ PaymentMethodDetails { ++ mandates: enums::FeatureStatus::NotSupported, ++ refunds: enums::FeatureStatus::Supported, ++ supported_capture_methods, ++ specific_features: None, ++ }, ++ ); ++ ++ affirm_supported_payment_methods ++}); + + static AFFIRM_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Affirm", +- description: "Affirm connector", ++ description: "Affirm connector is a payment gateway integration that processes Affirm’s buy now, pay later financing by managing payment authorization, capture, refunds, and transaction sync via Affirm’s API.", + connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, + integration_status: enums::ConnectorIntegrationStatus::Alpha, + }; +diff --git a/crates/hyperswitch_connectors/src/connectors/affirm/transformers.rs b/crates/hyperswitch_connectors/src/connectors/affirm/transformers.rs +index 4b606e04..ca10c27e 100644 +--- a/crates/hyperswitch_connectors/src/connectors/affirm/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/affirm/transformers.rs +@@ -1,28 +1,33 @@ +-use common_enums::enums; +-use common_utils::types::StringMinorUnit; ++use common_enums::{enums, CountryAlpha2, Currency}; ++use common_utils::{pii, request::Method, types::MinorUnit}; ++use error_stack::{report, ResultExt}; + use hyperswitch_domain_models::{ +- payment_method_data::PaymentMethodData, ++ payment_method_data::{PayLaterData, PaymentMethodData}, + router_data::{ConnectorAuthType, RouterData}, + router_flow_types::refunds::{Execute, RSync}, +- router_request_types::ResponseId, +- router_response_types::{PaymentsResponseData, RefundsResponseData}, +- types::{PaymentsAuthorizeRouterData, RefundsRouterData}, ++ router_request_types::{PaymentsCancelData, PaymentsCaptureData, ResponseId}, ++ router_response_types::{PaymentsResponseData, RedirectForm, RefundsResponseData}, ++ types::{ ++ PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData, ++ PaymentsCompleteAuthorizeRouterData, RefundsRouterData, ++ }, + }; + use hyperswitch_interfaces::errors; + use masking::Secret; + use serde::{Deserialize, Serialize}; ++use serde_json::Value; + +-use crate::types::{RefundsResponseRouterData, ResponseRouterData}; +- +-//TODO: Fill the struct with respective fields ++use crate::{ ++ types::{RefundsResponseRouterData, ResponseRouterData}, ++ utils::{PaymentsAuthorizeRequestData, RouterData as OtherRouterData}, ++}; + pub struct AffirmRouterData { +- pub amount: StringMinorUnit, // The type of amount that a connector accepts, for example, String, i64, f64, etc. ++ pub amount: MinorUnit, + pub router_data: T, + } + +-impl From<(StringMinorUnit, T)> for AffirmRouterData { +- fn from((amount, item): (StringMinorUnit, T)) -> Self { +- //Todo : use utils to convert the amount to the type of amount that a connector accepts ++impl From<(MinorUnit, T)> for AffirmRouterData { ++ fn from((amount, item): (MinorUnit, T)) -> Self { + Self { + amount, + router_data: item, +@@ -30,88 +35,481 @@ impl From<(StringMinorUnit, T)> for AffirmRouterData { + } + } + +-//TODO: Fill the struct with respective fields +-#[derive(Default, Debug, Serialize, PartialEq)] ++#[derive(Debug, Serialize)] + pub struct AffirmPaymentsRequest { +- amount: StringMinorUnit, +- card: AffirmCard, ++ pub merchant: Merchant, ++ pub items: Vec, ++ pub shipping: Option, ++ pub billing: Option, ++ pub total: MinorUnit, ++ pub currency: Currency, ++ pub order_id: Option, ++} ++ ++#[derive(Debug, Serialize)] ++pub struct AffirmCompleteAuthorizeRequest { ++ pub order_id: Option, ++ pub reference_id: Option, ++ pub transaction_id: String, ++} ++ ++impl TryFrom<&PaymentsCompleteAuthorizeRouterData> for AffirmCompleteAuthorizeRequest { ++ type Error = error_stack::Report; ++ fn try_from(item: &PaymentsCompleteAuthorizeRouterData) -> Result { ++ let transaction_id = item.request.connector_transaction_id.clone().ok_or( ++ errors::ConnectorError::MissingRequiredField { ++ field_name: "connector_transaction_id", ++ }, ++ )?; ++ ++ let reference_id = item.reference_id.clone(); ++ let order_id = item.connector_request_reference_id.clone(); ++ Ok(Self { ++ transaction_id, ++ order_id: Some(order_id), ++ reference_id, ++ }) ++ } ++} ++ ++#[derive(Debug, Serialize)] ++pub struct Merchant { ++ pub public_api_key: Secret, ++ pub user_confirmation_url: String, ++ pub user_cancel_url: String, ++ pub user_confirmation_url_action: Option, ++ pub use_vcn: Option, ++ pub name: Option, ++} ++ ++#[derive(Debug, Serialize)] ++pub struct Item { ++ pub display_name: String, ++ pub sku: String, ++ pub unit_price: MinorUnit, ++ pub qty: i64, ++} ++ ++#[derive(Debug, Serialize, Deserialize, Clone)] ++pub struct Shipping { ++ pub name: Name, ++ pub address: Address, ++ #[serde(skip_serializing_if = "Option::is_none")] ++ pub phone_number: Option>, ++ #[serde(skip_serializing_if = "Option::is_none")] ++ pub email: Option, ++} ++#[derive(Debug, Serialize)] ++pub struct Billing { ++ pub name: Name, ++ pub address: Address, ++ #[serde(skip_serializing_if = "Option::is_none")] ++ pub phone_number: Option>, ++ #[serde(skip_serializing_if = "Option::is_none")] ++ pub email: Option, ++} ++ ++#[derive(Debug, Serialize, Deserialize, Clone)] ++pub struct Name { ++ pub first: Option>, ++ pub last: Option>, ++ pub full: Option>, ++} ++ ++#[derive(Debug, Serialize, Deserialize, Clone)] ++pub struct Address { ++ pub line1: Option>, ++ #[serde(skip_serializing_if = "Option::is_none")] ++ pub line2: Option>, ++ pub city: Option, ++ pub state: Option>, ++ pub zipcode: Option>, ++ pub country: Option, ++} ++ ++#[derive(Debug, Serialize)] ++pub struct Metadata { ++ #[serde(skip_serializing_if = "Option::is_none")] ++ pub shipping_type: Option, ++ #[serde(skip_serializing_if = "Option::is_none")] ++ pub entity_name: Option, ++ #[serde(skip_serializing_if = "Option::is_none")] ++ pub platform_type: Option, ++ #[serde(skip_serializing_if = "Option::is_none")] ++ pub platform_version: Option, ++ #[serde(skip_serializing_if = "Option::is_none")] ++ pub platform_affirm: Option, ++ #[serde(skip_serializing_if = "Option::is_none")] ++ pub webhook_session_id: Option, ++ #[serde(skip_serializing_if = "Option::is_none")] ++ pub mode: Option, ++ #[serde(skip_serializing_if = "Option::is_none")] ++ pub customer: Option, ++ #[serde(skip_serializing_if = "Option::is_none")] ++ pub itinerary: Option>, ++ #[serde(skip_serializing_if = "Option::is_none")] ++ pub checkout_channel_type: Option, ++ #[serde(rename = "BOPIS", skip_serializing_if = "Option::is_none")] ++ pub bopis: Option, + } + +-#[derive(Default, Debug, Serialize, Eq, PartialEq)] +-pub struct AffirmCard { +- number: cards::CardNumber, +- expiry_month: Secret, +- expiry_year: Secret, +- cvc: Secret, +- complete: bool, ++#[derive(Debug, Serialize)] ++pub struct Discount { ++ pub discount_amount: MinorUnit, ++ pub discount_display_name: String, ++ pub discount_code: Option, + } + + impl TryFrom<&AffirmRouterData<&PaymentsAuthorizeRouterData>> for AffirmPaymentsRequest { + type Error = error_stack::Report; ++ + fn try_from( + item: &AffirmRouterData<&PaymentsAuthorizeRouterData>, + ) -> Result { +- match item.router_data.request.payment_method_data.clone() { +- PaymentMethodData::Card(_) => Err(errors::ConnectorError::NotImplemented( +- "Card payment method not implemented".to_string(), +- ) +- .into()), ++ let router_data = &item.router_data; ++ let request = &router_data.request; ++ ++ let billing = Some(Billing { ++ name: Name { ++ first: item.router_data.get_optional_billing_first_name(), ++ last: item.router_data.get_optional_billing_last_name(), ++ full: item.router_data.get_optional_billing_full_name(), ++ }, ++ address: Address { ++ line1: item.router_data.get_optional_billing_line1(), ++ line2: item.router_data.get_optional_billing_line2(), ++ city: item.router_data.get_optional_billing_city(), ++ state: item.router_data.get_optional_billing_state(), ++ zipcode: item.router_data.get_optional_billing_zip(), ++ country: item.router_data.get_optional_billing_country(), ++ }, ++ phone_number: item.router_data.get_optional_billing_phone_number(), ++ email: item.router_data.get_optional_billing_email(), ++ }); ++ ++ let shipping = Some(Shipping { ++ name: Name { ++ first: item.router_data.get_optional_shipping_first_name(), ++ last: item.router_data.get_optional_shipping_last_name(), ++ full: item.router_data.get_optional_shipping_full_name(), ++ }, ++ address: Address { ++ line1: item.router_data.get_optional_shipping_line1(), ++ line2: item.router_data.get_optional_shipping_line2(), ++ city: item.router_data.get_optional_shipping_city(), ++ state: item.router_data.get_optional_shipping_state(), ++ zipcode: item.router_data.get_optional_shipping_zip(), ++ country: item.router_data.get_optional_shipping_country(), ++ }, ++ phone_number: item.router_data.get_optional_shipping_phone_number(), ++ email: item.router_data.get_optional_shipping_email(), ++ }); ++ ++ match request.payment_method_data.clone() { ++ PaymentMethodData::PayLater(PayLaterData::AffirmRedirect {}) => { ++ let items = match request.order_details.clone() { ++ Some(order_details) => order_details ++ .iter() ++ .map(|data| { ++ Ok(Item { ++ display_name: data.product_name.clone(), ++ sku: data.product_id.clone().unwrap_or_default(), ++ unit_price: data.amount, ++ qty: data.quantity.into(), ++ }) ++ }) ++ .collect::, _>>(), ++ None => Err(report!(errors::ConnectorError::MissingRequiredField { ++ field_name: "order_details", ++ })), ++ }?; ++ ++ let auth_type = AffirmAuthType::try_from(&item.router_data.connector_auth_type) ++ .change_context(errors::ConnectorError::FailedToObtainAuthType)?; ++ let public_api_key = auth_type.public_key; ++ let merchant = Merchant { ++ public_api_key, ++ user_confirmation_url: request.get_complete_authorize_url()?, ++ user_cancel_url: request.get_router_return_url()?, ++ user_confirmation_url_action: None, ++ use_vcn: None, ++ name: None, ++ }; ++ ++ Ok(Self { ++ merchant, ++ items, ++ shipping, ++ billing, ++ total: item.amount, ++ currency: request.currency, ++ order_id: Some(item.router_data.connector_request_reference_id.clone()), ++ }) ++ } + _ => Err(errors::ConnectorError::NotImplemented("Payment method".to_string()).into()), + } + } + } +- +-//TODO: Fill the struct with respective fields +-// Auth Struct + pub struct AffirmAuthType { +- pub(super) api_key: Secret, ++ pub public_key: Secret, ++ pub private_key: Secret, + } + + impl TryFrom<&ConnectorAuthType> for AffirmAuthType { + type Error = error_stack::Report; + fn try_from(auth_type: &ConnectorAuthType) -> Result { + match auth_type { +- ConnectorAuthType::HeaderKey { api_key } => Ok(Self { +- api_key: api_key.to_owned(), ++ ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self { ++ public_key: api_key.to_owned(), ++ private_key: key1.to_owned(), + }), + _ => Err(errors::ConnectorError::FailedToObtainAuthType.into()), + } + } + } +-// PaymentsResponse +-//TODO: Append the remaining status flags +-#[derive(Debug, Clone, Copy, Default, Serialize, Deserialize, PartialEq)] +-#[serde(rename_all = "lowercase")] +-pub enum AffirmPaymentStatus { +- Succeeded, +- Failed, +- #[default] +- Processing, ++ ++impl From for common_enums::AttemptStatus { ++ fn from(item: AffirmTransactionStatus) -> Self { ++ match item { ++ AffirmTransactionStatus::Authorized => Self::Authorized, ++ AffirmTransactionStatus::AuthExpired => Self::Failure, ++ AffirmTransactionStatus::Canceled => Self::Voided, ++ AffirmTransactionStatus::Captured => Self::Charged, ++ AffirmTransactionStatus::ConfirmationExpired => Self::Failure, ++ AffirmTransactionStatus::Confirmed => Self::Authorized, ++ AffirmTransactionStatus::Created => Self::Pending, ++ AffirmTransactionStatus::Declined => Self::Failure, ++ AffirmTransactionStatus::Disputed => Self::Unresolved, ++ AffirmTransactionStatus::DisputeRefunded => Self::Unresolved, ++ AffirmTransactionStatus::ExpiredAuthorization => Self::Failure, ++ AffirmTransactionStatus::ExpiredConfirmation => Self::Failure, ++ AffirmTransactionStatus::PartiallyCaptured => Self::Charged, ++ AffirmTransactionStatus::Voided => Self::Voided, ++ AffirmTransactionStatus::PartiallyVoided => Self::Voided, ++ } ++ } + } + +-impl From for common_enums::AttemptStatus { +- fn from(item: AffirmPaymentStatus) -> Self { ++impl From for common_enums::RefundStatus { ++ fn from(item: AffirmRefundStatus) -> Self { + match item { +- AffirmPaymentStatus::Succeeded => Self::Charged, +- AffirmPaymentStatus::Failed => Self::Failure, +- AffirmPaymentStatus::Processing => Self::Authorizing, ++ AffirmRefundStatus::PartiallyRefunded => Self::Success, ++ AffirmRefundStatus::Refunded => Self::Success, + } + } + } + +-//TODO: Fill the struct with respective fields + #[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)] + pub struct AffirmPaymentsResponse { +- status: AffirmPaymentStatus, +- id: String, ++ checkout_id: String, ++ redirect_url: String, ++} ++ ++#[derive(Debug, Clone, Serialize, Deserialize)] ++#[serde(rename_all = "snake_case")] ++pub struct AffirmCompleteAuthorizeResponse { ++ pub id: String, ++ pub status: AffirmTransactionStatus, ++ pub amount: MinorUnit, ++ pub amount_refunded: MinorUnit, ++ pub authorization_expiration: String, ++ pub checkout_id: String, ++ pub created: String, ++ pub currency: Currency, ++ pub events: Vec, ++ pub settlement_transaction_id: Option, ++ pub transaction_id: String, ++ pub order_id: String, ++ pub shipping_carrier: Option, ++ pub shipping_confirmation: Option, ++ pub shipping: Option, ++ pub agent_alias: Option, ++ pub merchant_transaction_id: Option, ++ pub provider_id: Option, ++ pub remove_tax: Option, ++ pub checkout: Option, ++ pub refund_expires: Option, ++ pub remaining_capturable_amount: Option, ++ pub loan_information: Option, ++ pub user_id: Option, ++ pub platform: Option, ++} ++ ++#[derive(Debug, Clone, Serialize, Deserialize)] ++#[serde(rename_all = "snake_case")] ++pub struct TransactionEvent { ++ pub id: String, ++ pub amount: MinorUnit, ++ pub created: String, ++ pub currency: Currency, ++ pub fee: Option, ++ pub fee_refunded: Option, ++ pub reference_id: Option, ++ #[serde(rename = "type")] ++ pub event_type: AffirmEventType, ++ pub settlement_transaction_id: Option, ++ pub transaction_id: String, ++ pub order_id: String, ++ pub shipping_carrier: Option, ++ pub shipping_confirmation: Option, ++ pub shipping: Option, ++ pub agent_alias: Option, ++ pub merchant_transaction_id: Option, ++} ++ ++#[derive(Debug, Clone, Serialize, Deserialize)] ++#[serde(rename_all = "snake_case")] ++pub struct LoanInformation { ++ pub fees: Option, ++} ++ ++#[derive(Debug, Clone, Serialize, Deserialize)] ++#[serde(rename_all = "snake_case")] ++pub struct LoanFees { ++ pub amount: Option, ++ pub description: Option, ++} ++ ++#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)] ++#[serde(rename_all = "snake_case")] ++pub enum AffirmTransactionStatus { ++ Authorized, ++ AuthExpired, ++ Canceled, ++ Captured, ++ ConfirmationExpired, ++ Confirmed, ++ Created, ++ Declined, ++ Disputed, ++ DisputeRefunded, ++ ExpiredAuthorization, ++ ExpiredConfirmation, ++ PartiallyCaptured, ++ Voided, ++ PartiallyVoided, ++} ++ ++#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)] ++#[serde(rename_all = "snake_case")] ++pub enum AffirmRefundStatus { ++ PartiallyRefunded, ++ Refunded, ++} ++ ++#[derive(Debug, Clone, Serialize, Deserialize)] ++#[serde(rename_all = "snake_case")] ++pub struct AffirmPSyncResponse { ++ pub amount: MinorUnit, ++ pub amount_refunded: MinorUnit, ++ pub authorization_expiration: Option, ++ pub checkout_id: String, ++ pub created: String, ++ pub currency: Currency, ++ pub events: Vec, ++ pub id: String, ++ pub order_id: String, ++ pub provider_id: Option, ++ pub remove_tax: Option, ++ pub status: AffirmTransactionStatus, ++ pub checkout: Option, ++ pub refund_expires: Option, ++ pub remaining_capturable_amount: Option, ++ pub loan_information: Option, ++ pub shipping_carrier: Option, ++ pub shipping_confirmation: Option, ++ pub shipping: Option, ++ pub merchant_transaction_id: Option, ++ pub settlement_transaction_id: Option, ++ pub transaction_id: String, ++} ++ ++#[derive(Debug, Clone, Serialize, Deserialize)] ++#[serde(rename_all = "snake_case")] ++pub struct AffirmRsyncResponse { ++ pub amount: MinorUnit, ++ pub amount_refunded: MinorUnit, ++ pub authorization_expiration: String, ++ pub checkout_id: String, ++ pub created: String, ++ pub currency: Currency, ++ pub events: Vec, ++ pub id: String, ++ pub order_id: String, ++ pub status: AffirmRefundStatus, ++ pub refund_expires: Option, ++ pub remaining_capturable_amount: Option, ++ pub shipping_carrier: Option, ++ pub shipping_confirmation: Option, ++ pub shipping: Option, ++ pub merchant_transaction_id: Option, ++ pub settlement_transaction_id: Option, ++ pub transaction_id: String, ++} ++ ++#[derive(Debug, Serialize, Deserialize)] ++#[serde(untagged)] ++pub enum AffirmResponseWrapper { ++ Authorize(AffirmPaymentsResponse), ++ Psync(Box), + } + +-impl TryFrom> ++impl TryFrom> + for RouterData + { + type Error = error_stack::Report; ++ + fn try_from( +- item: ResponseRouterData, ++ item: ResponseRouterData, ++ ) -> Result { ++ match &item.response { ++ AffirmResponseWrapper::Authorize(resp) => { ++ let redirection_data = url::Url::parse(&resp.redirect_url) ++ .ok() ++ .map(|url| RedirectForm::from((url, Method::Get))); ++ ++ Ok(Self { ++ status: enums::AttemptStatus::AuthenticationPending, ++ response: Ok(PaymentsResponseData::TransactionResponse { ++ resource_id: ResponseId::ConnectorTransactionId(resp.checkout_id.clone()), ++ redirection_data: Box::new(redirection_data), ++ mandate_reference: Box::new(None), ++ connector_metadata: None, ++ network_txn_id: None, ++ connector_response_reference_id: None, ++ charges: None, ++ incremental_authorization_allowed: None, ++ }), ++ ..item.data ++ }) ++ } ++ AffirmResponseWrapper::Psync(resp) => { ++ let status = enums::AttemptStatus::from(resp.status); ++ Ok(Self { ++ status, ++ response: Ok(PaymentsResponseData::TransactionResponse { ++ resource_id: ResponseId::ConnectorTransactionId(resp.id.clone()), ++ redirection_data: Box::new(None), ++ mandate_reference: Box::new(None), ++ connector_metadata: None, ++ network_txn_id: None, ++ connector_response_reference_id: None, ++ charges: None, ++ incremental_authorization_allowed: None, ++ }), ++ ..item.data ++ }) ++ } ++ } ++ } ++} ++ ++impl TryFrom> ++ for RouterData ++{ ++ type Error = error_stack::Report; ++ fn try_from( ++ item: ResponseRouterData, + ) -> Result { + Ok(Self { + status: common_enums::AttemptStatus::from(item.response.status), +@@ -129,26 +527,26 @@ impl TryFrom, + } + + impl TryFrom<&AffirmRouterData<&RefundsRouterData>> for AffirmRefundRequest { + type Error = error_stack::Report; ++ + fn try_from(item: &AffirmRouterData<&RefundsRouterData>) -> Result { ++ let reference_id = item.router_data.request.connector_transaction_id.clone(); ++ + Ok(Self { + amount: item.amount.to_owned(), ++ reference_id: Some(reference_id), + }) + } + } + +-// Type definition for Refund Response +- + #[allow(dead_code)] + #[derive(Debug, Copy, Serialize, Default, Deserialize, Clone)] + pub enum RefundStatus { +@@ -158,43 +556,58 @@ pub enum RefundStatus { + Processing, + } + +-impl From for enums::RefundStatus { +- fn from(item: RefundStatus) -> Self { +- match item { +- RefundStatus::Succeeded => Self::Success, +- RefundStatus::Failed => Self::Failure, +- RefundStatus::Processing => Self::Pending, +- //TODO: Review mapping +- } +- } ++#[derive(Debug, Clone, Serialize, Deserialize)] ++#[serde(rename_all = "snake_case")] ++pub struct AffirmRefundResponse { ++ pub id: String, ++ pub amount: MinorUnit, ++ pub created: String, ++ pub currency: Currency, ++ pub fee: Option, ++ pub fee_refunded: Option, ++ pub reference_id: Option, ++ #[serde(rename = "type")] ++ pub event_type: AffirmEventType, ++ pub settlement_transaction_id: Option, ++ pub transaction_id: String, ++ pub order_id: String, ++ pub shipping_carrier: Option, ++ pub shipping_confirmation: Option, ++ pub shipping: Option, ++ pub agent_alias: Option, ++ pub merchant_transaction_id: Option, + } + +-//TODO: Fill the struct with respective fields +-#[derive(Default, Debug, Clone, Serialize, Deserialize)] +-pub struct RefundResponse { +- id: String, +- status: RefundStatus, ++impl From for enums::RefundStatus { ++ fn from(event_type: AffirmEventType) -> Self { ++ match event_type { ++ AffirmEventType::Refund => Self::Success, ++ _ => Self::Pending, ++ } ++ } + } + +-impl TryFrom> for RefundsRouterData { ++impl TryFrom> ++ for RefundsRouterData ++{ + type Error = error_stack::Report; + fn try_from( +- item: RefundsResponseRouterData, ++ item: RefundsResponseRouterData, + ) -> Result { + Ok(Self { + response: Ok(RefundsResponseData { + connector_refund_id: item.response.id.to_string(), +- refund_status: enums::RefundStatus::from(item.response.status), ++ refund_status: enums::RefundStatus::from(item.response.event_type), + }), + ..item.data + }) + } + } + +-impl TryFrom> for RefundsRouterData { ++impl TryFrom> for RefundsRouterData { + type Error = error_stack::Report; + fn try_from( +- item: RefundsResponseRouterData, ++ item: RefundsResponseRouterData, + ) -> Result { + Ok(Self { + response: Ok(RefundsResponseData { +@@ -206,14 +619,205 @@ impl TryFrom> for RefundsRouter + } + } + +-//TODO: Fill the struct with respective fields + #[derive(Default, Debug, Serialize, Deserialize, PartialEq)] + pub struct AffirmErrorResponse { + pub status_code: u16, + pub code: String, + pub message: String, +- pub reason: Option, +- pub network_advice_code: Option, +- pub network_decline_code: Option, +- pub network_error_message: Option, ++ #[serde(rename = "type")] ++ pub error_type: String, ++} ++ ++#[derive(Debug, Serialize)] ++pub struct AffirmCaptureRequest { ++ pub order_id: Option, ++ pub reference_id: Option, ++ pub amount: MinorUnit, ++ pub shipping_carrier: Option, ++ pub shipping_confirmation: Option, ++} ++ ++impl TryFrom<&AffirmRouterData<&PaymentsCaptureRouterData>> for AffirmCaptureRequest { ++ type Error = error_stack::Report; ++ ++ fn try_from(item: &AffirmRouterData<&PaymentsCaptureRouterData>) -> Result { ++ let reference_id = match item.router_data.connector_request_reference_id.clone() { ++ ref_id if ref_id.is_empty() => None, ++ ref_id => Some(ref_id), ++ }; ++ ++ let amount = item.amount; ++ ++ Ok(Self { ++ reference_id, ++ amount, ++ order_id: None, ++ shipping_carrier: None, ++ shipping_confirmation: None, ++ }) ++ } ++} ++ ++#[derive(Debug, Clone, Serialize, Deserialize)] ++#[serde(rename_all = "snake_case")] ++pub struct AffirmCaptureResponse { ++ pub id: String, ++ pub amount: MinorUnit, ++ pub created: String, ++ pub currency: Currency, ++ pub fee: Option, ++ pub fee_refunded: Option, ++ pub reference_id: Option, ++ #[serde(rename = "type")] ++ pub event_type: AffirmEventType, ++ pub settlement_transaction_id: Option, ++ pub transaction_id: String, ++ pub order_id: String, ++ pub shipping_carrier: Option, ++ pub shipping_confirmation: Option, ++ pub shipping: Option, ++ pub agent_alias: Option, ++ pub merchant_transaction_id: Option, ++} ++ ++#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] ++#[serde(rename_all = "snake_case")] ++pub enum AffirmEventType { ++ Auth, ++ AuthExpired, ++ Capture, ++ ChargeOff, ++ Confirm, ++ ConfirmationExpired, ++ ExpireAuthorization, ++ ExpireConfirmation, ++ Refund, ++ SplitCapture, ++ Update, ++ Void, ++ PartialVoid, ++ RefundVoided, ++} ++ ++impl From for enums::AttemptStatus { ++ fn from(event_type: AffirmEventType) -> Self { ++ match event_type { ++ AffirmEventType::Auth => Self::Authorized, ++ AffirmEventType::Capture | AffirmEventType::SplitCapture | AffirmEventType::Confirm => { ++ Self::Charged ++ } ++ AffirmEventType::AuthExpired ++ | AffirmEventType::ChargeOff ++ | AffirmEventType::ConfirmationExpired ++ | AffirmEventType::ExpireAuthorization ++ | AffirmEventType::ExpireConfirmation => Self::Failure, ++ AffirmEventType::Refund | AffirmEventType::RefundVoided => Self::AutoRefunded, ++ AffirmEventType::Update => Self::Pending, ++ AffirmEventType::Void | AffirmEventType::PartialVoid => Self::Voided, ++ } ++ } ++} ++ ++impl ++ TryFrom> ++ for RouterData ++{ ++ type Error = error_stack::Report; ++ fn try_from( ++ item: ResponseRouterData< ++ F, ++ AffirmCaptureResponse, ++ PaymentsCaptureData, ++ PaymentsResponseData, ++ >, ++ ) -> Result { ++ Ok(Self { ++ status: enums::AttemptStatus::from(item.response.event_type.clone()), ++ response: Ok(PaymentsResponseData::TransactionResponse { ++ resource_id: ResponseId::ConnectorTransactionId(item.response.id), ++ redirection_data: Box::new(None), ++ mandate_reference: Box::new(None), ++ connector_metadata: None, ++ network_txn_id: None, ++ connector_response_reference_id: None, ++ incremental_authorization_allowed: None, ++ charges: None, ++ }), ++ ..item.data ++ }) ++ } ++} ++ ++impl TryFrom<&PaymentsCancelRouterData> for AffirmCancelRequest { ++ type Error = error_stack::Report; ++ fn try_from(item: &PaymentsCancelRouterData) -> Result { ++ let request = &item.request; ++ ++ let reference_id = request.connector_transaction_id.clone(); ++ let amount = item ++ .request ++ .amount ++ .ok_or(errors::ConnectorError::MissingRequiredField { ++ field_name: "amount", ++ })?; ++ Ok(Self { ++ reference_id: Some(reference_id), ++ amount, ++ merchant_transaction_id: None, ++ }) ++ } ++} ++ ++#[derive(Debug, Serialize)] ++pub struct AffirmCancelRequest { ++ pub reference_id: Option, ++ pub amount: i64, ++ pub merchant_transaction_id: Option, ++} ++ ++#[derive(Debug, Clone, Serialize, Deserialize)] ++#[serde(rename_all = "snake_case")] ++pub struct AffirmCancelResponse { ++ pub id: String, ++ pub amount: MinorUnit, ++ pub created: String, ++ pub currency: Currency, ++ pub fee: Option, ++ pub fee_refunded: Option, ++ pub reference_id: Option, ++ #[serde(rename = "type")] ++ pub event_type: AffirmEventType, ++ pub settlement_transaction_id: Option, ++ pub transaction_id: String, ++ pub order_id: String, ++ pub shipping_carrier: Option, ++ pub shipping_confirmation: Option, ++ pub shipping: Option, ++ pub agent_alias: Option, ++ pub merchant_transaction_id: Option, ++} ++ ++impl ++ TryFrom> ++ for RouterData ++{ ++ type Error = error_stack::Report; ++ fn try_from( ++ item: ResponseRouterData, ++ ) -> Result { ++ Ok(Self { ++ status: enums::AttemptStatus::from(item.response.event_type.clone()), ++ response: Ok(PaymentsResponseData::TransactionResponse { ++ resource_id: ResponseId::ConnectorTransactionId(item.response.id), ++ redirection_data: Box::new(None), ++ mandate_reference: Box::new(None), ++ connector_metadata: None, ++ network_txn_id: None, ++ connector_response_reference_id: None, ++ incremental_authorization_allowed: None, ++ charges: None, ++ }), ++ ..item.data ++ }) ++ } + } +diff --git a/crates/hyperswitch_connectors/src/default_implementations.rs b/crates/hyperswitch_connectors/src/default_implementations.rs +index 64c30a93..6b8b4948 100644 +--- a/crates/hyperswitch_connectors/src/default_implementations.rs ++++ b/crates/hyperswitch_connectors/src/default_implementations.rs +@@ -1143,7 +1143,6 @@ default_imp_for_complete_authorize!( + connectors::Aci, + connectors::Adyen, + connectors::Adyenplatform, +- connectors::Affirm, + connectors::Amazonpay, + connectors::Archipel, + connectors::Authipay, +diff --git a/crates/router/src/core/connector_validation.rs b/crates/router/src/core/connector_validation.rs +index a0665a4f..d5c9fbc9 100644 +--- a/crates/router/src/core/connector_validation.rs ++++ b/crates/router/src/core/connector_validation.rs +@@ -80,6 +80,10 @@ impl ConnectorAuthTypeAndMetadataValidation<'_> { + )?; + Ok(()) + } ++ api_enums::Connector::Affirm => { ++ affirm::transformers::AffirmAuthType::try_from(self.auth_type)?; ++ Ok(()) ++ } + api_enums::Connector::Airwallex => { + airwallex::transformers::AirwallexAuthType::try_from(self.auth_type)?; + Ok(()) +diff --git a/crates/router/src/types/api/connector_mapping.rs b/crates/router/src/types/api/connector_mapping.rs +index 18868042..1298296f 100644 +--- a/crates/router/src/types/api/connector_mapping.rs ++++ b/crates/router/src/types/api/connector_mapping.rs +@@ -108,6 +108,9 @@ impl ConnectorData { + enums::Connector::Adyen => { + Ok(ConnectorEnum::Old(Box::new(connector::Adyen::new()))) + } ++ enums::Connector::Affirm => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Affirm::new()))) ++ } + enums::Connector::Adyenplatform => Ok(ConnectorEnum::Old(Box::new( + connector::Adyenplatform::new(), + ))), +diff --git a/crates/router/src/types/api/feature_matrix.rs b/crates/router/src/types/api/feature_matrix.rs +index 8d5ff7d4..95150d98 100644 +--- a/crates/router/src/types/api/feature_matrix.rs ++++ b/crates/router/src/types/api/feature_matrix.rs +@@ -22,6 +22,9 @@ impl FeatureMatrixConnectorData { + enums::Connector::Adyen => { + Ok(ConnectorEnum::Old(Box::new(connector::Adyen::new()))) + } ++ enums::Connector::Affirm => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Affirm::new()))) ++ } + enums::Connector::Adyenplatform => Ok(ConnectorEnum::Old(Box::new( + connector::Adyenplatform::new(), + ))), +diff --git a/crates/router/src/types/connector_transformers.rs b/crates/router/src/types/connector_transformers.rs +index 9d7c568c..05321d29 100644 +--- a/crates/router/src/types/connector_transformers.rs ++++ b/crates/router/src/types/connector_transformers.rs +@@ -9,6 +9,7 @@ impl ForeignTryFrom for common_enums::RoutableConnectors { + Ok(match from { + api_enums::Connector::Aci => Self::Aci, + api_enums::Connector::Adyen => Self::Adyen, ++ api_enums::Connector::Affirm => Self::Affirm, + api_enums::Connector::Adyenplatform => Self::Adyenplatform, + api_enums::Connector::Airwallex => Self::Airwallex, + // api_enums::Connector::Amazonpay => Self::Amazonpay, +diff --git a/cypress-tests/cypress/e2e/configs/mock-server/Connectors/Affirm.ts b/cypress-tests/cypress/e2e/configs/mock-server/Connectors/Affirm.ts +new file mode 100644 +index 00000000..7d01d634 +--- /dev/null ++++ b/cypress-tests/cypress/e2e/configs/mock-server/Connectors/Affirm.ts +@@ -0,0 +1,359 @@ ++/* eslint-disable no-console */ ++import * as express from "express"; ++import type { NextFunction, Request, Response, Router } from "express"; ++import cors from "cors"; ++import { Buffer } from "buffer"; ++ ++const router: Router = express.default.Router(); ++const PORT = process.env.PORT || 3011; // Using a different port for Affirm ++ ++// Middleware ++router.use(cors()); ++router.use(express.default.json()); ++router.use(express.default.urlencoded({ extended: true })); ++ ++// Mock data storage ++interface MockData { ++ transactions: Record; ++ refunds: Record; ++ checkouts: Record; ++} ++ ++const mockData: MockData = { ++ transactions: {}, ++ refunds: {}, ++ checkouts: {}, ++}; ++ ++// Valid API keys (public_key:private_key) ++const validApiKeys: Record = { ++ public_key_123: "private_key_456", ++}; ++ ++// Helper functions ++function generateId(prefix: string): string { ++ return `${prefix}_${Math.random().toString(36).substr(2, 16)}`; ++} ++ ++function getCurrentTimestamp(): string { ++ return new Date().toISOString(); ++} ++ ++// Authentication middleware ++function authenticateApiKey( ++ req: Request, ++ res: Response, ++ next: NextFunction ++): void { ++ const authHeader = req.headers.authorization; ++ ++ if (!authHeader || !authHeader.startsWith("Basic ")) { ++ res.status(401).json({ ++ status_code: 401, ++ code: "unauthorized", ++ message: "Missing or invalid Authorization header", ++ error_type: "authentication_error", ++ }); ++ return; ++ } ++ ++ const token = authHeader.split(" ")[1]; ++ const decodedToken = Buffer.from(token, "base64").toString("utf8"); ++ const [publicKey, privateKey] = decodedToken.split(":"); ++ ++ if (!publicKey || !privateKey || validApiKeys[publicKey] !== privateKey) { ++ res.status(401).json({ ++ status_code: 401, ++ code: "unauthorized", ++ message: "Invalid API key", ++ error_type: "authentication_error", ++ }); ++ return; ++ } ++ ++ next(); ++} ++ ++// Logging middleware ++router.use((req: Request, res: Response, next: NextFunction): void => { ++ console.log( ++ `[Affirm Mock] ${new Date().toISOString()} - ${req.method} ${req.path}` ++ ); ++ if (Object.keys(req.headers).length > 0) ++ console.log("Headers:", JSON.stringify(req.headers, null, 2)); ++ if (Object.keys(req.body).length > 0) ++ console.log("Body:", JSON.stringify(req.body, null, 2)); ++ next(); ++}); ++ ++// Health check endpoint ++router.get("/health", (req: Request, res: Response): void => { ++ res.json({ ++ status: "success", ++ msg: "Affirm Mock Server is running", ++ timestamp: getCurrentTimestamp(), ++ }); ++}); ++ ++// 1. POST /v2/checkout/direct - Create a checkout ++router.post( ++ "/v2/checkout/direct", ++ authenticateApiKey, ++ (req: Request, res: Response) => { ++ const { merchant, total } = req.body; ++ ++ if (!merchant || !total) { ++ return res.status(400).json({ ++ status_code: 400, ++ code: "bad_request", ++ message: "Missing required fields", ++ error_type: "invalid_request_error", ++ }); ++ } ++ ++ const checkoutId = generateId("checkout"); ++ const redirectUrl = `${merchant.user_confirmation_url}?checkout_token=${checkoutId}`; ++ ++ const checkout = { ++ checkout_id: checkoutId, ++ redirect_url: redirectUrl, ++ ...req.body, ++ }; ++ mockData.checkouts[checkoutId] = checkout; ++ ++ res.status(200).json({ ++ checkout_id: checkoutId, ++ redirect_url: redirectUrl, ++ }); ++ } ++); ++ ++// 2. POST /v1/transactions - Complete authorize (read charge) ++router.post( ++ "/v1/transactions", ++ authenticateApiKey, ++ (req: Request, res: Response) => { ++ const { transaction_id } = req.body; ++ ++ if (!transaction_id) { ++ return res.status(400).json({ ++ status_code: 400, ++ code: "bad_request", ++ message: "Missing transaction_id", ++ error_type: "invalid_request_error", ++ }); ++ } ++ ++ const checkout = mockData.checkouts[transaction_id]; ++ if (!checkout) { ++ return res.status(404).json({ ++ status_code: 404, ++ code: "not_found", ++ message: "Checkout not found", ++ error_type: "invalid_request_error", ++ }); ++ } ++ ++ const transactionId = generateId("txn"); ++ const now = getCurrentTimestamp(); ++ const transaction = { ++ id: transactionId, ++ status: "authorized", ++ amount: checkout.total, ++ currency: checkout.currency, ++ created: now, ++ order_id: checkout.order_id, ++ checkout_id: transaction_id, ++ events: [ ++ { ++ id: generateId("evt"), ++ type: "auth", ++ created: now, ++ }, ++ ], ++ }; ++ mockData.transactions[transactionId] = transaction; ++ ++ res.status(200).json(transaction); ++ } ++); ++ ++// 3. GET /v1/transactions/:transactionId - PSync ++router.get( ++ "/v1/transactions/:transactionId", ++ authenticateApiKey, ++ (req: Request, res: Response) => { ++ const { transactionId } = req.params; ++ const transaction = mockData.transactions[transactionId]; ++ ++ if (!transaction) { ++ return res.status(404).json({ ++ status_code: 404, ++ code: "not_found", ++ message: "Transaction not found", ++ error_type: "invalid_request_error", ++ }); ++ } ++ ++ res.status(200).json(transaction); ++ } ++); ++ ++// 4. POST /v1/transactions/:transactionId/capture - Capture ++router.post( ++ "/v1/transactions/:transactionId/capture", ++ authenticateApiKey, ++ (req: Request, res: Response) => { ++ const { transactionId } = req.params; ++ const transaction = mockData.transactions[transactionId]; ++ ++ if (!transaction) { ++ return res.status(404).json({ ++ status_code: 404, ++ code: "not_found", ++ message: "Transaction not found", ++ error_type: "invalid_request_error", ++ }); ++ } ++ ++ if (transaction.status !== "authorized") { ++ return res.status(400).json({ ++ status_code: 400, ++ code: "bad_request", ++ message: "Transaction is not authorized", ++ error_type: "invalid_request_error", ++ }); ++ } ++ ++ transaction.status = "captured"; ++ const event = { ++ id: generateId("evt"), ++ type: "capture", ++ created: getCurrentTimestamp(), ++ }; ++ transaction.events.push(event); ++ ++ res.status(200).json(event); ++ } ++); ++ ++// 5. POST /v1/transactions/:transactionId/void - Void ++router.post( ++ "/v1/transactions/:transactionId/void", ++ authenticateApiKey, ++ (req: Request, res: Response) => { ++ const { transactionId } = req.params; ++ const transaction = mockData.transactions[transactionId]; ++ ++ if (!transaction) { ++ return res.status(404).json({ ++ status_code: 404, ++ code: "not_found", ++ message: "Transaction not found", ++ error_type: "invalid_request_error", ++ }); ++ } ++ ++ if (transaction.status === "captured") { ++ return res.status(400).json({ ++ status_code: 400, ++ code: "bad_request", ++ message: "Cannot void a captured transaction", ++ error_type: "invalid_request_error", ++ }); ++ } ++ ++ transaction.status = "voided"; ++ const event = { ++ id: generateId("evt"), ++ type: "void", ++ created: getCurrentTimestamp(), ++ }; ++ transaction.events.push(event); ++ ++ res.status(200).json(event); ++ } ++); ++ ++// 6. POST /v1/transactions/:transactionId/refund - Refund ++router.post( ++ "/v1/transactions/:transactionId/refund", ++ authenticateApiKey, ++ (req: Request, res: Response) => { ++ const { transactionId } = req.params; ++ const { amount } = req.body; ++ const transaction = mockData.transactions[transactionId]; ++ ++ if (!transaction) { ++ return res.status(404).json({ ++ status_code: 404, ++ code: "not_found", ++ message: "Transaction not found", ++ error_type: "invalid_request_error", ++ }); ++ } ++ ++ if (transaction.status !== "captured") { ++ return res.status(400).json({ ++ status_code: 400, ++ code: "bad_request", ++ message: "Cannot refund a non-captured transaction", ++ error_type: "invalid_request_error", ++ }); ++ } ++ ++ if (amount > transaction.amount) { ++ return res.status(400).json({ ++ status_code: 400, ++ code: "bad_request", ++ message: "Refund amount exceeds transaction amount", ++ error_type: "invalid_request_error", ++ }); ++ } ++ ++ const refundId = generateId("ref"); ++ const now = getCurrentTimestamp(); ++ const refund = { ++ id: refundId, ++ amount, ++ created: now, ++ currency: transaction.currency, ++ transaction_id: transactionId, ++ type: "refund", ++ }; ++ mockData.refunds[refundId] = refund; ++ ++ transaction.status = "refunded"; ++ transaction.events.push(refund); ++ ++ res.status(200).json(refund); ++ } ++); ++ ++// Error handling middleware ++router.use( ++ (err: Error, req: Request, res: Response, _next: NextFunction): void => { ++ console.error("[Affirm Mock] Error:", err); ++ res.status(500).json({ ++ status_code: 500, ++ code: "internal_server_error", ++ message: "An unexpected error occurred", ++ error_type: "api_error", ++ }); ++ } ++); ++ ++// 404 handler ++router.use((req: Request, res: Response): void => { ++ res.status(404).json({ ++ status_code: 404, ++ code: "not_found", ++ message: `Endpoint ${req.method} ${req.originalUrl} not found`, ++ error_type: "invalid_request_error", ++ }); ++}); ++ ++console.log(`🚀 Affirm Mock Server running on port ${PORT}`); ++console.log(`📍 Server URL: http://localhost:${PORT}`); ++ ++export default router; +diff --git a/cypress-tests/cypress/e2e/configs/mock-server/Creds.json b/cypress-tests/cypress/e2e/configs/mock-server/Creds.json +index dbe1719f..87c20fd9 100644 +--- a/cypress-tests/cypress/e2e/configs/mock-server/Creds.json ++++ b/cypress-tests/cypress/e2e/configs/mock-server/Creds.json +@@ -12,5 +12,12 @@ + "key1": "testsecret456", + "api_secret": "testsecret456" + } ++ }, ++ "affirm": { ++ "connector_account_details": { ++ "auth_type": "BodyKey", ++ "api_key": "affirm-testkey123", ++ "key1": "affirm-testsecret456" ++ } + } + } +diff --git a/cypress-tests/cypress/e2e/configs/mock-server/router.ts b/cypress-tests/cypress/e2e/configs/mock-server/router.ts +index f1491773..963acfda 100644 +--- a/cypress-tests/cypress/e2e/configs/mock-server/router.ts ++++ b/cypress-tests/cypress/e2e/configs/mock-server/router.ts +@@ -10,6 +10,7 @@ import type { + // Import from TypeScript version + import silverflowApp from "./Connectors/Silverflow.ts"; + import celeroApp from "./Connectors/Celero.ts"; ++import affirmApp from "./Connectors/Affirm.ts"; + + // TODO: Update to import from TypeScript version once fully tested + // import silverflowApp from "./Silverflow"; +@@ -21,6 +22,7 @@ interface MockRouters { + const mockRouters: MockRouters = { + silverflow: silverflowApp, + celero: celeroApp, ++ affirm: affirmApp, + }; + + // Create a router +diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml +index 9b81a63e..b49713eb 100644 +--- a/loadtest/config/development.toml ++++ b/loadtest/config/development.toml +@@ -425,6 +425,9 @@ paypal = { country = "AU,NZ,CN,JP,HK,MY,TH,KR,PH,ID,AE,KW,BR,ES,GB,SE,NO,SK,AT,N + klarna = { country = "AU,AT,BE,CA,CZ,DK,FI,FR,DE,GR,IE,IT,NO,PL,PT,RO,ES,SE,CH,NL,GB,US", currency = "AUD,EUR,CAD,CZK,DKK,NOK,PLN,RON,SEK,CHF,GBP,USD" } + ideal = { country = "NL", currency = "EUR" } + ++[pm_filters.affirm] ++affirm = { country = "CA,US", currency = "CAD,USD" } ++ + [pm_filters.bambora] + credit = { country = "US,CA", currency = "USD" } + debit = { country = "US,CA", currency = "USD" } + +----- END CHUNK ----- \ No newline at end of file diff --git a/raw/b1/b1486f8bd31dbe741ac01f36053bc4a2f3eaaa78.txt b/raw/b1/b1486f8bd31dbe741ac01f36053bc4a2f3eaaa78.txt new file mode 100644 index 0000000000000000000000000000000000000000..6196651432130ab210a2fafbf9091aa84761f83e --- /dev/null +++ b/raw/b1/b1486f8bd31dbe741ac01f36053bc4a2f3eaaa78.txt @@ -0,0 +1,817 @@ +ROUTE: juspay/hyperswitch@b1486f8bd31dbe741ac01f36053bc4a2f3eaaa78 +REPO: https://github.com/juspay/hyperswitch +COMMIT: b1486f8bd31dbe741ac01f36053bc4a2f3eaaa78 +AUTHOR: AkshayaFoiger <131388445+AkshayaFoiger@users.noreply.github.com> +DATE: 2025-08-22T12:38:55 + +=== ISSUE_AND_PR === +[PR #9031] fix(connectors): [worldpayvantiv] map cnp_txn_id to connector_txn_id and enforce max length for customer_id and connector_request_reference_id +URL: https://github.com/juspay/hyperswitch/pull/9031 +BODY: +## Type of Change + + +- [x] Bugfix +- [ ] New feature +- [x] Enhancement +- [ ] Refactoring +- [ ] Dependency updates +- [ ] Documentation +- [ ] CI/CD + +## Description + +This Pr fixes the following +1.Maps cnp_txn_id to connector_transaction_id in error responses when cnp_txn_id is present. +2.Enforces maximum length validation for customer_id and connector_request_reference_id. +3.Maps merchant_order_reference to customer_reference. Since we currently don’t accept any customer-provided ID, merchant_order_reference is used as the customer_reference. + + + +## How did you test it? + +
+ Test Payment Reference ID +
+
+ Payment Create without passing payment_id + +``` +curl --location 'http://localhost:8080/payments' \ +--header 'Content-Type: application/json' \ +--header 'Accept: application/json' \ +--header 'api-key: dev_N4Kk872pMhxmIKSazZbKqAzQfpHKxRtRKqB6JHDvd2Dy3yvBeIjvbRNfP7CMpNw0' \ +--data '{ + "amount":100, + "currency": "USD", + "confirm": true, + "capture_method": "automatic", + "customer_id": "aaaa", + "payment_method": "card", + + "payment_method_data": { + "card": { + "card_number": "371449635398431", + "card_exp_month": "03", + "card_exp_year": "30", + + "card_cvc": "7373" + + } + }, + + + "browser_info": { + "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36", + "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8", + "language": "nl-NL", + "color_depth": 24, + "screen_height": 723, + "screen_width": 1536, + "time_zone": 0, + "java_enabled": true, + "java_script_enabled": true, + "ip_address": "13.232.74.226" + } +}' +``` +Response +``` +{"payment_id":"pay_RtqW1aiJvJqKbbou3dBf","merchant_id":"postman_merchant_GHAction_ddbb3a5f-2662-42ea-8552-0e837234ea86","status":"processing","amount":100,"net_amount":100,"shipping_cost":null,"amount_capturable":100,"amount_received":null,"connector":"worldpayvantiv","client_secret":"pay_RtqW1aiJvJqKbbou3dBf_secret_j55H6oN8k7awIJ9wlE8x","created":"2025-08-22T08:38:01.856Z","currency":"USD","customer_id":"aaaa","customer":{"id":"aaaa","name":null,"email":null,"phone":null,"phone_country_code":null},"description":null,"refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":null,"off_session":null,"capture_on":null,"capture_method":"automatic","payment_method":"card","payment_method_data":{"card":{"last4":"8431","card_type":null,"card_network":null,"card_issuer":null,"card_issuing_country":null,"card_isin":"371449","card_extended_bin":null,"card_exp_month":"03","card_exp_year":"30","card_holder_name":null,"payment_checks":{"avs_result":"02","advanced_a_v_s_result":null,"authentication_result":null,"card_validation_result":"M"},"authentication_data":null},"billing":null},"payment_token":null,"shipping":null,"billing":null,"order_details":null,"email":null,"name":null,"phone":null,"return_url":null,"authentication_type":"no_three_ds","statement_descriptor_name":null,"statement_descriptor_suffix":null,"next_action":null,"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":null,"payment_method_type":null,"connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":{"customer_id":"aaaa","created_at":1755851881,"expires":1755855481,"secret":"epk_e4f67de6065a47f69b7dd62a6b676536"},"manual_retry_allowed":false,"connector_transaction_id":"84085436440119947","frm_message":null,"metadata":null,"connector_metadata":null,"feature_metadata":{"redirect_response":null,"search_tags":null,"apple_pay_recurring_details":null,"gateway_system":"direct"},"reference_id":"722914851615","payment_link":null,"profile_id":"pro_l1p84NUKtcjTefm3Cvx1","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_hUK6008UqqyNo8IcS7Al","incremental_authorization_allowed":false,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-08-22T08:53:01.856Z","fingerprint":null,"browser_info":{"language":"nl-NL","time_zone":0,"ip_address":"13.232.74.226","user_agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36","color_depth":24,"java_enabled":true,"screen_width":1536,"accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","screen_height":723,"java_script_enabled":true},"payment_channel":null,"payment_method_id":null,"network_transaction_id":null,"payment_method_status":null,"updated":"2025-08-22T08:38:05.188Z","split_payments":null,"frm_metadata":null,"extended_authorization_applied":null,"capture_before":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":null,"card_discovery":"manual","force_3ds_challenge":false,"force_3ds_challenge_trigger":false,"issuer_error_code":null,"issuer_error_message":null,"is_iframe_redirection_enabled":null,"whole_connector_response":null,"enable_partial_authorization":null} +``` + +Psync + +``` +{"payment_id":"pay_RtqW1aiJvJqKbbou3dBf","merchant_id":"postman_merchant_GHAction_ddbb3a5f-2662-42ea-8552-0e837234ea86","status":"succeeded","amount":100,"net_amount":100,"shipping_cost":null,"amount_capturable":0,"amount_received":100,"connector":"worldpayvantiv","client_secret":"pay_RtqW1aiJvJqKbbou3dBf_secret_j55H6oN8k7awIJ9wlE8x","created":"2025-08-22T08:38:01.856Z","currency":"USD","customer_id":"aaaa","customer":{"id":"aaaa","name":null,"email":null,"phone":null,"phone_country_code":null},"description":null,"refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":null,"off_session":null,"capture_on":null,"capture_method":"automatic","payment_method":"card","payment_method_data":{"card":{"last4":"8431","card_type":null,"card_network":null,"card_issuer":null,"card_issuing_country":null,"card_isin":"371449","card_extended_bin":null,"card_exp_month":"03","card_exp_year":"30","card_holder_name":null,"payment_checks":{"avs_result":"02","advanced_a_v_s_result":null,"authentication_result":null,"card_validation_result":"M"},"authentication_data":null},"billing":null},"payment_token":null,"shipping":null,"billing":null,"order_details":null,"email":null,"name":null,"phone":null,"return_url":null,"authentication_type":"no_three_ds","statement_descriptor_name":null,"statement_descriptor_suffix":null,"next_action":null,"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":null,"payment_method_type":null,"connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":null,"manual_retry_allowed":false,"connector_transaction_id":"84085436440119947","frm_message":null,"metadata":null,"connector_metadata":null,"feature_metadata":{"redirect_response":null,"search_tags":null,"apple_pay_recurring_details":null,"gateway_system":"direct"},"reference_id":"722914851615","payment_link":null,"profile_id":"pro_l1p84NUKtcjTefm3Cvx1","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_hUK6008UqqyNo8IcS7Al","incremental_authorization_allowed":false,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-08-22T08:53:01.856Z","fingerprint":null,"browser_info":{"language":"nl-NL","time_zone":0,"ip_address":"13.232.74.226","user_agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36","color_depth":24,"java_enabled":true,"screen_width":1536,"accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","screen_height":723,"java_script_enabled":true},"payment_channel":null,"payment_method_id":null,"network_transaction_id":null,"payment_method_status":null,"updated":"2025-08-22T08:38:16.022Z","split_payments":null,"frm_metadata":null,"extended_authorization_applied":null,"capture_before":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":null,"card_discovery":"manual","force_3ds_challenge":false,"force_3ds_challenge_trigger":false,"issuer_error_code":null,"issuer_error_message":null,"is_iframe_redirection_enabled":null,"whole_connector_response":null,"enable_partial_authorization":null} +``` +
+
+
+Payment Create by passing payment_id with 28 characters + +``` +curl --location 'http://localhost:8080/payments' \ +--header 'Content-Type: application/json' \ +--header 'Accept: application/json' \ +--header 'api-key: dev_N4Kk872pMhxmIKSazZbKqAzQfpHKxRtRKqB6JHDvd2Dy3yvBeIjvbRNfP7CMpNw0' \ +--data '{ + "amount":100, + "currency": "USD", + "confirm": true, + "capture_method": "automatic", + "payment_id": "1234567891234567891234567891", + "customer_id": "aaaa", + "payment_method": "card", + "payment_method_data": { + "card": { + "card_number": "371449635398431", + "card_exp_month": "03", + "card_exp_year": "30", + + "card_cvc": "7373" + + } + }, + "browser_info": { + "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36", + "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8", + "language": "nl-NL", + "color_depth": 24, + "screen_height": 723, + "screen_width": 1536, + "time_zone": 0, + "java_enabled": true, + "java_script_enabled": true, + "ip_address": "13.232.74.226" + } +}' +``` +Response +``` +{"payment_id":"1234567891234567891234567891","merchant_id":"postman_merchant_GHAction_ddbb3a5f-2662-42ea-8552-0e837234ea86","status":"processing","amount":100,"net_amount":100,"shipping_cost":null,"amount_capturable":100,"amount_received":null,"connector":"worldpayvantiv","client_secret":"1234567891234567891234567891_secret_0Rjkpe7kGLRs93Q6Q20i","created":"2025-08-22T08:41:22.344Z","currency":"USD","customer_id":"aaaa","customer":{"id":"aaaa","name":null,"email":null,"phone":null,"phone_country_code":null},"description":null,"refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":null,"off_session":null,"capture_on":null,"capture_method":"automatic","payment_method":"card","payment_method_data":{"card":{"last4":"8431","card_type":null,"card_network":null,"card_issuer":null,"card_issuing_country":null,"card_isin":"371449","card_extended_bin":null,"card_exp_month":"03","card_exp_year":"30","card_holder_name":null,"payment_checks":{"avs_result":"02","advanced_a_v_s_result":null,"authentication_result":null,"card_validation_result":"M"},"authentication_data":null},"billing":null},"payment_token":null,"shipping":null,"billing":null,"order_details":null,"email":null,"name":null,"phone":null,"return_url":null,"authentication_type":"no_three_ds","statement_descriptor_name":null,"statement_descriptor_suffix":null,"next_action":null,"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":null,"payment_method_type":null,"connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":{"customer_id":"aaaa","created_at":1755852082,"expires":1755855682,"secret":"epk_ae78361207794ae793784a79a4bf0440"},"manual_retry_allowed":false,"connector_transaction_id":"84085436440147989","frm_message":null,"metadata":null,"connector_metadata":null,"feature_metadata":{"redirect_response":null,"search_tags":null,"apple_pay_recurring_details":null,"gateway_system":"direct"},"reference_id":"350830977505","payment_link":null,"profile_id":"pro_l1p84NUKtcjTefm3Cvx1","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_hUK6008UqqyNo8IcS7Al","incremental_authorization_allowed":false,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-08-22T08:56:22.344Z","fingerprint":null,"browser_info":{"language":"nl-NL","time_zone":0,"ip_address":"13.232.74.226","user_agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36","color_depth":24,"java_enabled":true,"screen_width":1536,"accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","screen_height":723,"java_script_enabled":true},"payment_channel":null,"payment_method_id":null,"network_transaction_id":null,"payment_method_status":null,"updated":"2025-08-22T08:41:23.419Z","split_payments":null,"frm_metadata":null,"extended_authorization_applied":null,"capture_before":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":null,"card_discovery":"manual","force_3ds_challenge":false,"force_3ds_challenge_trigger":false,"issuer_error_code":null,"issuer_error_message":null,"is_iframe_redirection_enabled":null,"whole_connector_response":null,"enable_partial_authorization":null} +``` + +Psync +``` +{"payment_id":"1234567891234567891234567891","merchant_id":"postman_merchant_GHAction_ddbb3a5f-2662-42ea-8552-0e837234ea86","status":"succeeded","amount":100,"net_amount":100,"shipping_cost":null,"amount_capturable":0,"amount_received":100,"connector":"worldpayvantiv","client_secret":"1234567891234567891234567891_secret_0Rjkpe7kGLRs93Q6Q20i","created":"2025-08-22T08:41:22.344Z","currency":"USD","customer_id":"aaaa","customer":{"id":"aaaa","name":null,"email":null,"phone":null,"phone_country_code":null},"description":null,"refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":null,"off_session":null,"capture_on":null,"capture_method":"automatic","payment_method":"card","payment_method_data":{"card":{"last4":"8431","card_type":null,"card_network":null,"card_issuer":null,"card_issuing_country":null,"card_isin":"371449","card_extended_bin":null,"card_exp_month":"03","card_exp_year":"30","card_holder_name":null,"payment_checks":{"avs_result":"02","advanced_a_v_s_result":null,"authentication_result":null,"card_validation_result":"M"},"authentication_data":null},"billing":null},"payment_token":null,"shipping":null,"billing":null,"order_details":null,"email":null,"name":null,"phone":null,"return_url":null,"authentication_type":"no_three_ds","statement_descriptor_name":null,"statement_descriptor_suffix":null,"next_action":null,"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":null,"payment_method_type":null,"connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":null,"manual_retry_allowed":false,"connector_transaction_id":"84085436440147989","frm_message":null,"metadata":null,"connector_metadata":null,"feature_metadata":{"redirect_response":null,"search_tags":null,"apple_pay_recurring_details":null,"gateway_system":"direct"},"reference_id":"350830977505","payment_link":null,"profile_id":"pro_l1p84NUKtcjTefm3Cvx1","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_hUK6008UqqyNo8IcS7Al","incremental_authorization_allowed":false,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-08-22T08:56:22.344Z","fingerprint":null,"browser_info":{"language":"nl-NL","time_zone":0,"ip_address":"13.232.74.226","user_agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36","color_depth":24,"java_enabled":true,"screen_width":1536,"accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","screen_height":723,"java_script_enabled":true},"payment_channel":null,"payment_method_id":null,"network_transaction_id":null,"payment_method_status":null,"updated":"2025-08-22T08:42:35.299Z","split_payments":null,"frm_metadata":null,"extended_authorization_applied":null,"capture_before":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":null,"card_discovery":"manual","force_3ds_challenge":false,"force_3ds_challenge_trigger":false,"issuer_error_code":null,"issuer_error_message":null,"is_iframe_redirection_enabled":null,"whole_connector_response":null,"enable_partial_authorization":null} +``` +
+
+
+Payment Create by passing payment_id with more than 30 characters + +``` + +curl --location 'http://localhost:8080/payments' \ +--header 'Content-Type: application/json' \ +--header 'Accept: application/json' \ +--header 'api-key: dev_N4Kk872pMhxmIKSazZbKqAzQfpHKxRtRKqB6JHDvd2Dy3yvBeIjvbRNfP7CMpNw0' \ +--data '{ + "amount":100, + "currency": "USD", + "confirm": true, + "capture_method": "automatic", + + "payment_id": "X7a9Bq2Lm8Rt4Nv6Pw3KyeHd0Gd5797965", + + "customer_id": "aaaa", + "payment_method": "card", + + "payment_method_data": { + "card": { + "card_number": "371449635398431", + "card_exp_month": "03", + "card_exp_year": "30", + + "card_cvc": "7373" + + } + }, + + "browser_info": { + "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36", + "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8", + "language": "nl-NL", + "color_depth": 24, + "screen_height": 723, + "screen_width": 1536, + "time_zone": 0, + "java_enabled": true, + "java_script_enabled": true, + "ip_address": "13.232.74.226" + } +}' +``` +Response +``` +{"payment_id":"X7a9Bq2Lm8Rt4Nv6Pw3KyeHd0Gd5797965","merchant_id":"postman_merchant_GHAction_ddbb3a5f-2662-42ea-8552-0e837234ea86","status":"processing","amount":100,"net_amount":100,"shipping_cost":null,"amount_capturable":100,"amount_received":null,"connector":"worldpayvantiv","client_secret":"X7a9Bq2Lm8Rt4Nv6Pw3KyeHd0Gd5797965_secret_TVtDnJmiIjcNYg8eAeyX","created":"2025-08-22T08:50:27.027Z","currency":"USD","customer_id":"aaaa","customer":{"id":"aaaa","name":null,"email":null,"phone":null,"phone_country_code":null},"description":null,"refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":null,"off_session":null,"capture_on":null,"capture_method":"automatic","payment_method":"card","payment_method_data":{"card":{"last4":"8431","card_type":null,"card_network":null,"card_issuer":null,"card_issuing_country":null,"card_isin":"371449","card_extended_bin":null,"card_exp_month":"03","card_exp_year":"30","card_holder_name":null,"payment_checks":{"avs_result":"02","advanced_a_v_s_result":null,"authentication_result":null,"card_validation_result":"M"},"authentication_data":null},"billing":null},"payment_token":null,"shipping":null,"billing":null,"order_details":null,"email":null,"name":null,"phone":null,"return_url":null,"authentication_type":"no_three_ds","statement_descriptor_name":null,"statement_descriptor_suffix":null,"next_action":null,"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":null,"payment_method_type":null,"connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":{"customer_id":"aaaa","created_at":1755852626,"expires":1755856226,"secret":"epk_9b06dad3189642e6b509d28d42cf0ce1"},"manual_retry_allowed":false,"connector_transaction_id":"84085436620745420","frm_message":null,"metadata":null,"connector_metadata":null,"feature_metadata":{"redirect_response":null,"search_tags":null,"apple_pay_recurring_details":null,"gateway_system":"direct"},"reference_id":"878812383960","payment_link":null,"profile_id":"pro_l1p84NUKtcjTefm3Cvx1","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_hUK6008UqqyNo8IcS7Al","incremental_authorization_allowed":false,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-08-22T09:05:27.027Z","fingerprint":null,"browser_info":{"language":"nl-NL","time_zone":0,"ip_address":"13.232.74.226","user_agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36","color_depth":24,"java_enabled":true,"screen_width":1536,"accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","screen_height":723,"java_script_enabled":true},"payment_channel":null,"payment_method_id":null,"network_transaction_id":null,"payment_method_status":null,"updated":"2025-08-22T08:50:27.475Z","split_payments":null,"frm_metadata":null,"extended_authorization_applied":null,"capture_before":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":null,"card_discovery":"manual","force_3ds_challenge":false,"force_3ds_challenge_trigger":false,"issuer_error_code":null,"issuer_error_message":null,"is_iframe_redirection_enabled":null,"whole_connector_response":null,"enable_partial_authorization":null} +``` + +> Note: In this case is_config_enabled_to_send_payment_id_as_connector_request_id is not enabled hence we will send the id we generate + +Psync + +``` +{"payment_id":"X7a9Bq2Lm8Rt4Nv6Pw3KyeHd0Gd5797965","merchant_id":"postman_merchant_GHAction_ddbb3a5f-2662-42ea-8552-0e837234ea86","status":"succeeded","amount":100,"net_amount":100,"shipping_cost":null,"amount_capturable":0,"amount_received":100,"connector":"worldpayvantiv","client_secret":"X7a9Bq2Lm8Rt4Nv6Pw3KyeHd0Gd5797965_secret_TVtDnJmiIjcNYg8eAeyX","created":"2025-08-22T08:50:27.027Z","currency":"USD","customer_id":"aaaa","customer":{"id":"aaaa","name":null,"email":null,"phone":null,"phone_country_code":null},"description":null,"refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":null,"off_session":null,"capture_on":null,"capture_method":"automatic","payment_method":"card","payment_method_data":{"card":{"last4":"8431","card_type":null,"card_network":null,"card_issuer":null,"card_issuing_country":null,"card_isin":"371449","card_extended_bin":null,"card_exp_month":"03","card_exp_year":"30","card_holder_name":null,"payment_checks":{"avs_result":"02","advanced_a_v_s_result":null,"authentication_result":null,"card_validation_result":"M"},"authentication_data":null},"billing":null},"payment_token":null,"shipping":null,"billing":null,"order_details":null,"email":null,"name":null,"phone":null,"return_url":null,"authentication_type":"no_three_ds","statement_descriptor_name":null,"statement_descriptor_suffix":null,"next_action":null,"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":null,"payment_method_type":null,"connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":null,"manual_retry_allowed":false,"connector_transaction_id":"84085436620745420","frm_message":null,"metadata":null,"connector_metadata":null,"feature_metadata":{"redirect_response":null,"search_tags":null,"apple_pay_recurring_details":null,"gateway_system":"direct"},"reference_id":"878812383960","payment_link":null,"profile_id":"pro_l1p84NUKtcjTefm3Cvx1","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_hUK6008UqqyNo8IcS7Al","incremental_authorization_allowed":false,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-08-22T09:05:27.027Z","fingerprint":null,"browser_info":{"language":"nl-NL","time_zone":0,"ip_address":"13.232.74.226","user_agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36","color_depth":24,"java_enabled":true,"screen_width":1536,"accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","screen_height":723,"java_script_enabled":true},"payment_channel":null,"payment_method_id":null,"network_transaction_id":null,"payment_method_status":null,"updated":"2025-08-22T08:52:51.713Z","split_payments":null,"frm_metadata":null,"extended_authorization_applied":null,"capture_before":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":null,"card_discovery":"manual","force_3ds_challenge":false,"force_3ds_challenge_trigger":false,"issuer_error_code":null,"issuer_error_message":null,"is_iframe_redirection_enabled":null,"whole_connector_response":null,"enable_partial_authorization":null} +``` + +
+
+ Payment Create by passing payment_id with 28 characters with is_config_enabled_to_send_payment_id_as_connector_request_id enabled + +```curl +curl --location 'http://localhost:8080/payments' \ +--header 'Content-Type: application/json' \ +--header 'Accept: application/json' \ +--header 'api-key: dev_N4Kk872pMhxmIKSazZbKqAzQfpHKxRtRKqB6JHDvd2Dy3yvBeIjvbRNfP7CMpNw0' \ +--data '{ + "amount":100, + "currency": "USD", + "confirm": true, + "capture_method": "automatic", + "payment_id": "X7a9Bq2Lm8Rt4Nv6Pw3Ky5Hd0Gc", + "customer_id": "aaaa", + "payment_method": "card", + "payment_method_data": { + "card": { + "card_number": "371449635398431", + "card_exp_month": "03", + "card_exp_year": "30", + + "card_cvc": "7373" + + } + }, + "browser_info": { + "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36", + "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8", + "language": "nl-NL", + "color_depth": 24, + "screen_height": 723, + "screen_width": 1536, + "time_zone": 0, + "java_enabled": true, + "java_script_enabled": true, + "ip_address": "13.232.74.226" + } +}' +``` +Response +``` +{"error":{"type":"invalid_request","message":"The payment with the specified payment_id already exists in our records","code":"HE_01","reason":"PaymentId(\"X7a9Bq2Lm8Rt4Nv6Pw3Ky5Hd0Gc\") already exists"}} +``` +
+ +
+
+
Test customer ID +Create a payment id with 51 characters -> the payment should not fail + +``` +curl --location 'http://localhost:8080/payments' \ +--header 'Content-Type: application/json' \ +--header 'Accept: application/json' \ +--header 'api-key: dev_N4Kk872pMhxmIKSazZbKqAzQfpHKxRtRKqB6JHDvd2Dy3yvBeIjvbRNfP7CMpNw0' \ +--data '{ + "amount":100, + "currency": "USD", + "confirm": true, + "capture_method": "automatic", + "customer_id": "Ab9xL2qWeRtY7uIoPzK4sDfGhJmNcVbX1tUyQwErZaSdFgHiJk", + "payment_method": "card", + "payment_method_data": { + "card": { + "card_number": "371449635398431", + "card_exp_month": "03", + "card_exp_year": "30", + + "card_cvc": "7373" + + } + }, + "browser_info": { + "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36", + "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8", + "language": "nl-NL", + "color_depth": 24, + "screen_height": 723, + "screen_width": 1536, + "time_zone": 0, + "java_enabled": true, + "java_script_enabled": true, + "ip_address": "13.232.74.226" + } +}' +``` +Response +``` +{"payment_id":"pay_iKl3IPwXyePRNlXcatnT","merchant_id":"postman_merchant_GHAction_ddbb3a5f-2662-42ea-8552-0e837234ea86","status":"processing","amount":100,"net_amount":100,"shipping_cost":null,"amount_capturable":100,"amount_received":null,"connector":"worldpayvantiv","client_secret":"pay_iKl3IPwXyePRNlXcatnT_secret_gwSugh28oFpJYZ8ms6kD","created":"2025-08-22T11:34:29.994Z","currency":"USD","customer_id":"Ab9xL2qWeRtY7uIoPzK4sDfGhJmNcVbX1tUyQwErZaSdFgHiJk","customer":{"id":"Ab9xL2qWeRtY7uIoPzK4sDfGhJmNcVbX1tUyQwErZaSdFgHiJk","name":null,"email":null,"phone":null,"phone_country_code":null},"description":null,"refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":null,"off_session":null,"capture_on":null,"capture_method":"automatic","payment_method":"card","payment_method_data":{"card":{"last4":"8431","card_type":null,"card_network":null,"card_issuer":null,"card_issuing_country":null,"card_isin":"371449","card_extended_bin":null,"card_exp_month":"03","card_exp_year":"30","card_holder_name":null,"payment_checks":{"avs_result":"02","advanced_a_v_s_result":null,"authentication_result":null,"card_validation_result":"M"},"authentication_data":null},"billing":null},"payment_token":null,"shipping":null,"billing":null,"order_details":null,"email":null,"name":null,"phone":null,"return_url":null,"authentication_type":"no_three_ds","statement_descriptor_name":null,"statement_descriptor_suffix":null,"next_action":null,"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":null,"payment_method_type":null,"connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":{"customer_id":"Ab9xL2qWeRtY7uIoPzK4sDfGhJmNcVbX1tUyQwErZaSdFgHiJk","created_at":1755862469,"expires":1755866069,"secret":"epk_754d6c55ce6e42499ef22a6a9f560879"},"manual_retry_allowed":false,"connector_transaction_id":"84085439258716242","frm_message":null,"metadata":null,"connector_metadata":null,"feature_metadata":{"redirect_response":null,"search_tags":null,"apple_pay_recurring_details":null,"gateway_system":"direct"},"reference_id":"6WOPuD6Jt-s0ONpyKdwTiSOJUjCh","payment_link":null,"profile_id":"pro_l1p84NUKtcjTefm3Cvx1","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_hUK6008UqqyNo8IcS7Al","incremental_authorization_allowed":false,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-08-22T11:49:29.994Z","fingerprint":null,"browser_info":{"language":"nl-NL","time_zone":0,"ip_address":"13.232.74.226","user_agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36","color_depth":24,"java_enabled":true,"screen_width":1536,"accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","screen_height":723,"java_script_enabled":true},"payment_channel":null,"payment_method_id":null,"network_transaction_id":null,"payment_method_status":null,"updated":"2025-08-22T11:34:32.478Z","split_payments":null,"frm_metadata":null,"extended_authorization_applied":null,"capture_before":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":null,"card_discovery":"manual","force_3ds_challenge":false,"force_3ds_challenge_trigger":false,"issuer_error_code":null,"issuer_error_message":null,"is_iframe_redirection_enabled":null,"whole_connector_response":null,"enable_partial_authorization":null} +``` +Psync + +``` +{"payment_id":"pay_iKl3IPwXyePRNlXcatnT","merchant_id":"postman_merchant_GHAction_ddbb3a5f-2662-42ea-8552-0e837234ea86","status":"succeeded","amount":100,"net_amount":100,"shipping_cost":null,"amount_capturable":0,"amount_received":100,"connector":"worldpayvantiv","client_secret":"pay_iKl3IPwXyePRNlXcatnT_secret_gwSugh28oFpJYZ8ms6kD","created":"2025-08-22T11:34:29.994Z","currency":"USD","customer_id":"Ab9xL2qWeRtY7uIoPzK4sDfGhJmNcVbX1tUyQwErZaSdFgHiJk","customer":{"id":"Ab9xL2qWeRtY7uIoPzK4sDfGhJmNcVbX1tUyQwErZaSdFgHiJk","name":null,"email":null,"phone":null,"phone_country_code":null},"description":null,"refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":null,"off_session":null,"capture_on":null,"capture_method":"automatic","payment_method":"card","payment_method_data":{"card":{"last4":"8431","card_type":null,"card_network":null,"card_issuer":null,"card_issuing_country":null,"card_isin":"371449","card_extended_bin":null,"card_exp_month":"03","card_exp_year":"30","card_holder_name":null,"payment_checks":{"avs_result":"02","advanced_a_v_s_result":null,"authentication_result":null,"card_validation_result":"M"},"authentication_data":null},"billing":null},"payment_token":null,"shipping":null,"billing":null,"order_details":null,"email":null,"name":null,"phone":null,"return_url":null,"authentication_type":"no_three_ds","statement_descriptor_name":null,"statement_descriptor_suffix":null,"next_action":null,"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":null,"payment_method_type":null,"connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":null,"manual_retry_allowed":false,"connector_transaction_id":"84085439258716242","frm_message":null,"metadata":null,"connector_metadata":null,"feature_metadata":{"redirect_response":null,"search_tags":null,"apple_pay_recurring_details":null,"gateway_system":"direct"},"reference_id":"6WOPuD6Jt-s0ONpyKdwTiSOJUjCh","payment_link":null,"profile_id":"pro_l1p84NUKtcjTefm3Cvx1","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_hUK6008UqqyNo8IcS7Al","incremental_authorization_allowed":false,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-08-22T11:49:29.994Z","fingerprint":null,"browser_info":{"language":"nl-NL","time_zone":0,"ip_address":"13.232.74.226","user_agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36","color_depth":24,"java_enabled":true,"screen_width":1536,"accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","screen_height":723,"java_script_enabled":true},"payment_channel":null,"payment_method_id":null,"network_transaction_id":null,"payment_method_status":null,"updated":"2025-08-22T11:35:15.956Z","split_payments":null,"frm_metadata":null,"extended_authorization_applied":null,"capture_before":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":null,"card_discovery":"manual","force_3ds_challenge":false,"force_3ds_challenge_trigger":false,"issuer_error_code":null,"issuer_error_message":null,"is_iframe_redirection_enabled":null,"whole_connector_response":null,"enable_partial_authorization":null} +``` + +
+
+
+Test connector_transaction_id mapping +Create a CIT payment + +```curl +curl --location 'http://localhost:8080/payments' \ +--header 'Content-Type: application/json' \ +--header 'Accept: application/json' \ +--header 'api-key: dev_N4Kk872pMhxmIKSazZbKqAzQfpHKxRtRKqB6JHDvd2Dy3yvBeIjvbRNfP7CMpNw0' \ +--data '{ + "amount":100, + "currency": "USD", + "confirm": true, + "capture_method": "automatic", + "customer_id": "aaaa", + "payment_method": "card", + "payment_method_type": "credit", + "payment_method_data": { + "card": { + "card_number": "371449635398431", + "card_exp_month": "03", + "card_exp_year": "30", + + "card_cvc": "7373" + + } + }, + + "customer_acceptance": { + "acceptance_type": "online", + "accepted_at": "2025-03-27T13:56:49.848Z", + "online": { + "ip_address": null, + "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.3 Safari/605.1.15" + } + }, + "setup_future_usage": "off_session", + "browser_info": { + "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36", + "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8", + "language": "nl-NL", + "color_depth": 24, + "screen_height": 723, + "screen_width": 1536, + "time_zone": 0, + "java_enabled": true, + "java_script_enabled": true, + "ip_address": "13.232.74.226" + } +}' +``` +Response +```json +{"payment_id":"pay_gpuWWaVNgGjsFO9Qf2Ht","merchant_id":"postman_merchant_GHAction_ddbb3a5f-2662-42ea-8552-0e837234ea86","status":"processing","amount":100,"net_amount":100,"shipping_cost":null,"amount_capturable":100,"amount_received":null,"connector":"worldpayvantiv","client_secret":"pay_gpuWWaVNgGjsFO9Qf2Ht_secret_ZzlzHt4aO4Nd9aEtwLhF","created":"2025-08-22T11:39:35.676Z","currency":"USD","customer_id":"aaaa","customer":{"id":"aaaa","name":null,"email":null,"phone":null,"phone_country_code":null},"description":null,"refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":"on_session","off_session":null,"capture_on":null,"capture_method":"automatic","payment_method":"card","payment_method_data":{"card":{"last4":"8431","card_type":null,"card_network":null,"card_issuer":null,"card_issuing_country":null,"card_isin":"371449","card_extended_bin":null,"card_exp_month":"03","card_exp_year":"30","card_holder_name":null,"payment_checks":{"avs_result":"02","advanced_a_v_s_result":null,"authentication_result":null,"card_validation_result":"M"},"authentication_data":null},"billing":null},"payment_token":null,"shipping":null,"billing":null,"order_details":null,"email":null,"name":null,"phone":null,"return_url":null,"authentication_type":"no_three_ds","statement_descriptor_name":null,"statement_descriptor_suffix":null,"next_action":null,"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":null,"payment_method_type":null,"connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":{"customer_id":"aaaa","created_at":1755862775,"expires":1755866375,"secret":"epk_677ebe9f72fc4ecf9251b35805374f60"},"manual_retry_allowed":false,"connector_transaction_id":"83997479617603144","frm_message":null,"metadata":null,"connector_metadata":null,"feature_metadata":{"redirect_response":null,"search_tags":null,"apple_pay_recurring_details":null,"gateway_system":"direct"},"reference_id":"OSU_Spn7Zs7cmEcBXX7YL57bM-T9","payment_link":null,"profile_id":"pro_l1p84NUKtcjTefm3Cvx1","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_hUK6008UqqyNo8IcS7Al","incremental_authorization_allowed":false,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-08-22T11:54:35.676Z","fingerprint":null,"browser_info":{"language":"nl-NL","time_zone":0,"ip_address":"13.232.74.226","user_agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36","color_depth":24,"java_enabled":true,"screen_width":1536,"accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","screen_height":723,"java_script_enabled":true},"payment_channel":null,"payment_method_id":null,"network_transaction_id":null,"payment_method_status":null,"updated":"2025-08-22T11:39:38.567Z","split_payments":null,"frm_metadata":null,"extended_authorization_applied":null,"capture_before":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":null,"card_discovery":"manual","force_3ds_challenge":false,"force_3ds_challenge_trigger":false,"issuer_error_code":null,"issuer_error_message":null,"is_iframe_redirection_enabled":null,"whole_connector_response":null,"enable_partial_authorization":null} +``` + +Psync + +```json +{"payment_id":"pay_gpuWWaVNgGjsFO9Qf2Ht","merchant_id":"postman_merchant_GHAction_ddbb3a5f-2662-42ea-8552-0e837234ea86","status":"succeeded","amount":100,"net_amount":100,"shipping_cost":null,"amount_capturable":0,"amount_received":100,"connector":"worldpayvantiv","client_secret":"pay_gpuWWaVNgGjsFO9Qf2Ht_secret_ZzlzHt4aO4Nd9aEtwLhF","created":"2025-08-22T11:39:35.676Z","currency":"USD","customer_id":"aaaa","customer":{"id":"aaaa","name":null,"email":null,"phone":null,"phone_country_code":null},"description":null,"refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":"on_session","off_session":null,"capture_on":null,"capture_method":"automatic","payment_method":"card","payment_method_data":{"card":{"last4":"8431","card_type":null,"card_network":null,"card_issuer":null,"card_issuing_country":null,"card_isin":"371449","card_extended_bin":null,"card_exp_month":"03","card_exp_year":"30","card_holder_name":null,"payment_checks":{"avs_result":"02","advanced_a_v_s_result":null,"authentication_result":null,"card_validation_result":"M"},"authentication_data":null},"billing":null},"payment_token":null,"shipping":null,"billing":null,"order_details":null,"email":null,"name":null,"phone":null,"return_url":null,"authentication_type":"no_three_ds","statement_descriptor_name":null,"statement_descriptor_suffix":null,"next_action":null,"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":null,"payment_method_type":null,"connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":null,"manual_retry_allowed":false,"connector_transaction_id":"83997479617603144","frm_message":null,"metadata":null,"connector_metadata":null,"feature_metadata":{"redirect_response":null,"search_tags":null,"apple_pay_recurring_details":null,"gateway_system":"direct"},"reference_id":"OSU_Spn7Zs7cmEcBXX7YL57bM-T9","payment_link":null,"profile_id":"pro_l1p84NUKtcjTefm3Cvx1","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_hUK6008UqqyNo8IcS7Al","incremental_authorization_allowed":false,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-08-22T11:54:35.676Z","fingerprint":null,"browser_info":{"language":"nl-NL","time_zone":0,"ip_address":"13.232.74.226","user_agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36","color_depth":24,"java_enabled":true,"screen_width":1536,"accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","screen_height":723,"java_script_enabled":true},"payment_channel":null,"payment_method_id":"pm_pLGxYw7DY1nET3bjel8s","network_transaction_id":null,"payment_method_status":"inactive","updated":"2025-08-22T11:40:55.204Z","split_payments":null,"frm_metadata":null,"extended_authorization_applied":null,"capture_before":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":null,"card_discovery":"manual","force_3ds_challenge":false,"force_3ds_challenge_trigger":false,"issuer_error_code":null,"issuer_error_message":null,"is_iframe_redirection_enabled":null,"whole_connector_response":null,"enable_partial_authorization":null} +``` + +MIT + +``` +curl --location 'http://localhost:8080/payments' \ +--header 'Content-Type: application/json' \ +--header 'Accept: application/json' \ +--header 'api-key: dev_N4Kk872pMhxmIKSazZbKqAzQfpHKxRtRKqB6JHDvd2Dy3yvBeIjvbRNfP7CMpNw0' \ +--data '{ + "amount": 15000, + "currency": "USD", + "off_session": true, + "confirm": true, + "capture_method": "automatic", + "recurring_details": { + "type": "payment_method_id", + "data": "pm_50OIlMv7pxOew89alATb" + }, + + "customer_id": "aaaa", + "connector": [ + "worldpayvantiv" + ] +}' +``` +Response +``` +{"payment_id":"pay_4Dw2f3P7ITvGcU7nSH75","merchant_id":"postman_merchant_GHAction_ddbb3a5f-2662-42ea-8552-0e837234ea86","status":"processing","amount":15000,"net_amount":15000,"shipping_cost":null,"amount_capturable":15000,"amount_received":null,"connector":"worldpayvantiv","client_secret":"pay_4Dw2f3P7ITvGcU7nSH75_secret_TlgTo55JiDPHRASDLQrK","created":"2025-08-22T11:43:53.999Z","currency":"USD","customer_id":"aaaa","customer":{"id":"aaaa","name":null,"email":null,"phone":null,"phone_country_code":null},"description":null,"refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":null,"off_session":true,"capture_on":null,"capture_method":"automatic","payment_method":"card","payment_method_data":{"card":{"last4":"8431","card_type":null,"card_network":null,"card_issuer":null,"card_issuing_country":null,"card_isin":"371449","card_extended_bin":null,"card_exp_month":"03","card_exp_year":"30","card_holder_name":null,"payment_checks":null,"authentication_data":null},"billing":null},"payment_token":null,"shipping":null,"billing":null,"order_details":null,"email":null,"name":null,"phone":null,"return_url":null,"authentication_type":"no_three_ds","statement_descriptor_name":null,"statement_descriptor_suffix":null,"next_action":null,"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":null,"payment_method_type":"credit","connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":{"customer_id":"aaaa","created_at":1755863033,"expires":1755866633,"secret":"epk_5b1da7ef3d42490f8f019fa2b43798cb"},"manual_retry_allowed":false,"connector_transaction_id":"83997479689435292","frm_message":null,"metadata":null,"connector_metadata":null,"feature_metadata":{"redirect_response":null,"search_tags":null,"apple_pay_recurring_details":null,"gateway_system":"direct"},"reference_id":"veeQfK1abJYO7RvVkIBhM5AjITJk","payment_link":null,"profile_id":"pro_l1p84NUKtcjTefm3Cvx1","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_hUK6008UqqyNo8IcS7Al","incremental_authorization_allowed":false,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-08-22T11:58:53.999Z","fingerprint":null,"browser_info":null,"payment_channel":null,"payment_method_id":"pm_50OIlMv7pxOew89alATb","network_transaction_id":"239605450718890","payment_method_status":"active","updated":"2025-08-22T11:43:54.691Z","split_payments":null,"frm_metadata":null,"extended_authorization_applied":null,"capture_before":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":"270340788048431","card_discovery":"manual","force_3ds_challenge":false,"force_3ds_challenge_trigger":false,"issuer_error_code":null,"issuer_error_message":null,"is_iframe_redirection_enabled":null,"whole_connector_response":null,"enable_partial_authorization":null} +``` + +Psync + +```json +{"payment_id":"pay_4Dw2f3P7ITvGcU7nSH75","merchant_id":"postman_merchant_GHAction_ddbb3a5f-2662-42ea-8552-0e837234ea86","status":"succeeded","amount":15000,"net_amount":15000,"shipping_cost":null,"amount_capturable":0,"amount_received":15000,"connector":"worldpayvantiv","client_secret":"pay_4Dw2f3P7ITvGcU7nSH75_secret_TlgTo55JiDPHRASDLQrK","created":"2025-08-22T11:43:53.999Z","currency":"USD","customer_id":"aaaa","customer":{"id":"aaaa","name":null,"email":null,"phone":null,"phone_country_code":null},"description":null,"refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":null,"off_session":true,"capture_on":null,"capture_method":"automatic","payment_method":"card","payment_method_data":{"card":{"last4":"8431","card_type":null,"card_network":null,"card_issuer":null,"card_issuing_country":null,"card_isin":"371449","card_extended_bin":null,"card_exp_month":"03","card_exp_year":"30","card_holder_name":null,"payment_checks":null,"authentication_data":null},"billing":null},"payment_token":null,"shipping":null,"billing":null,"order_details":null,"email":null,"name":null,"phone":null,"return_url":null,"authentication_type":"no_three_ds","statement_descriptor_name":null,"statement_descriptor_suffix":null,"next_action":null,"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":null,"payment_method_type":"credit","connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":null,"manual_retry_allowed":false,"connector_transaction_id":"83997479689435292","frm_message":null,"metadata":null,"connector_metadata":null,"feature_metadata":{"redirect_response":null,"search_tags":null,"apple_pay_recurring_details":null,"gateway_system":"direct"},"reference_id":"veeQfK1abJYO7RvVkIBhM5AjITJk","payment_link":null,"profile_id":"pro_l1p84NUKtcjTefm3Cvx1","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_hUK6008UqqyNo8IcS7Al","incremental_authorization_allowed":false,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-08-22T11:58:53.999Z","fingerprint":null,"browser_info":null,"payment_channel":null,"payment_method_id":"pm_50OIlMv7pxOew89alATb","network_transaction_id":"239605450718890","payment_method_status":"active","updated":"2025-08-22T11:47:31.273Z","split_payments":null,"frm_metadata":null,"extended_authorization_applied":null,"capture_before":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":null,"card_discovery":"manual","force_3ds_challenge":false,"force_3ds_challenge_trigger":false,"issuer_error_code":null,"issuer_error_message":null,"is_iframe_redirection_enabled":null,"whole_connector_response":null,"enable_partial_authorization":null} +``` + +
+ +## Checklist + + +- [x] I formatted the code `cargo +nightly fmt --all` +- [x] I addressed lints thrown by `cargo clippy` +- [x] I reviewed the submitted code +- [ ] I added unit tests for my changes where possible +COMMENTS: +- semanticdiff-com[bot]: Review changes with  SemanticDiff +
+Changed Files +
+ +| File | Status | +| :--- | :--- | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9031/changes#crates/hyperswitch_connectors/src/connectors/worldpayvantiv/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/worldpayvantiv/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9031/changes#crates/hyperswitch_connectors/src/connectors/worldpayvantiv/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9031/changes#crates/hyperswitch_connectors/src/connectors/worldpayvantiv/transformers.rs)  35% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9031/changes#Cargo.lock)  [Cargo\.lock](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9031/changes#Cargo.lock) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9031/changes#crates/hyperswitch_connectors/Cargo.toml)  [crates/hyperswitch\_connectors/Cargo\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9031/changes#crates/hyperswitch_connectors/Cargo.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9031/changes#crates/hyperswitch_connectors/src/connectors/worldpayvantiv.rs)  [crates/hyperswitch\_connectors/src/connectors/worldpayvantiv\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9031/changes#crates/hyperswitch_connectors/src/connectors/worldpayvantiv.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9031/changes#crates/hyperswitch_connectors/src/connectors/worldpayvantiv.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9031/changes#crates/hyperswitch_connectors/src/utils.rs)  [crates/hyperswitch\_connectors/src/utils\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9031/changes#crates/hyperswitch_connectors/src/utils.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9031/changes#crates/hyperswitch_connectors/src/utils.rs)  0% smaller | + +
+- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/worldpayvantiv.rs:1709]: Make this 28 +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/worldpayvantiv.rs:1723]: Make this 28 +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/worldpayvantiv.rs:1709]: A new generic function to generate alphanumeric string of input length n +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/worldpayvantiv/transformers.rs:542]: remove this +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/worldpayvantiv/transformers.rs:2138]: remove this +- AkshayaFoiger [crates/hyperswitch_connectors/src/connectors/worldpayvantiv.rs:1709]: Can I use a generic macro nanoid!() for the same + +=== COMMIT === +SUBJECT: fix(connectors): [worldpayvantiv] map cnp_txn_id to connector_txn_id and enforce max length for customer_id and connector_request_reference_id (#9031) +BODY: +Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> + +=== FILES === +Summary: 5 files changed, +116 -62 +- Cargo.lock (+1 -0) +- crates/hyperswitch_connectors/Cargo.toml (+1 -0) +- crates/hyperswitch_connectors/src/connectors/worldpayvantiv.rs (+29 -0) +- crates/hyperswitch_connectors/src/connectors/worldpayvantiv/transformers.rs (+80 -62) +- crates/hyperswitch_connectors/src/utils.rs (+5 -0) + +=== PATCH === +diff --git a/Cargo.lock b/Cargo.lock +index fdb8ceb9..5fae101a 100644 +--- a/Cargo.lock ++++ b/Cargo.lock +@@ -4048,6 +4048,7 @@ dependencies = [ + "lazy_static", + "masking", + "mime", ++ "nanoid", + "num-traits", + "openssl", + "pem", +diff --git a/crates/hyperswitch_connectors/Cargo.toml b/crates/hyperswitch_connectors/Cargo.toml +index d06d6f29..3f4653b0 100644 +--- a/crates/hyperswitch_connectors/Cargo.toml ++++ b/crates/hyperswitch_connectors/Cargo.toml +@@ -36,6 +36,7 @@ josekit = "0.8.7" + lazy_static = "1.5.0" + mime = "0.3.17" + num-traits = "0.2.19" ++nanoid = "0.4.0" + openssl = {version = "0.10.70"} + pem = "3.0.5" + qrcode = "0.14.1" +diff --git a/crates/hyperswitch_connectors/src/connectors/worldpayvantiv.rs b/crates/hyperswitch_connectors/src/connectors/worldpayvantiv.rs +index 8333a90e..2447e6a2 100644 +--- a/crates/hyperswitch_connectors/src/connectors/worldpayvantiv.rs ++++ b/crates/hyperswitch_connectors/src/connectors/worldpayvantiv.rs +@@ -1694,4 +1694,33 @@ impl ConnectorSpecifications for Worldpayvantiv { + fn get_supported_webhook_flows(&self) -> Option<&'static [common_enums::EventClass]> { + Some(&WORLDPAYVANTIV_SUPPORTED_WEBHOOK_FLOWS) + } ++ #[cfg(feature = "v1")] ++ fn generate_connector_request_reference_id( ++ &self, ++ payment_intent: &hyperswitch_domain_models::payments::PaymentIntent, ++ payment_attempt: &hyperswitch_domain_models::payments::payment_attempt::PaymentAttempt, ++ is_config_enabled_to_send_payment_id_as_connector_request_id: bool, ++ ) -> String { ++ if is_config_enabled_to_send_payment_id_as_connector_request_id ++ && payment_intent.is_payment_id_from_merchant.unwrap_or(false) ++ { ++ payment_attempt.payment_id.get_string_repr().to_owned() ++ } else { ++ let max_payment_reference_id_length = ++ worldpayvantiv::worldpayvantiv_constants::MAX_PAYMENT_REFERENCE_ID_LENGTH; ++ nanoid::nanoid!(max_payment_reference_id_length) ++ } ++ } ++ #[cfg(feature = "v2")] ++ fn generate_connector_request_reference_id( ++ &self, ++ payment_intent: &hyperswitch_domain_models::payments::PaymentIntent, ++ payment_attempt: &hyperswitch_domain_models::payments::payment_attempt::PaymentAttempt, ++ ) -> String { ++ if payment_intent.is_payment_id_from_merchant.unwrap_or(false) { ++ payment_attempt.payment_id.get_string_repr().to_owned() ++ } else { ++ connector_utils::generate_12_digit_number().to_string() ++ } ++ } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/worldpayvantiv/transformers.rs b/crates/hyperswitch_connectors/src/connectors/worldpayvantiv/transformers.rs +index 2894ad68..d40692e4 100644 +--- a/crates/hyperswitch_connectors/src/connectors/worldpayvantiv/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/worldpayvantiv/transformers.rs +@@ -1,6 +1,5 @@ + use common_utils::{ + ext_traits::Encode, +- id_type::CustomerId, + types::{MinorUnit, StringMinorUnitForConnector}, + }; + use error_stack::ResultExt; +@@ -49,10 +48,11 @@ pub mod worldpayvantiv_constants { + pub const XML_VERSION: &str = "1.0"; + pub const XML_ENCODING: &str = "UTF-8"; + pub const XMLNS: &str = "http://www.vantivcnp.com/schema"; +- pub const MAX_ID_LENGTH: usize = 26; ++ pub const MAX_PAYMENT_REFERENCE_ID_LENGTH: usize = 28; + pub const XML_STANDALONE: &str = "yes"; + pub const XML_CHARGEBACK: &str = "http://www.vantivcnp.com/chargebacks"; + pub const MAC_FIELD_NUMBER: &str = "39"; ++ pub const CUSTOMER_ID_MAX_LENGTH: usize = 50; + pub const CUSTOMER_REFERENCE_MAX_LENGTH: usize = 17; + } + +@@ -600,6 +600,37 @@ where + }) + } + ++fn extract_customer_id(item: &T) -> Option ++where ++ T: UtilsRouterData, ++{ ++ item.get_optional_customer_id().and_then(|customer_id| { ++ let customer_id_str = customer_id.get_string_repr().to_string(); ++ if customer_id_str.len() <= worldpayvantiv_constants::CUSTOMER_ID_MAX_LENGTH { ++ Some(customer_id_str) ++ } else { ++ None ++ } ++ }) ++} ++ ++fn get_valid_transaction_id( ++ id: String, ++ error_field_name: &str, ++) -> Result> { ++ if id.len() <= worldpayvantiv_constants::MAX_PAYMENT_REFERENCE_ID_LENGTH { ++ Ok(id.clone()) ++ } else { ++ Err(errors::ConnectorError::MaxFieldLengthViolated { ++ connector: "Worldpayvantiv".to_string(), ++ field_name: error_field_name.to_string(), ++ max_length: worldpayvantiv_constants::MAX_PAYMENT_REFERENCE_ID_LENGTH, ++ received_length: id.len(), ++ } ++ .into()) ++ } ++} ++ + fn get_ship_to_address(item: &T) -> Option + where + T: UtilsRouterData, +@@ -672,11 +703,7 @@ impl TryFrom<&WorldpayvantivRouterData<&PaymentsAuthorizeRouterData>> for CnpOnl + user: worldpayvantiv_auth_type.user, + password: worldpayvantiv_auth_type.password, + }; +- let customer_id = item +- .router_data +- .customer_id +- .clone() +- .map(|customer_id| customer_id.get_string_repr().to_string()); ++ let customer_id = extract_customer_id(item.router_data); + + let bill_to_address = get_bill_to_address(item.router_data); + let ship_to_address = get_ship_to_address(item.router_data); +@@ -686,16 +713,17 @@ impl TryFrom<&WorldpayvantivRouterData<&PaymentsAuthorizeRouterData>> for CnpOnl + item.router_data.request.payment_method_data.clone(), + item.router_data.request.payment_channel.clone(), + )); ++ + let (authorization, sale) = + if item.router_data.request.is_auto_capture()? && item.amount != MinorUnit::zero() { ++ let merchant_txn_id = get_valid_transaction_id( ++ item.router_data.connector_request_reference_id.clone(), ++ "sale.id", ++ )?; + ( + None, + Some(Sale { +- id: format!( +- "{}_{}", +- OperationId::Sale, +- item.router_data.connector_request_reference_id +- ), ++ id: format!("{}_{merchant_txn_id}", OperationId::Sale), + report_group: report_group.clone(), + customer_id, + order_id: item.router_data.connector_request_reference_id.clone(), +@@ -723,12 +751,13 @@ impl TryFrom<&WorldpayvantivRouterData<&PaymentsAuthorizeRouterData>> for CnpOnl + } else { + OperationId::Auth + }; ++ let merchant_txn_id = get_valid_transaction_id( ++ item.router_data.connector_request_reference_id.clone(), ++ "authorization.id", ++ )?; + ( + Some(Authorization { +- id: format!( +- "{}_{}", +- operation_id, item.router_data.connector_request_reference_id +- ), ++ id: format!("{operation_id}_{merchant_txn_id}"), + report_group: report_group.clone(), + customer_id, + order_id: item.router_data.connector_request_reference_id.clone(), +@@ -811,10 +840,7 @@ impl TryFrom<&SetupMandateRouterData> for CnpOnlineRequest { + user: worldpayvantiv_auth_type.user, + password: worldpayvantiv_auth_type.password, + }; +- let customer_id = item +- .customer_id +- .clone() +- .map(|customer_id| customer_id.get_string_repr().to_string()); ++ let customer_id = extract_customer_id(item); + + let bill_to_address = get_bill_to_address(item); + let ship_to_address = get_ship_to_address(item); +@@ -829,12 +855,12 @@ impl TryFrom<&SetupMandateRouterData> for CnpOnlineRequest { + item.request.payment_method_data.clone(), + item.request.payment_channel.clone(), + )); ++ let merchant_txn_id = get_valid_transaction_id( ++ item.connector_request_reference_id.clone(), ++ "authorization.id", ++ )?; + let authorization_data = Authorization { +- id: format!( +- "{}_{}", +- OperationId::Sale, +- item.connector_request_reference_id +- ), ++ id: format!("{}_{merchant_txn_id}", OperationId::Sale), + report_group: report_group.clone(), + customer_id, + order_id: item.connector_request_reference_id.clone(), +@@ -934,8 +960,8 @@ where + Some(common_enums::TaxStatus::Taxable) => Some(false), + None => None, + }; +- +- let customer_reference = get_vantiv_customer_reference(&l2_l3_data.customer_id); ++ let customer_reference = ++ get_vantiv_customer_reference(&l2_l3_data.merchant_order_reference_id); + + let enhanced_data = EnhancedData { + customer_reference, +@@ -1018,12 +1044,12 @@ impl TryFrom<&WorldpayvantivRouterData<&PaymentsCaptureRouterData>> for CnpOnlin + "Failed to obtain report_group from metadata".to_string(), + ), + )?; ++ let merchant_txn_id = get_valid_transaction_id( ++ item.router_data.connector_request_reference_id.clone(), ++ "capture.id", ++ )?; + let capture = Some(Capture { +- id: format!( +- "{}_{}", +- OperationId::Capture, +- item.router_data.connector_request_reference_id +- ), ++ id: format!("{}_{}", OperationId::Capture, merchant_txn_id), + report_group, + cnp_txn_id: item.router_data.request.connector_transaction_id.clone(), + amount: item.amount, +@@ -1066,19 +1092,14 @@ impl TryFrom<&WorldpayvantivRouterData<&RefundsRouterData>> for CnpOnlineR + "Failed to obtain report_group from metadata".to_string(), + ), + )?; +- +- let customer_id = item +- .router_data +- .customer_id +- .clone() +- .map(|customer_id| customer_id.get_string_repr().to_string()); ++ let customer_id = extract_customer_id(item.router_data); ++ let merchant_txn_id = get_valid_transaction_id( ++ item.router_data.connector_request_reference_id.clone(), ++ "credit.id", ++ )?; + + let credit = Some(RefundRequest { +- id: format!( +- "{}_{}", +- OperationId::Refund, +- item.router_data.connector_request_reference_id +- ), ++ id: format!("{}_{merchant_txn_id}", OperationId::Refund), + report_group, + customer_id, + cnp_txn_id: item.router_data.request.connector_transaction_id.clone(), +@@ -1443,11 +1464,10 @@ where + } + } + +-fn get_vantiv_customer_reference(customer_id: &Option) -> Option { +- customer_id.as_ref().and_then(|id| { +- let customer_id_str = id.get_string_repr().to_string(); +- if customer_id_str.len() <= worldpayvantiv_constants::CUSTOMER_REFERENCE_MAX_LENGTH { +- Some(customer_id_str) ++fn get_vantiv_customer_reference(customer_id: &Option) -> Option { ++ customer_id.clone().and_then(|id| { ++ if id.len() <= worldpayvantiv_constants::CUSTOMER_REFERENCE_MAX_LENGTH { ++ Some(id) + } else { + None + } +@@ -1547,7 +1567,7 @@ impl TryFrom for CnpOnlineRequest { + "Failed to obtain report_group from metadata".to_string(), + ), + )?; ++ let merchant_txn_id = get_valid_transaction_id( ++ item.connector_request_reference_id.clone(), ++ "authReversal.id", ++ )?; + let auth_reversal = Some(AuthReversal { +- id: format!( +- "{}_{}", +- OperationId::Void, +- item.connector_request_reference_id +- ), ++ id: format!("{}_{merchant_txn_id}", OperationId::Void), + report_group, + cnp_txn_id: item.request.connector_transaction_id.clone(), + }); +@@ -1780,12 +1800,10 @@ impl TryFrom<&PaymentsCancelPostCaptureRouterData> for CnpOnlineRequest { + "Failed to obtain report_group from metadata".to_string(), + ), + )?; ++ let merchant_txn_id = ++ get_valid_transaction_id(item.connector_request_reference_id.clone(), "void.id")?; + let void = Some(Void { +- id: format!( +- "{}_{}", +- OperationId::VoidPC, +- item.connector_request_reference_id +- ), ++ id: format!("{}_{merchant_txn_id}", OperationId::VoidPC,), + report_group, + cnp_txn_id: item.request.connector_transaction_id.clone(), + }); +@@ -1847,7 +1865,7 @@ impl + reason: Some(sale_response.message.clone()), + status_code: item.http_code, + attempt_status: None, +- connector_transaction_id: Some(sale_response.order_id.clone()), ++ connector_transaction_id: Some(sale_response.cnp_txn_id.clone()), + network_advice_code: None, + network_decline_code, + network_error_message, +@@ -1915,7 +1933,7 @@ impl + reason: Some(auth_response.message.clone()), + status_code: item.http_code, + attempt_status: None, +- connector_transaction_id: Some(auth_response.order_id.clone()), ++ connector_transaction_id: Some(auth_response.cnp_txn_id.clone()), + network_advice_code: None, + network_decline_code, + network_error_message, +@@ -1968,7 +1986,7 @@ impl + reason: Some(item.response.message.clone()), + status_code: item.http_code, + attempt_status: None, +- connector_transaction_id: None, ++ connector_transaction_id: None, // Transaction id not created at connector + network_advice_code: None, + network_decline_code: None, + network_error_message: None, +diff --git a/crates/hyperswitch_connectors/src/utils.rs b/crates/hyperswitch_connectors/src/utils.rs +index e273e499..1500da76 100644 +--- a/crates/hyperswitch_connectors/src/utils.rs ++++ b/crates/hyperswitch_connectors/src/utils.rs +@@ -499,6 +499,7 @@ pub trait RouterData { + fn is_three_ds(&self) -> bool; + fn get_payment_method_token(&self) -> Result; + fn get_customer_id(&self) -> Result; ++ fn get_optional_customer_id(&self) -> Option; + fn get_connector_customer_id(&self) -> Result; + fn get_preprocessing_id(&self) -> Result; + fn get_recurring_mandate_payment_data(&self) -> Result; +@@ -1026,6 +1027,10 @@ impl RouterData + fn get_optional_l2_l3_data(&self) -> Option { + self.l2_l3_data.clone() + } ++ ++ fn get_optional_customer_id(&self) -> Option { ++ self.customer_id.clone() ++ } + } + + pub trait AccessTokenRequestInfo { + +----- END CHUNK ----- \ No newline at end of file diff --git a/raw/b8/b8c5bf3f6d0809ba318694d69db1e4431b2c4c0b.txt b/raw/b8/b8c5bf3f6d0809ba318694d69db1e4431b2c4c0b.txt new file mode 100644 index 0000000000000000000000000000000000000000..2120c1e51af3a90f5d5eeebce9d92367fb55244d --- /dev/null +++ b/raw/b8/b8c5bf3f6d0809ba318694d69db1e4431b2c4c0b.txt @@ -0,0 +1,884 @@ +ROUTE: juspay/hyperswitch@b8c5bf3f6d0809ba318694d69db1e4431b2c4c0b +REPO: https://github.com/juspay/hyperswitch +COMMIT: b8c5bf3f6d0809ba318694d69db1e4431b2c4c0b +AUTHOR: Kashif +DATE: 2025-08-25T12:57:46 + +=== ISSUE_AND_PR === +[PR #9040] feat(connector): [Adyenplatform] process payouts using PSP tokens +URL: https://github.com/juspay/hyperswitch/pull/9040 +BODY: +## Type of Change + + +- [ ] Bugfix +- [x] New feature +- [ ] Enhancement +- [ ] Refactoring +- [ ] Dependency updates +- [ ] Documentation +- [ ] CI/CD + +## Description +This PR adds support for Adyen tokenized card payouts in the AdyenPlatform connector. This enables processing payouts using stored PSP tokens + +- Restructured `AdyenCardIdentification` as an enum supporting both raw card data and stored payment method IDs +- Added `StoredPaymentCounterparty` and `RawPaymentCounterparty` for handling different payment method types +- Implemented fallback logic: stored payment method ID → raw card details +- Added `fetch_payout_method_data` helper function to centralize payout method data retrieval +- Enhanced validator to check for stored transfer method IDs before fetching raw card details + + + +### Additional Changes + +- [ ] This PR modifies the API contract +- [ ] This PR modifies the database schema +- [ ] This PR modifies application configuration/environment variables + + + + +## Motivation and Context +Enables merchants to process Adyen payouts using previously stored PSP tokens without requiring raw card data. This is helpful for migrated PSP tokens (created outside of HS). + +## How did you test it? +
+ 1. Create a payment CIT + +cURL + + curl --location --request POST 'http://localhost:8080/payments' \ + --header 'Content-Type: application/json' \ + --header 'Accept: application/json' \ + --header 'api-key: dev_ACto5kMwzvZvAZCM5LMfFoDaBxAKHNeQkYVRuitCrf2Q30DrqxbPr6YFOe8c2f3l' \ + --data-raw '{"amount":4500,"currency":"EUR","confirm":true,"profile_id":"pro_S5yvh1TfnZi2Gjv7uSUQ","capture_method":"automatic","authentication_type":"three_ds","setup_future_usage":"off_session","customer_id":"cus_payment_cit_1","email":"abc@example.com","return_url":"https://google.com","payment_method":"card","payment_method_type":"debit","payment_method_data":{"card":{"card_number":"4111111111111111","card_exp_month":"03","card_exp_year":"2030","card_cvc":"737"}},"billing":{"address":{"line1":"1467","line2":"Harrison Street","line3":"Harrison Street","city":"San Fransico","zip":"94122","country":"SG","first_name":"joseph","last_name":"Doe"},"phone":{"number":"8056594427","country_code":"+91"},"email":"guest@example.com"},"metadata":{"udf1":"value1","new_customer":"true","login_date":"2019-09-10T10:11:12Z"},"browser_info":{"user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36","accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","language":"en-US","color_depth":32,"screen_height":1117,"screen_width":1728,"time_zone":-330,"java_enabled":true,"java_script_enabled":true,"ip_address":"127.0.0.1"},"customer_acceptance":{"acceptance_type":"online","accepted_at":"1963-05-03T04:07:52.723Z","online":{"ip_address":"127.0.0.1","user_agent":"amet irure esse"}},"session_expiry":2890}' + +Response + + {"payment_id":"pay_funVtY7kQ3avj2SN3Lzm","merchant_id":"merchant_1755863240","status":"succeeded","amount":4500,"net_amount":4500,"shipping_cost":null,"amount_capturable":0,"amount_received":4500,"connector":"adyen","client_secret":"pay_funVtY7kQ3avj2SN3Lzm_secret_cR7UTM6j2h1jabVHAFHq","created":"2025-08-22T12:57:49.884Z","currency":"EUR","customer_id":"cus_uRtCHhDU0C2hafZMVHx1","customer":{"id":"cus_uRtCHhDU0C2hafZMVHx1","name":"Albert Klaassen","email":"abc@example.com","phone":"6168205362","phone_country_code":"+1"},"description":null,"refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":"off_session","off_session":null,"capture_on":null,"capture_method":"automatic","payment_method":"card","payment_method_data":{"card":{"last4":"1111","card_type":null,"card_network":null,"card_issuer":null,"card_issuing_country":null,"card_isin":"411111","card_extended_bin":null,"card_exp_month":"03","card_exp_year":"2030","card_holder_name":null,"payment_checks":null,"authentication_data":null},"billing":null},"payment_token":null,"shipping":null,"billing":{"address":{"city":"San Fransico","country":"SG","line1":"1467","line2":"Harrison Street","line3":"Harrison Street","zip":"94122","state":null,"first_name":"joseph","last_name":"Doe","origin_zip":null},"phone":{"number":"8056594427","country_code":"+91"},"email":"guest@example.com"},"order_details":null,"email":"abc@example.com","name":"Albert Klaassen","phone":"6168205362","return_url":"https://google.com/","authentication_type":"three_ds","statement_descriptor_name":null,"statement_descriptor_suffix":null,"next_action":null,"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":null,"payment_method_type":"debit","connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":{"customer_id":"cus_uRtCHhDU0C2hafZMVHx1","created_at":1755867469,"expires":1755871069,"secret":"epk_fdc03a4797ef451a98b2929bcfc398ca"},"manual_retry_allowed":false,"connector_transaction_id":"VCV7F35F2L3C37V5","frm_message":null,"metadata":{"udf1":"value1","login_date":"2019-09-10T10:11:12Z","new_customer":"true"},"connector_metadata":null,"feature_metadata":{"redirect_response":null,"search_tags":null,"apple_pay_recurring_details":null,"gateway_system":"direct"},"reference_id":"pay_funVtY7kQ3avj2SN3Lzm_1","payment_link":null,"profile_id":"pro_sHtakSPxfG6JnK0wpCKG","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_A3zlBnD9y8WvakW0ratr","incremental_authorization_allowed":false,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-08-22T13:45:59.884Z","fingerprint":null,"browser_info":{"language":"en-US","time_zone":-330,"ip_address":"127.0.0.1","user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36","color_depth":32,"java_enabled":true,"screen_width":1728,"accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","screen_height":1117,"java_script_enabled":true},"payment_channel":null,"payment_method_id":"pm_L6rQCpfqi5f1OAG4DHIG","network_transaction_id":"056847192959811","payment_method_status":"active","updated":"2025-08-22T12:57:50.457Z","split_payments":null,"frm_metadata":null,"extended_authorization_applied":null,"capture_before":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":"X99D3DNTHP447NV5","card_discovery":"manual","force_3ds_challenge":false,"force_3ds_challenge_trigger":false,"issuer_error_code":null,"issuer_error_message":null,"is_iframe_redirection_enabled":null,"whole_connector_response":null,"enable_partial_authorization":null} + +Manually update `connector_mandate_detail` to include payout MCA as well + + { + "mca_A3zlBnD9y8WvakW0ratr": { + "mandate_metadata": null, + "payment_method_type": "debit", + "connector_mandate_id": "X99D3DNTHP447NV5", + "connector_mandate_status": "active", + "original_payment_authorized_amount": 4500, + "original_payment_authorized_currency": "EUR", + "connector_mandate_request_reference_id": "GOSHRSEHXi2emhKCLC" + } + } + +Updated to + + { + "mca_A3zlBnD9y8WvakW0ratr": { + "mandate_metadata": null, + "payment_method_type": "debit", + "connector_mandate_id": "X99D3DNTHP447NV5", + "connector_mandate_status": "active", + "original_payment_authorized_amount": 4500, + "original_payment_authorized_currency": "EUR", + "connector_mandate_request_reference_id": "GOSHRSEHXi2emhKCLC" + }, + "payouts": { + "mca_NsHlFe2GsWvK9CdftrLt": { + "transfer_method_id": "X99D3DNTHP447NV5" + } + } + } + +
+ +
+ 2. Create a payout using payout_method_id + +cURL + + curl --location --request POST 'http://localhost:8080/payouts/create' \ + --header 'Content-Type: application/json' \ + --header 'api-key: dev_XKQaI34jBT7ZKVNZtpbrc1feIuijxd7MgPf8GMFvqLxniEGUdbNoKPcm0r8aHZhg' \ + --data '{"payout_method_id":"pm_L6rQCpfqi5f1OAG4DHIG","amount":100,"currency":"EUR","customer_id":"cus_CzI1yN5av9n1nICj0ofl","connector":["adyenplatform"],"billing":{"address":{"line1":"1467","line2":"Harrison Street","line3":"Harrison Street","city":"San Fransico","state":"CA","zip":"94122","country":"DE","first_name":"Albert","last_name":"Klassen"},"phone":{"number":"8056594427","country_code":"+91"}},"entity_type":"Individual","recurring":true,"metadata":{"ref":"123"},"confirm":true,"auto_fulfill":true}' + +Response + + {"payout_id":"payout_wJvyBtv3lJXXYe2f2Zlo","merchant_id":"merchant_1755867774","merchant_order_reference_id":null,"amount":100,"currency":"EUR","connector":"adyenplatform","payout_type":"card","payout_method_data":null,"billing":{"address":{"city":"San Fransico","country":"DE","line1":"1467","line2":"Harrison Street","line3":"Harrison Street","zip":"94122","state":"CA","first_name":"Albert","last_name":"Klassen","origin_zip":null},"phone":{"number":"8056594427","country_code":"+91"},"email":null},"auto_fulfill":true,"customer_id":"cus_CzI1yN5av9n1nICj0ofl","customer":{"id":"cus_CzI1yN5av9n1nICj0ofl","name":"Albert Klaassen","email":"abc@example.com","phone":"6168205362","phone_country_code":"+1"},"client_secret":"payout_payout_wJvyBtv3lJXXYe2f2Zlo_secret_jgJ0TCCA8exlXEeh5KsK","return_url":null,"business_country":null,"business_label":null,"description":null,"entity_type":"Individual","recurring":true,"metadata":{"ref":"123"},"merchant_connector_id":"mca_8gi7OlijF22Wv9ImMR4w","status":"initiated","error_message":null,"error_code":null,"profile_id":"pro_8lrTNA9EX88OGfPXiElF","created":"2025-08-22T14:57:13.628Z","connector_transaction_id":"38EBH7682DK7VMVK","priority":null,"payout_link":null,"email":"abc@example.com","name":"Albert Klaassen","phone":"6168205362","phone_country_code":"+1","unified_code":null,"unified_message":null,"payout_method_id":"pm_L6rQCpfqi5f1OAG4DHIG"} + +
+ +## Checklist + + +- [x] I formatted the code `cargo +nightly fmt --all` +- [x] I addressed lints thrown by `cargo clippy` +- [ ] I reviewed the submitted code +- [ ] I added unit tests for my changes where possible +COMMENTS: +- semanticdiff-com[bot]: Review changes with  SemanticDiff +
+Changed Files +
+ +| File | Status | +| :--- | :--- | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9040/changes#crates/router/src/core/payouts/validator.rs)  [crates/router/src/core/payouts/validator\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9040/changes#crates/router/src/core/payouts/validator.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9040/changes#crates/router/src/core/payouts/validator.rs)  83% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9040/changes#crates/router/src/core/payouts.rs)  [crates/router/src/core/payouts\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9040/changes#crates/router/src/core/payouts.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9040/changes#crates/router/src/core/payouts.rs)  40% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9040/changes#crates/hyperswitch_connectors/src/connectors/adyenplatform/transformers/payouts.rs)  [crates/hyperswitch\_connectors/src/connectors/adyenplatform/transformers/payouts\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9040/changes#crates/hyperswitch_connectors/src/connectors/adyenplatform/transformers/payouts.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9040/changes#crates/hyperswitch_connectors/src/connectors/adyenplatform/transformers/payouts.rs)  22% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9040/changes#crates/router/src/core/payments/routing.rs)  [crates/router/src/core/payments/routing\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9040/changes#crates/router/src/core/payments/routing.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9040/changes#crates/router/src/core/payments/routing.rs)  21% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9040/changes#crates/router/src/core/payouts/helpers.rs)  [crates/router/src/core/payouts/helpers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9040/changes#crates/router/src/core/payouts/helpers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9040/changes#crates/router/src/core/payouts/helpers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9040/changes#crates/router/src/types/transformers.rs)  [crates/router/src/types/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9040/changes#crates/router/src/types/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9040/changes#crates/router/src/types/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9040/changes#nix/modules/flake/devshell.nix)  [nix/modules/flake/devshell\.nix](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9040/changes#nix/modules/flake/devshell.nix) | Unsupported file format | + +
+- jagan-jaya [nix/modules/flake/devshell.nix:39]: is this change needed? +- kashif-m [nix/modules/flake/devshell.nix:39]: Yes! Needed for cases when there's `openssl` installed in the system, to differentiate between nix and system env. + +=== COMMIT === +SUBJECT: feat(connector): [Adyenplatform] process payouts using PSP tokens (#9040) +BODY: +Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> + +=== FILES === +Summary: 7 files changed, +350 -136 +- crates/hyperswitch_connectors/src/connectors/adyenplatform/transformers/payouts.rs (+193 -51) +- crates/router/src/core/payments/routing.rs (+13 -1) +- crates/router/src/core/payouts.rs (+40 -57) +- crates/router/src/core/payouts/helpers.rs (+43 -0) +- crates/router/src/core/payouts/validator.rs (+41 -27) +- crates/router/src/types/transformers.rs (+18 -0) +- nix/modules/flake/devshell.nix (+2 -0) + +=== PATCH === +diff --git a/crates/hyperswitch_connectors/src/connectors/adyenplatform/transformers/payouts.rs b/crates/hyperswitch_connectors/src/connectors/adyenplatform/transformers/payouts.rs +index b04ca410..35636889 100644 +--- a/crates/hyperswitch_connectors/src/connectors/adyenplatform/transformers/payouts.rs ++++ b/crates/hyperswitch_connectors/src/connectors/adyenplatform/transformers/payouts.rs +@@ -11,7 +11,9 @@ use super::{AdyenPlatformRouterData, Error}; + use crate::{ + connectors::adyen::transformers as adyen, + types::PayoutsResponseRouterData, +- utils::{self, AddressDetailsData, PayoutsData as _, RouterData as _}, ++ utils::{ ++ self, AddressDetailsData, PayoutFulfillRequestData, PayoutsData as _, RouterData as _, ++ }, + }; + + #[derive(Debug, Default, Serialize, Deserialize)] +@@ -54,8 +56,6 @@ pub enum AdyenPayoutMethod { + pub enum AdyenPayoutMethodDetails { + BankAccount(AdyenBankAccountDetails), + Card(AdyenCardDetails), +- #[serde(rename = "card")] +- CardToken(AdyenCardTokenDetails), + } + + #[derive(Debug, Serialize, Deserialize)] +@@ -117,9 +117,16 @@ pub struct AdyenCardDetails { + card_identification: AdyenCardIdentification, + } + ++#[derive(Debug, Serialize)] ++#[serde(untagged)] ++pub enum AdyenCardIdentification { ++ Card(AdyenRawCardIdentification), ++ Stored(AdyenStoredCardIdentification), ++} ++ + #[derive(Debug, Serialize)] + #[serde(rename_all = "camelCase")] +-pub struct AdyenCardIdentification { ++pub struct AdyenRawCardIdentification { + #[serde(rename = "number")] + card_number: cards::CardNumber, + expiry_month: Secret, +@@ -131,14 +138,7 @@ pub struct AdyenCardIdentification { + + #[derive(Debug, Serialize)] + #[serde(rename_all = "camelCase")] +-pub struct AdyenCardTokenDetails { +- card_holder: AdyenAccountHolder, +- card_identification: AdyenCardTokenIdentification, +-} +- +-#[derive(Debug, Serialize)] +-#[serde(rename_all = "camelCase")] +-pub struct AdyenCardTokenIdentification { ++pub struct AdyenStoredCardIdentification { + stored_payment_method_id: Secret, + } + +@@ -260,7 +260,6 @@ impl TryFrom<(&PayoutsRouterData, &payouts::CardPayout)> for AdyenAccountH + ) -> Result { + let billing_address = router_data.get_optional_billing(); + +- // Address is required for both card and bank payouts + let address = billing_address + .and_then(|billing| billing.address.as_ref().map(|addr| addr.try_into())) + .transpose()? +@@ -294,13 +293,25 @@ impl TryFrom<(&PayoutsRouterData, &payouts::CardPayout)> for AdyenAccountH + .into()); + }; + ++ let customer_id_reference = match router_data.get_connector_customer_id() { ++ Ok(connector_customer_id) => connector_customer_id, ++ Err(_) => { ++ let customer_id = router_data.get_customer_id()?; ++ format!( ++ "{}_{}", ++ router_data.merchant_id.get_string_repr(), ++ customer_id.get_string_repr() ++ ) ++ } ++ }; ++ + Ok(Self { + address: Some(address), + first_name, + last_name, + full_name: None, + email: router_data.get_optional_billing_email(), +- customer_id: Some(router_data.get_customer_id()?.get_string_repr().to_owned()), ++ customer_id: Some(customer_id_reference), + entity_type: Some(EntityType::from(router_data.request.entity_type)), + }) + } +@@ -314,7 +325,6 @@ impl TryFrom<(&PayoutsRouterData, &payouts::Bank)> for AdyenAccountHolder + ) -> Result { + let billing_address = router_data.get_optional_billing(); + +- // Address is required for both card and bank payouts + let address = billing_address + .and_then(|billing| billing.address.as_ref().map(|addr| addr.try_into())) + .transpose()? +@@ -324,46 +334,156 @@ impl TryFrom<(&PayoutsRouterData, &payouts::Bank)> for AdyenAccountHolder + + let full_name = router_data.get_billing_full_name()?; + ++ let customer_id_reference = match router_data.get_connector_customer_id() { ++ Ok(connector_customer_id) => connector_customer_id, ++ Err(_) => { ++ let customer_id = router_data.get_customer_id()?; ++ format!( ++ "{}_{}", ++ router_data.merchant_id.get_string_repr(), ++ customer_id.get_string_repr() ++ ) ++ } ++ }; ++ + Ok(Self { + address: Some(address), + first_name: None, + last_name: None, + full_name: Some(full_name), + email: router_data.get_optional_billing_email(), +- customer_id: Some(router_data.get_customer_id()?.get_string_repr().to_owned()), ++ customer_id: Some(customer_id_reference), + entity_type: Some(EntityType::from(router_data.request.entity_type)), + }) + } + } + +-impl TryFrom<&AdyenPlatformRouterData<&PayoutsRouterData>> for AdyenTransferRequest { ++#[derive(Debug)] ++pub struct StoredPaymentCounterparty<'a, F> { ++ pub item: &'a AdyenPlatformRouterData<&'a PayoutsRouterData>, ++ pub stored_payment_method_id: String, ++} ++ ++#[derive(Debug)] ++pub struct RawPaymentCounterparty<'a, F> { ++ pub item: &'a AdyenPlatformRouterData<&'a PayoutsRouterData>, ++ pub raw_payout_method_data: payouts::PayoutMethodData, ++} ++ ++impl TryFrom> ++ for (AdyenPayoutMethodDetails, Option) ++{ + type Error = Error; +- fn try_from( +- item: &AdyenPlatformRouterData<&PayoutsRouterData>, +- ) -> Result { +- let request = &item.router_data.request; +- let (counterparty, priority) = match item.router_data.get_payout_method_data()? { ++ ++ fn try_from(stored_payment: StoredPaymentCounterparty<'_, F>) -> Result { ++ let request = &stored_payment.item.router_data.request; ++ let payout_type = request.get_payout_type()?; ++ ++ match payout_type { ++ enums::PayoutType::Card => { ++ let billing_address = stored_payment.item.router_data.get_optional_billing(); ++ let address = billing_address ++ .and_then(|billing| billing.address.as_ref()) ++ .ok_or(ConnectorError::MissingRequiredField { ++ field_name: "address", ++ })? ++ .try_into()?; ++ ++ let customer_id_reference = ++ match stored_payment.item.router_data.get_connector_customer_id() { ++ Ok(connector_customer_id) => connector_customer_id, ++ Err(_) => { ++ let customer_id = stored_payment.item.router_data.get_customer_id()?; ++ format!( ++ "{}_{}", ++ stored_payment ++ .item ++ .router_data ++ .merchant_id ++ .get_string_repr(), ++ customer_id.get_string_repr() ++ ) ++ } ++ }; ++ ++ let card_holder = AdyenAccountHolder { ++ address: Some(address), ++ first_name: stored_payment ++ .item ++ .router_data ++ .get_optional_billing_first_name(), ++ last_name: stored_payment ++ .item ++ .router_data ++ .get_optional_billing_last_name(), ++ full_name: stored_payment ++ .item ++ .router_data ++ .get_optional_billing_full_name(), ++ email: stored_payment.item.router_data.get_optional_billing_email(), ++ customer_id: Some(customer_id_reference), ++ entity_type: Some(EntityType::from(request.entity_type)), ++ }; ++ ++ let card_identification = ++ AdyenCardIdentification::Stored(AdyenStoredCardIdentification { ++ stored_payment_method_id: Secret::new( ++ stored_payment.stored_payment_method_id, ++ ), ++ }); ++ ++ let counterparty = AdyenPayoutMethodDetails::Card(AdyenCardDetails { ++ card_holder, ++ card_identification, ++ }); ++ ++ Ok((counterparty, None)) ++ } ++ _ => Err(ConnectorError::NotSupported { ++ message: "Stored payment method is only supported for card payouts".to_string(), ++ connector: "Adyenplatform", ++ } ++ .into()), ++ } ++ } ++} ++ ++impl TryFrom> ++ for (AdyenPayoutMethodDetails, Option) ++{ ++ type Error = Error; ++ ++ fn try_from(raw_payment: RawPaymentCounterparty<'_, F>) -> Result { ++ let request = &raw_payment.item.router_data.request; ++ ++ match raw_payment.raw_payout_method_data { + payouts::PayoutMethodData::Wallet(_) => Err(ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("Adyenplatform"), + ))?, + payouts::PayoutMethodData::Card(c) => { +- let card_holder: AdyenAccountHolder = (item.router_data, &c).try_into()?; +- let card_identification = AdyenCardIdentification { +- card_number: c.card_number, +- expiry_month: c.expiry_month, +- expiry_year: c.expiry_year, +- issue_number: None, +- start_month: None, +- start_year: None, +- }; ++ let card_holder: AdyenAccountHolder = ++ (raw_payment.item.router_data, &c).try_into()?; ++ ++ let card_identification = ++ AdyenCardIdentification::Card(AdyenRawCardIdentification { ++ card_number: c.card_number, ++ expiry_month: c.expiry_month, ++ expiry_year: c.expiry_year, ++ issue_number: None, ++ start_month: None, ++ start_year: None, ++ }); ++ + let counterparty = AdyenPayoutMethodDetails::Card(AdyenCardDetails { + card_holder, + card_identification, + }); +- (counterparty, None) ++ ++ Ok((counterparty, None)) + } + payouts::PayoutMethodData::Bank(bd) => { +- let account_holder: AdyenAccountHolder = (item.router_data, &bd).try_into()?; ++ let account_holder: AdyenAccountHolder = ++ (raw_payment.item.router_data, &bd).try_into()?; + let bank_details = match bd { + payouts::Bank::Sepa(b) => AdyenBankAccountIdentification { + bank_type: "iban".to_string(), +@@ -393,9 +513,42 @@ impl TryFrom<&AdyenPlatformRouterData<&PayoutsRouterData>> for AdyenTransf + .ok_or(ConnectorError::MissingRequiredField { + field_name: "priority", + })?; +- (counterparty, Some(AdyenPayoutPriority::from(priority))) ++ ++ Ok((counterparty, Some(AdyenPayoutPriority::from(priority)))) + } +- }; ++ } ++ } ++} ++ ++impl TryFrom<&AdyenPlatformRouterData<&PayoutsRouterData>> for AdyenTransferRequest { ++ type Error = Error; ++ fn try_from( ++ item: &AdyenPlatformRouterData<&PayoutsRouterData>, ++ ) -> Result { ++ let request = &item.router_data.request; ++ let stored_payment_method_result = ++ item.router_data.request.get_connector_transfer_method_id(); ++ let raw_payout_method_result = item.router_data.get_payout_method_data(); ++ ++ let (counterparty, priority) = ++ if let Ok(stored_payment_method_id) = stored_payment_method_result { ++ StoredPaymentCounterparty { ++ item, ++ stored_payment_method_id, ++ } ++ .try_into()? ++ } else if let Ok(raw_payout_method_data) = raw_payout_method_result { ++ RawPaymentCounterparty { ++ item, ++ raw_payout_method_data, ++ } ++ .try_into()? ++ } else { ++ return Err(ConnectorError::MissingRequiredField { ++ field_name: "payout_method_data or stored_payment_method_id", ++ } ++ .into()); ++ }; + let adyen_connector_metadata_object = + AdyenPlatformConnectorMetadataObject::try_from(&item.router_data.connector_meta_data)?; + let balance_account_id = adyen_connector_metadata_object +@@ -570,22 +723,11 @@ pub fn get_adyen_webhook_event( + AdyenplatformWebhookStatus::Authorised | AdyenplatformWebhookStatus::Received => { + webhooks::IncomingWebhookEvent::PayoutCreated + } +- AdyenplatformWebhookStatus::Booked => { +- match category { +- Some(AdyenPayoutMethod::Card) => { +- // For card payouts, "booked" is the final success state +- webhooks::IncomingWebhookEvent::PayoutSuccess +- } +- Some(AdyenPayoutMethod::Bank) => { +- // For bank payouts, "booked" is intermediate - wait for final confirmation +- webhooks::IncomingWebhookEvent::PayoutProcessing +- } +- None => { +- // Default to processing if category is unknown +- webhooks::IncomingWebhookEvent::PayoutProcessing +- } +- } +- } ++ AdyenplatformWebhookStatus::Booked => match category { ++ Some(AdyenPayoutMethod::Card) => webhooks::IncomingWebhookEvent::PayoutSuccess, ++ Some(AdyenPayoutMethod::Bank) => webhooks::IncomingWebhookEvent::PayoutProcessing, ++ None => webhooks::IncomingWebhookEvent::PayoutProcessing, ++ }, + AdyenplatformWebhookStatus::Pending => webhooks::IncomingWebhookEvent::PayoutProcessing, + AdyenplatformWebhookStatus::Failed => webhooks::IncomingWebhookEvent::PayoutFailure, + AdyenplatformWebhookStatus::Returned => webhooks::IncomingWebhookEvent::PayoutReversed, +diff --git a/crates/router/src/core/payments/routing.rs b/crates/router/src/core/payments/routing.rs +index a06b6140..c7784118 100644 +--- a/crates/router/src/core/payments/routing.rs ++++ b/crates/router/src/core/payments/routing.rs +@@ -188,7 +188,19 @@ pub fn make_dsl_input_for_payouts( + payment_method_type: payout_data + .payout_method_data + .as_ref() +- .map(api_enums::PaymentMethodType::foreign_from), ++ .map(api_enums::PaymentMethodType::foreign_from) ++ .or_else(|| { ++ payout_data.payment_method.as_ref().and_then(|pm| { ++ #[cfg(feature = "v1")] ++ { ++ pm.payment_method_type ++ } ++ #[cfg(feature = "v2")] ++ { ++ pm.payment_method_subtype ++ } ++ }) ++ }), + card_network: None, + }; + Ok(dsl_inputs::BackendInput { +diff --git a/crates/router/src/core/payouts.rs b/crates/router/src/core/payouts.rs +index 66a824fc..dee0d3f1 100644 +--- a/crates/router/src/core/payouts.rs ++++ b/crates/router/src/core/payouts.rs +@@ -58,7 +58,7 @@ use crate::{ + api::{self, payments as payment_api_types, payouts}, + domain, + storage::{self, PaymentRoutingInfo}, +- transformers::ForeignFrom, ++ transformers::{ForeignFrom, ForeignTryFrom}, + }, + utils::{self, OptionExt}, + }; +@@ -78,6 +78,7 @@ pub struct PayoutData { + pub payout_link: Option, + pub current_locale: String, + pub payment_method: Option, ++ pub connector_transfer_method_id: Option, + } + + // ********************************************** CORE FLOWS ********************************************** +@@ -693,27 +694,8 @@ pub async fn payouts_fulfill_core( + .attach_printable("Connector not found for payout fulfillment")?, + }; + +- // Trigger fulfillment +- let customer_id = payout_data +- .payouts +- .customer_id +- .clone() +- .get_required_value("customer_id")?; +- payout_data.payout_method_data = Some( +- helpers::make_payout_method_data( +- &state, +- None, +- payout_attempt.payout_token.as_deref(), +- &customer_id, +- &payout_attempt.merchant_id, +- payout_data.payouts.payout_type, +- merchant_context.get_merchant_key_store(), +- Some(&mut payout_data), +- merchant_context.get_merchant_account().storage_scheme, +- ) +- .await? +- .get_required_value("payout_method_data")?, +- ); ++ helpers::fetch_payout_method_data(&state, &mut payout_data, &connector_data, &merchant_context) ++ .await?; + Box::pin(fulfill_payout( + &state, + &merchant_context, +@@ -1072,25 +1054,8 @@ pub async fn call_connector_payout( + + // Fetch / store payout_method_data + if payout_data.payout_method_data.is_none() || payout_attempt.payout_token.is_none() { +- let customer_id = payouts +- .customer_id +- .clone() +- .get_required_value("customer_id")?; +- payout_data.payout_method_data = Some( +- helpers::make_payout_method_data( +- state, +- payout_data.payout_method_data.to_owned().as_ref(), +- payout_attempt.payout_token.as_deref(), +- &customer_id, +- &payout_attempt.merchant_id, +- payouts.payout_type, +- merchant_context.get_merchant_key_store(), +- Some(payout_data), +- merchant_context.get_merchant_account().storage_scheme, +- ) +- .await? +- .get_required_value("payout_method_data")?, +- ); ++ helpers::fetch_payout_method_data(state, payout_data, connector_data, merchant_context) ++ .await?; + } + // Eligibility flow + Box::pin(complete_payout_eligibility( +@@ -2002,8 +1967,7 @@ pub async fn complete_create_recipient_disburse_account( + && connector_data + .connector_name + .supports_vendor_disburse_account_create_for_payout() +- && helpers::should_create_connector_transfer_method(&*payout_data, connector_data)? +- .is_none() ++ && helpers::should_create_connector_transfer_method(payout_data, connector_data)?.is_none() + { + Box::pin(create_recipient_disburse_account( + state, +@@ -2706,12 +2670,29 @@ pub async fn payout_create_db_entries( + .map(|pm| pm.payment_method_id.clone()), + Some(api_enums::PayoutType::foreign_from(payout_method_data)), + ), +- None => ( +- payment_method +- .as_ref() +- .map(|pm| pm.payment_method_id.clone()), +- req.payout_type.to_owned(), +- ), ++ None => { ++ ( ++ payment_method ++ .as_ref() ++ .map(|pm| pm.payment_method_id.clone()), ++ match req.payout_type { ++ None => payment_method ++ .as_ref() ++ .and_then(|pm| pm.payment_method) ++ .map(|payment_method_enum| { ++ api_enums::PayoutType::foreign_try_from(payment_method_enum) ++ .change_context(errors::ApiErrorResponse::InvalidRequestData { ++ message: format!( ++ "PaymentMethod {payment_method_enum:?} is not supported for payouts" ++ ), ++ }) ++ .attach_printable("Failed to convert PaymentMethod to PayoutType") ++ }) ++ .transpose()?, ++ payout_type => payout_type, ++ }, ++ ) ++ } + }; + + let client_secret = utils::generate_id( +@@ -2837,6 +2818,7 @@ pub async fn payout_create_db_entries( + payout_link, + current_locale: locale.to_string(), + payment_method, ++ connector_transfer_method_id: None, + }) + } + +@@ -3031,11 +3013,10 @@ pub async fn make_payout_data( + .await + .transpose()?; + +- let payout_method_id = payouts.payout_method_id.clone(); +- let mut payment_method: Option = None; +- +- if let Some(pm_id) = payout_method_id { +- payment_method = Some( ++ let payment_method = payouts ++ .payout_method_id ++ .clone() ++ .async_map(|pm_id| async move { + db.find_payment_method( + &(state.into()), + merchant_context.get_merchant_key_store(), +@@ -3044,9 +3025,10 @@ pub async fn make_payout_data( + ) + .await + .change_context(errors::ApiErrorResponse::PaymentMethodNotFound) +- .attach_printable("Unable to find payment method")?, +- ); +- } ++ .attach_printable("Unable to find payment method") ++ }) ++ .await ++ .transpose()?; + + Ok(PayoutData { + billing_address, +@@ -3061,6 +3043,7 @@ pub async fn make_payout_data( + payout_link, + current_locale: locale.to_string(), + payment_method, ++ connector_transfer_method_id: None, + }) + } + +diff --git a/crates/router/src/core/payouts/helpers.rs b/crates/router/src/core/payouts/helpers.rs +index d74baa20..8f104451 100644 +--- a/crates/router/src/core/payouts/helpers.rs ++++ b/crates/router/src/core/payouts/helpers.rs +@@ -222,6 +222,49 @@ pub fn should_create_connector_transfer_method( + Ok(connector_transfer_method_id) + } + ++pub async fn fetch_payout_method_data( ++ state: &SessionState, ++ payout_data: &mut PayoutData, ++ connector_data: &api::ConnectorData, ++ merchant_context: &domain::MerchantContext, ++) -> RouterResult<()> { ++ let connector_transfer_method_id = ++ should_create_connector_transfer_method(payout_data, connector_data)?; ++ ++ if connector_transfer_method_id.is_some() { ++ logger::info!("Using stored transfer_method_id, skipping payout_method_data fetch"); ++ } else { ++ let customer_id = payout_data ++ .payouts ++ .customer_id ++ .clone() ++ .get_required_value("customer_id")?; ++ ++ let payout_method_data_clone = payout_data.payout_method_data.clone(); ++ let payout_token = payout_data.payout_attempt.payout_token.clone(); ++ let merchant_id = payout_data.payout_attempt.merchant_id.clone(); ++ let payout_type = payout_data.payouts.payout_type; ++ ++ let payout_method_data = make_payout_method_data( ++ state, ++ payout_method_data_clone.as_ref(), ++ payout_token.as_deref(), ++ &customer_id, ++ &merchant_id, ++ payout_type, ++ merchant_context.get_merchant_key_store(), ++ Some(payout_data), ++ merchant_context.get_merchant_account().storage_scheme, ++ ) ++ .await? ++ .get_required_value("payout_method_data")?; ++ ++ payout_data.payout_method_data = Some(payout_method_data); ++ } ++ ++ Ok(()) ++} ++ + #[cfg(feature = "v1")] + pub async fn save_payout_data_to_locker( + state: &SessionState, +diff --git a/crates/router/src/core/payouts/validator.rs b/crates/router/src/core/payouts/validator.rs +index 198caa4b..87a0748e 100644 +--- a/crates/router/src/core/payouts/validator.rs ++++ b/crates/router/src/core/payouts/validator.rs +@@ -223,34 +223,48 @@ pub async fn validate_create_request( + .await + } + (_, Some(_), Some(payment_method)) => { +- match get_pm_list_context( +- state, +- payment_method +- .payment_method +- .as_ref() +- .get_required_value("payment_method_id")?, +- merchant_context.get_merchant_key_store(), +- payment_method, +- None, +- false, +- true, +- merchant_context, +- ) +- .await? ++ // Check if we have a stored transfer_method_id first ++ if payment_method ++ .get_common_mandate_reference() ++ .ok() ++ .and_then(|common_mandate_ref| common_mandate_ref.payouts) ++ .map(|payouts_mandate_ref| !payouts_mandate_ref.0.is_empty()) ++ .unwrap_or(false) + { +- Some(pm) => match (pm.card_details, pm.bank_transfer_details) { +- (Some(card), _) => Ok(Some(payouts::PayoutMethodData::Card( +- api_models::payouts::CardPayout { +- card_number: card.card_number.get_required_value("card_number")?, +- card_holder_name: card.card_holder_name, +- expiry_month: card.expiry_month.get_required_value("expiry_month")?, +- expiry_year: card.expiry_year.get_required_value("expiry_year")?, +- }, +- ))), +- (_, Some(bank)) => Ok(Some(payouts::PayoutMethodData::Bank(bank))), +- _ => Ok(None), +- }, +- None => Ok(None), ++ Ok(None) ++ } else { ++ // No transfer_method_id available, proceed with vault fetch for raw card details ++ match get_pm_list_context( ++ state, ++ payment_method ++ .payment_method ++ .as_ref() ++ .get_required_value("payment_method_id")?, ++ merchant_context.get_merchant_key_store(), ++ payment_method, ++ None, ++ false, ++ true, ++ merchant_context, ++ ) ++ .await? ++ { ++ Some(pm) => match (pm.card_details, pm.bank_transfer_details) { ++ (Some(card), _) => Ok(Some(payouts::PayoutMethodData::Card( ++ api_models::payouts::CardPayout { ++ card_number: card.card_number.get_required_value("card_number")?, ++ card_holder_name: card.card_holder_name, ++ expiry_month: card ++ .expiry_month ++ .get_required_value("expiry_month")?, ++ expiry_year: card.expiry_year.get_required_value("expiry_year")?, ++ }, ++ ))), ++ (_, Some(bank)) => Ok(Some(payouts::PayoutMethodData::Bank(bank))), ++ _ => Ok(None), ++ }, ++ None => Ok(None), ++ } + } + } + _ => Ok(None), +diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs +index cc7fd65a..692bcf69 100644 +--- a/crates/router/src/types/transformers.rs ++++ b/crates/router/src/types/transformers.rs +@@ -1251,6 +1251,24 @@ impl ForeignFrom for api_enums::PaymentMethod { + } + } + ++#[cfg(feature = "payouts")] ++impl ForeignTryFrom for api_models::enums::PayoutType { ++ type Error = error_stack::Report; ++ ++ fn foreign_try_from(value: api_enums::PaymentMethod) -> Result { ++ match value { ++ api_enums::PaymentMethod::Card => Ok(Self::Card), ++ api_enums::PaymentMethod::BankTransfer => Ok(Self::Bank), ++ api_enums::PaymentMethod::Wallet => Ok(Self::Wallet), ++ _ => Err(errors::ApiErrorResponse::InvalidRequestData { ++ message: format!("PaymentMethod {value:?} is not supported for payouts"), ++ }) ++ .change_context(errors::ApiErrorResponse::InternalServerError) ++ .attach_printable("Failed to convert PaymentMethod to PayoutType"), ++ } ++ } ++} ++ + #[cfg(feature = "v1")] + impl ForeignTryFrom<&HeaderMap> for hyperswitch_domain_models::payments::HeaderPayload { + type Error = error_stack::Report; +diff --git a/nix/modules/flake/devshell.nix b/nix/modules/flake/devshell.nix +index 6df0f595..2fdcdd78 100644 +--- a/nix/modules/flake/devshell.nix ++++ b/nix/modules/flake/devshell.nix +@@ -35,6 +35,8 @@ + shellHook = '' + echo 1>&2 "Ready to work on hyperswitch!" + rustc --version ++ export OPENSSL_DIR="${pkgs.openssl.dev}" ++ export OPENSSL_LIB_DIR="${pkgs.openssl.out}/lib" + ''; + }; + qa = pkgs.mkShell { + +----- END CHUNK ----- \ No newline at end of file diff --git a/raw/ba/ba15c0f194e2e128a1304e11d45f794cd3b69cbe.txt b/raw/ba/ba15c0f194e2e128a1304e11d45f794cd3b69cbe.txt new file mode 100644 index 0000000000000000000000000000000000000000..c21fe4583eceb49a97e1b239ded02cc46be7ca03 --- /dev/null +++ b/raw/ba/ba15c0f194e2e128a1304e11d45f794cd3b69cbe.txt @@ -0,0 +1,605 @@ +ROUTE: juspay/hyperswitch@ba15c0f194e2e128a1304e11d45f794cd3b69cbe +REPO: https://github.com/juspay/hyperswitch +COMMIT: ba15c0f194e2e128a1304e11d45f794cd3b69cbe +AUTHOR: Swangi Kumari <85639103+swangi-kumari@users.noreply.github.com> +DATE: 2025-08-19T10:29:12 + +=== ISSUE_AND_PR === +[PR #8913] refactor(connector): [Nuvei] Fix card 3ds +URL: https://github.com/juspay/hyperswitch/pull/8913 +BODY: +## Type of Change + + +- [x] Bugfix +- [ ] New feature +- [x] Enhancement +- [ ] Refactoring +- [ ] Dependency updates +- [ ] Documentation +- [ ] CI/CD + +## Description +Fix deserlization error for Nuvei card 3ds + +### Additional Changes + +- [ ] This PR modifies the API contract +- [ ] This PR modifies the database schema +- [ ] This PR modifies application configuration/environment variables + + + + +## Motivation and Context + + + +## How did you test it? +Create nuvie card 3ds +``` +curl --location 'http://localhost:8080/payments' \ +--header 'Content-Type: application/json' \ +--header 'Accept: application/json' \ +--header 'api-key: dev_5iub419oM0WIf9pI6nHrCbopoQ5dSKQEJkyPJZCmYbqECx5KC61S7N1yl7c1IdKD' \ +--data-raw '{ + "amount": 15100, + "currency": "EUR", + "confirm": true, + "customer_id":"nithxxinn", + "return_url": "https://www.google.com", + "capture_method": "automatic", + "payment_method": "card", + "payment_method_type": "credit", + "authentication_type": "three_ds", + "description": "hellow world", + "billing": { + "address": { + "zip": "560095", + "country": "US", + "first_name": "Sakil", + "last_name": "Mostak", + "line1": "Fasdf", + "line2": "Fasdf", + "city": "Fasdf" + } + }, + "browser_info": { + "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", + "ip_address": "192.168.1.1", + "java_enabled": false, + "java_script_enabled": true, + "language": "en-US", + "color_depth": 24, + "screen_height": 1080, + "screen_width": 1920, + "time_zone": 330, + "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36" + }, + "email": "hello@gmail.com", + "payment_method_data": { + "card": { + "card_number": "2221008123677736", + "card_exp_month": "12", + "card_exp_year": "2030", + "card_holder_name": "CL-BRW2", + "card_cvc": "217" + } + }, + "setup_future_usage": "on_session" +}' +``` +response +``` +{ + "payment_id": "pay_SwA17VK0vJc9lZyksSsp", + "merchant_id": "merchant_1754896786", + "status": "requires_customer_action", + "amount": 15100, + "net_amount": 15100, + "shipping_cost": null, + "amount_capturable": 15100, + "amount_received": null, + "connector": "nuvei", + "client_secret": "pay_SwA17VK0vJc9lZyksSsp_secret_1Le4qoHaeDahJN4pDv4N", + "created": "2025-08-11T12:47:40.099Z", + "currency": "EUR", + "customer_id": "nithxxinn", + "customer": { + "id": "nithxxinn", + "name": null, + "email": "hello@gmail.com", + "phone": null, + "phone_country_code": null + }, + "description": "hellow world", + "refunds": null, + "disputes": null, + "mandate_id": null, + "mandate_data": null, + "setup_future_usage": "on_session", + "off_session": null, + "capture_on": null, + "capture_method": "automatic", + "payment_method": "card", + "payment_method_data": { + "card": { + "last4": "7736", + "card_type": null, + "card_network": null, + "card_issuer": null, + "card_issuing_country": null, + "card_isin": "222100", + "card_extended_bin": null, + "card_exp_month": "12", + "card_exp_year": "2030", + "card_holder_name": "CL-BRW2", + "payment_checks": { + "avs_description": null, + "avs_result_code": "", + "cvv_2_reply_code": "", + "cvv_2_description": null, + "merchant_advice_code": "", + "merchant_advice_code_description": null + }, + "authentication_data": { + "cReq": "eyJ0aHJlZURTU2VydmVyVHJhbnNJRCI6IjZjNzNkZWQ5LTRmMzEtNDNjMS1iYjdmLTEwMDA2YmYyMTBmYiIsImFjc1RyYW5zSUQiOiIzZmRhNGVjYS0xMzI3LTQyZjctOGU2Ny1mYzE4ZDUxNDM0NTIiLCJjaGFsbGVuZ2VXaW5kb3dTaXplIjoiMDUiLCJtZXNzYWdlVHlwZSI6IkNSZXEiLCJtZXNzYWdlVmVyc2lvbiI6IjIuMi4wIn0", + "flow": "challenge", + "acsUrl": "https://3dsn.sandbox.safecharge.com/ThreeDSACSEmulatorChallenge/api/ThreeDSACSChallengeController/ChallengePage?eyJub3RpZmljYXRpb25VUkwiOiJodHRwOi8vbG9jYWxob3N0OjgwODAvcGF5bWVudHMvcGF5X1N3QTE3VkswdkpjOWxaeWtzU3NwL21lcmNoYW50XzE3NTQ4OTY3ODYvcmVkaXJlY3QvY29tcGxldGUvbnV2ZWkiLCJ0aHJlZURTU2VydmVyVHJhbnNJRCI6IjZjNzNkZWQ5LTRmMzEtNDNjMS1iYjdmLTEwMDA2YmYyMTBmYiIsImFjc1RyYW5zSUQiOiIzZmRhNGVjYS0xMzI3LTQyZjctOGU2Ny1mYzE4ZDUxNDM0NTIiLCJkc1RyYW5zSUQiOiI3ZGUyY2YxZC00MmYxLTQ1ZWItOGE1Mi02MmQ5Mjk3OWEwOWUiLCJkYXRhIjpudWxsLCJNZXNzYWdlVmVyc2lvbiI6IjIuMi4wIn0=", + "version": "2.2.0", + "threeDFlow": "1", + "decisionReason": "NoPreference", + "threeDReasonId": "", + "acquirerDecision": "ExemptionRequest", + "challengePreferenceReason": "12", + "isExemptionRequestInAuthentication": "0" + } + }, + "billing": null + }, + "payment_token": "token_jptsctTb26hNYSmaPHom", + "shipping": null, + "billing": { + "address": { + "city": "Fasdf", + "country": "US", + "line1": "Fasdf", + "line2": "Fasdf", + "line3": null, + "zip": "560095", + "state": null, + "first_name": "Sakil", + "last_name": "Mostak", + "origin_zip": null + }, + "phone": null, + "email": null + }, + "order_details": null, + "email": "hello@gmail.com", + "name": null, + "phone": null, + "return_url": "https://www.google.com/", + "authentication_type": "three_ds", + "statement_descriptor_name": null, + "statement_descriptor_suffix": null, + "next_action": { + "type": "redirect_to_url", + "redirect_to_url": "http://localhost:8080/payments/redirect/pay_SwA17VK0vJc9lZyksSsp/merchant_1754896786/pay_SwA17VK0vJc9lZyksSsp_1" + }, + "cancellation_reason": null, + "error_code": null, + "error_message": null, + "unified_code": null, + "unified_message": null, + "payment_experience": null, + "payment_method_type": "credit", + "connector_label": null, + "business_country": null, + "business_label": "default", + "business_sub_label": null, + "allowed_payment_method_types": null, + "ephemeral_key": { + "customer_id": "nithxxinn", + "created_at": 1754916460, + "expires": 1754920060, + "secret": "epk_00825ca507a647b1a68b6e174af4ad28" + }, + "manual_retry_allowed": null, + "connector_transaction_id": "8110000000012074375", + "frm_message": null, + "metadata": null, + "connector_metadata": null, + "feature_metadata": null, + "reference_id": "7784849111", + "payment_link": null, + "profile_id": "pro_Ff3vG29EedTBVrRtdf20", + "surcharge_details": null, + "attempt_count": 1, + "merchant_decision": null, + "merchant_connector_id": "mca_vvdYt5E4uXbNvYftGlYf", + "incremental_authorization_allowed": null, + "authorization_count": null, + "incremental_authorizations": null, + "external_authentication_details": null, + "external_3ds_authentication_attempted": false, + "expires_on": "2025-08-11T13:02:40.099Z", + "fingerprint": null, + "browser_info": { + "language": "en-US", + "time_zone": 330, + "ip_address": "192.168.1.1", + "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36", + "color_depth": 24, + "java_enabled": false, + "screen_width": 1920, + "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", + "screen_height": 1080, + "java_script_enabled": true + }, + "payment_channel": null, + "payment_method_id": null, + "network_transaction_id": null, + "payment_method_status": null, + "updated": "2025-08-11T12:47:42.875Z", + "split_payments": null, + "frm_metadata": null, + "extended_authorization_applied": null, + "capture_before": null, + "merchant_order_reference_id": null, + "order_tax_amount": null, + "connector_mandate_id": null, + "card_discovery": "manual", + "force_3ds_challenge": false, + "force_3ds_challenge_trigger": false, + "issuer_error_code": null, + "issuer_error_message": null, + "is_iframe_redirection_enabled": null, + "whole_connector_response": null, + "enable_partial_authorization": null +} +``` +Complete payment using redirection + +2. Do psync +Response +``` +{ + "payment_id": "pay_SwA17VK0vJc9lZyksSsp", + "merchant_id": "merchant_1754896786", + "status": "succeeded", + "amount": 15100, + "net_amount": 15100, + "shipping_cost": null, + "amount_capturable": 0, + "amount_received": 15100, + "connector": "nuvei", + "client_secret": "pay_SwA17VK0vJc9lZyksSsp_secret_1Le4qoHaeDahJN4pDv4N", + "created": "2025-08-11T12:47:40.099Z", + "currency": "EUR", + "customer_id": "nithxxinn", + "customer": { + "id": "nithxxinn", + "name": null, + "email": "hello@gmail.com", + "phone": null, + "phone_country_code": null + }, + "description": "hellow world", + "refunds": null, + "disputes": null, + "mandate_id": null, + "mandate_data": null, + "setup_future_usage": "on_session", + "off_session": null, + "capture_on": null, + "capture_method": "automatic", + "payment_method": "card", + "payment_method_data": { + "card": { + "last4": "7736", + "card_type": null, + "card_network": null, + "card_issuer": null, + "card_issuing_country": null, + "card_isin": "222100", + "card_extended_bin": null, + "card_exp_month": "12", + "card_exp_year": "2030", + "card_holder_name": "CL-BRW2", + "payment_checks": { + "avs_description": null, + "avs_result_code": "", + "cvv_2_reply_code": "", + "cvv_2_description": null, + "merchant_advice_code": "", + "merchant_advice_code_description": null + }, + "authentication_data": { + "flow": "challenge", + "decisionReason": "NoPreference", + "acquirerDecision": "ExemptionRequest", + "challengePreferenceReason": "12" + } + }, + "billing": null + }, + "payment_token": "token_jptsctTb26hNYSmaPHom", + "shipping": null, + "billing": { + "address": { + "city": "Fasdf", + "country": "US", + "line1": "Fasdf", + "line2": "Fasdf", + "line3": null, + "zip": "560095", + "state": null, + "first_name": "Sakil", + "last_name": "Mostak", + "origin_zip": null + }, + "phone": null, + "email": null + }, + "order_details": null, + "email": "hello@gmail.com", + "name": null, + "phone": null, + "return_url": "https://www.google.com/", + "authentication_type": "three_ds", + "statement_descriptor_name": null, + "statement_descriptor_suffix": null, + "next_action": null, + "cancellation_reason": null, + "error_code": null, + "error_message": null, + "unified_code": null, + "unified_message": null, + "payment_experience": null, + "payment_method_type": "credit", + "connector_label": null, + "business_country": null, + "business_label": "default", + "business_sub_label": null, + "allowed_payment_method_types": null, + "ephemeral_key": null, + "manual_retry_allowed": false, + "connector_transaction_id": "8110000000012074525", + "frm_message": null, + "metadata": null, + "connector_metadata": null, + "feature_metadata": null, + "reference_id": "7784849111", + "payment_link": null, + "profile_id": "pro_Ff3vG29EedTBVrRtdf20", + "surcharge_details": null, + "attempt_count": 1, + "merchant_decision": null, + "merchant_connector_id": "mca_vvdYt5E4uXbNvYftGlYf", + "incremental_authorization_allowed": null, + "authorization_count": null, + "incremental_authorizations": null, + "external_authentication_details": null, + "external_3ds_authentication_attempted": false, + "expires_on": "2025-08-11T13:02:40.099Z", + "fingerprint": null, + "browser_info": { + "language": "en-US", + "time_zone": 330, + "ip_address": "192.168.1.1", + "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36", + "color_depth": 24, + "java_enabled": false, + "screen_width": 1920, + "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", + "screen_height": 1080, + "java_script_enabled": true + }, + "payment_channel": null, + "payment_method_id": null, + "network_transaction_id": null, + "payment_method_status": null, + "updated": "2025-08-11T12:49:18.842Z", + "split_payments": null, + "frm_metadata": null, + "extended_authorization_applied": null, + "capture_before": null, + "merchant_order_reference_id": null, + "order_tax_amount": null, + "connector_mandate_id": null, + "card_discovery": "manual", + "force_3ds_challenge": false, + "force_3ds_challenge_trigger": false, + "issuer_error_code": null, + "issuer_error_message": null, + "is_iframe_redirection_enabled": null, + "whole_connector_response": null, + "enable_partial_authorization": null +} +``` + +cypress test +Screenshot 2025-08-12 at 1 41 17 PM + +Screenshot 2025-08-12 at 4 44 25 PM + +Screenshot 2025-08-19 at 3 30 24 PM + + + +## Checklist + + +- [x] I formatted the code `cargo +nightly fmt --all` +- [x] I addressed lints thrown by `cargo clippy` +- [x] I reviewed the submitted code +- [ ] I added unit tests for my changes where possible +COMMENTS: +- semanticdiff-com[bot]: Review changes with  SemanticDiff +
+Changed Files +
+ +| File | Status | +| :--- | :--- | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8913/changes#crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/nuvei/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8913/changes#crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8913/changes#crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs)  60% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8913/changes#crates/hyperswitch_domain_models/src/router_request_types/authentication.rs)  [crates/hyperswitch\_domain\_models/src/router\_request\_types/authentication\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8913/changes#crates/hyperswitch_domain_models/src/router_request_types/authentication.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8913/changes#crates/hyperswitch_domain_models/src/router_request_types/authentication.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8913/changes#cypress-tests/cypress/e2e/configs/Payment/Nuvei.js)  [cypress\-tests/cypress/e2e/configs/Payment/Nuvei\.js](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8913/changes#cypress-tests/cypress/e2e/configs/Payment/Nuvei.js) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8913/changes#cypress-tests/cypress/e2e/configs/Payment/Nuvei.js)  0% smaller | + +
+- SanchithHegde [crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs:1213]: Why has this been hardcoded? +- SanchithHegde [crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs:65]: Nit: Possible typo? + +```suggestion +// The dimensions of the challenge window for full screen. +``` + +=== COMMIT === +SUBJECT: refactor(connector): [Nuvei] Fix card 3ds (#8913) +BODY: +Co-authored-by: nihtin +Co-authored-by: Nithin N <57832822+Nithin1506200@users.noreply.github.com> +Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> + +=== FILES === +Summary: 3 files changed, +34 -12 +- crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs (+32 -10) +- crates/hyperswitch_domain_models/src/router_request_types/authentication.rs (+1 -1) +- cypress-tests/cypress/e2e/configs/Payment/Nuvei.js (+1 -1) + +=== PATCH === +diff --git a/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs b/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs +index 6d4b27f1..3e811b7d 100644 +--- a/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs +@@ -62,6 +62,11 @@ fn to_boolean(string: String) -> bool { + } + } + ++// The dimensions of the challenge window for full screen. ++const CHALLENGE_WINDOW_SIZE: &str = "05"; ++// The challenge preference for the challenge flow. ++const CHALLENGE_PREFERNCE: &str = "01"; ++ + trait NuveiAuthorizePreprocessingCommon { + fn get_browser_info(&self) -> Option; + fn get_related_transaction_id(&self) -> Option; +@@ -527,6 +532,7 @@ pub struct V2AdditionalParams { + pub rebill_expiry: Option, + /// Recurring Frequency in days + pub rebill_frequency: Option, ++ pub challenge_preference: Option, + } + + #[derive(Debug, Clone, Default, Serialize, Deserialize)] +@@ -563,7 +569,7 @@ pub struct NuveiACSResponse { + pub message_type: String, + pub message_version: String, + pub trans_status: Option, +- pub message_extension: Vec, ++ pub message_extension: Option>, + pub acs_signed_content: Option, + } + +@@ -1197,11 +1203,22 @@ where + ), + rebill_frequency: Some(mandate_meta.frequency), + challenge_window_size: None, ++ challenge_preference: None, + }), + item.request.get_customer_id_required(), + ) + } +- _ => (None, None, None), ++ // non mandate transactions ++ _ => ( ++ None, ++ Some(V2AdditionalParams { ++ rebill_expiry: None, ++ rebill_frequency: None, ++ challenge_window_size: Some(CHALLENGE_WINDOW_SIZE.to_string()), ++ challenge_preference: Some(CHALLENGE_PREFERNCE.to_string()), ++ }), ++ None, ++ ), + }; + let three_d = if item.is_three_ds() { + let browser_details = match &browser_information { +@@ -1277,14 +1294,18 @@ impl TryFrom<(&types::PaymentsCompleteAuthorizeRouterData, Secret)> + ) -> Result { + let item = data.0; + let request_data = match item.request.payment_method_data.clone() { +- Some(PaymentMethodData::Card(card)) => Ok(Self { +- payment_option: PaymentOption::from(NuveiCardDetails { +- card, +- three_d: None, +- card_holder_name: item.get_optional_billing_full_name(), +- }), +- ..Default::default() +- }), ++ Some(PaymentMethodData::Card(card)) => { ++ let device_details = DeviceDetails::foreign_try_from(&item.request.browser_info)?; ++ Ok(Self { ++ payment_option: PaymentOption::from(NuveiCardDetails { ++ card, ++ three_d: None, ++ card_holder_name: item.get_optional_billing_full_name(), ++ }), ++ device_details, ++ ..Default::default() ++ }) ++ } + Some(PaymentMethodData::Wallet(..)) + | Some(PaymentMethodData::PayLater(..)) + | Some(PaymentMethodData::BankDebit(..)) +@@ -1319,6 +1340,7 @@ impl TryFrom<(&types::PaymentsCompleteAuthorizeRouterData, Secret)> + Ok(Self { + related_transaction_id: request_data.related_transaction_id, + payment_option: request_data.payment_option, ++ device_details: request_data.device_details, + ..request + }) + } +diff --git a/crates/hyperswitch_domain_models/src/router_request_types/authentication.rs b/crates/hyperswitch_domain_models/src/router_request_types/authentication.rs +index a26d0c76..1c6977ac 100644 +--- a/crates/hyperswitch_domain_models/src/router_request_types/authentication.rs ++++ b/crates/hyperswitch_domain_models/src/router_request_types/authentication.rs +@@ -75,7 +75,7 @@ pub struct MessageExtensionAttribute { + pub id: String, + pub name: String, + pub criticality_indicator: bool, +- pub data: String, ++ pub data: serde_json::Value, + } + + #[derive(Clone, Default, Debug)] +diff --git a/cypress-tests/cypress/e2e/configs/Payment/Nuvei.js b/cypress-tests/cypress/e2e/configs/Payment/Nuvei.js +index ed5a9641..fe3d4e87 100644 +--- a/cypress-tests/cypress/e2e/configs/Payment/Nuvei.js ++++ b/cypress-tests/cypress/e2e/configs/Payment/Nuvei.js +@@ -183,7 +183,7 @@ export const connectorDetails = { + body: { + status: "requires_customer_action", + setup_future_usage: "on_session", +- payment_method_data: payment_method_data_3ds, ++ // we are removing payment_method_data from the response as authentication_data is different every time. + }, + }, + }, + +----- END CHUNK ----- \ No newline at end of file diff --git a/raw/c0/c09c936643170c595303293601d41c4207e12068.txt b/raw/c0/c09c936643170c595303293601d41c4207e12068.txt new file mode 100644 index 0000000000000000000000000000000000000000..1780100bba77777f03883817f978ae5db99fe172 --- /dev/null +++ b/raw/c0/c09c936643170c595303293601d41c4207e12068.txt @@ -0,0 +1,7333 @@ +ROUTE: juspay/hyperswitch@c09c936643170c595303293601d41c4207e12068 +REPO: https://github.com/juspay/hyperswitch +COMMIT: c09c936643170c595303293601d41c4207e12068 +AUTHOR: Vani Gupta <118043711+Vani-1107@users.noreply.github.com> +DATE: 2025-08-20T07:47:51 + +=== ISSUE_AND_PR === +[PR #8586] feat(connector): [DWOLLA] Connector integration +URL: https://github.com/juspay/hyperswitch/pull/8586 +BODY: +## Type of Change + + +- [ ] Bugfix +- [x] New feature +- [ ] Enhancement +- [ ] Refactoring +- [ ] Dependency updates +- [ ] Documentation +- [ ] CI/CD + +## Description + +Integrate Dwolla connector +Added ACH bank debit flow. + +
+ Flow + +- Customer Creation - We create a customer using their email ID and receive the customer ID in the response headers. +- Payment Method Token (PMT) - We use the customer ID and bank account details to create a funding source.Receive the funding source ID in the response headers. +Handling Duplicate PMT Errors - When a subsequent request is made with the same bank account details, the connector returns a 4xx error along with the existing funding source ID in the error response. +To handle this scenario: + - A new connector_metadata field is added to the ErrorResponse. + - This field is populated with the funding source ID from the error. + - If connector_metadata is present in the response, the error is treated as a successful (2xx) response, and the flow continues using the provided funding source ID. + +- Payments Flow + - Use the customer funding source ID (from step 2 or retrieved from connector_metadata in case of a duplicate). + - Use the merchant funding source ID (provided by the merchant and stored in metadata in MCA call). + - Initiate the payment request. + - The transaction ID is received in the response headers. + +- Refunds Flow +Since the connector does not support native refunds, we reverse the direction of payment to simulate a refund. + - Use the merchant funding source ID (provided by the merchant and stored in metadata in MCA call) as the source account. + - Use the customer funding ID, which we store in connector_metadata during the payments call as destination account. + +Note : In the Dwolla Sandbox environment, payment (transfer) statuses do not automatically change to "success" (or "processed") for bank-sourced transfers. By default, these transfers will remain in the "pending" state indefinitely, as the Sandbox does not replicate real ACH processing. + +
+ + +### Additional Changes + +- [ ] This PR modifies the API contract +- [ ] This PR modifies the database schema +- [ ] This PR modifies application configuration/environment variables + + + + +## Motivation and Context + + +## How did you test it? + + +Payments Create + +
+ Request + +``` + +{ + "amount": 100, + "currency": "USD", + "confirm": true, + "capture_method": "automatic", + "authentication_type": "no_three_ds", + "customer": { + "id": "johndoe", + "name": "John Doe", + "email": "johndoe@example.com", + "phone": "9999999999", + "phone_country_code": "+1" + }, + "phone_country_code": "+1", + "description": "Its my first payment request", + "return_url": "https://google.com", + "payment_method": "bank_debit", + "payment_method_type": "ach", + "payment_method_data": { + "bank_debit": { + "ach_bank_debit" : { + "routing_number": "222222226", + "account_number": "1134511289", + "bank_type": "checking", + "bank_account_holder_name": "Test Checking Account2" + } + } + }, + "billing": { + "address": { + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "city": "San Fransico", + "state": "California", + "zip": "94122", + "country": "US", + "first_name": "john", + "last_name": "Doe" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + }, + "email": "johndoe@example.com" + }, + "statement_descriptor_name": "john", + "statement_descriptor_suffix": "JS", + "browser_info": { + "user_agent": "Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/70.0.3538.110 Safari\/537.36", + "accept_header": "text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,*\/*;q=0.8", + "language": "nl-NL", + "color_depth": 24, + "screen_height": 723, + "screen_width": 1536, + "time_zone": 0, + "java_enabled": true, + "java_script_enabled": true, + "ip_address": "128.0.0.1" + }, + "customer_acceptance": { + "acceptance_type": "offline", + "accepted_at": "1963-05-03T04:07:52.723Z", + "online": { + "ip_address": "125.0.0.1", + "user_agent": "amet irure esse" + } + }, + "payment_type": "normal", + "request_incremental_authorization": false, + "merchant_order_reference_id": "test_ord", + "session_expiry": 900 +} + +``` + +
+ +
+ Response + +``` + +{ + "payment_id": "pay_XjFcIk2szvriZS6pZrJI", + "merchant_id": "merchant_1752988771", + "status": "processing", + "amount": 100, + "net_amount": 100, + "shipping_cost": null, + "amount_capturable": 0, + "amount_received": 100, + "connector": "dwolla", + "client_secret": "pay_XjFcIk2szvriZS6pZrJI_secret_uwziPWt9SvlZsamn8Uzz", + "created": "2025-07-20T09:15:07.176Z", + "currency": "USD", + "customer_id": "johndoe", + "customer": { + "id": "johndoe", + "name": "John Doe", + "email": "johndoe@example.com", + "phone": "9999999999", + "phone_country_code": "+1" + }, + "description": "Its my first payment request", + "refunds": null, + "disputes": null, + "mandate_id": null, + "mandate_data": null, + "setup_future_usage": null, + "off_session": null, + "capture_on": null, + "capture_method": "automatic", + "payment_method": "bank_debit", + "payment_method_data": { + "bank_debit": { + "ach": { + "account_number": "******1289", + "routing_number": "222***226", + "card_holder_name": null, + "bank_account_holder_name": "Test Checking Account2", + "bank_name": null, + "bank_type": "checking", + "bank_holder_type": null + } + }, + "billing": null + }, + "payment_token": null, + "shipping": null, + "billing": { + "address": { + "city": "San Fransico", + "country": "US", + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "zip": "94122", + "state": "California", + "first_name": "john", + "last_name": "Doe" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + }, + "email": "johndoe@example.com" + }, + "order_details": null, + "email": "johndoe@example.com", + "name": "John Doe", + "phone": "9999999999", + "return_url": "https://google.com/", + "authentication_type": "no_three_ds", + "statement_descriptor_name": "john", + "statement_descriptor_suffix": "JS", + "next_action": null, + "cancellation_reason": null, + "error_code": null, + "error_message": null, + "unified_code": null, + "unified_message": null, + "payment_experience": null, + "payment_method_type": "ach", + "connector_label": null, + "business_country": null, + "business_label": "default", + "business_sub_label": null, + "allowed_payment_method_types": null, + "ephemeral_key": { + "customer_id": "johndoe", + "created_at": 1753002907, + "expires": 1753006507, + "secret": "epk_8f8858f7fa59443492d6b9c60b02f617" + }, + "manual_retry_allowed": false, + "connector_transaction_id": "7079e507-4a65-f011-acd5-02ab38c54207", + "frm_message": null, + "metadata": null, + "connector_metadata": null, + "feature_metadata": null, + "reference_id": "7079e507-4a65-f011-acd5-02ab38c54207", + "payment_link": null, + "profile_id": "pro_D326wda9tOqvrMVckzSq", + "surcharge_details": null, + "attempt_count": 1, + "merchant_decision": null, + "merchant_connector_id": "mca_VkSGTWb4x9wiBWKDt3PU", + "incremental_authorization_allowed": false, + "authorization_count": null, + "incremental_authorizations": null, + "external_authentication_details": null, + "external_3ds_authentication_attempted": false, + "expires_on": "2025-07-20T09:30:07.176Z", + "fingerprint": null, + "browser_info": { + "language": "nl-NL", + "time_zone": 0, + "ip_address": "128.0.0.1", + "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36", + "color_depth": 24, + "java_enabled": true, + "screen_width": 1536, + "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8", + "screen_height": 723, + "java_script_enabled": true + }, + "payment_method_id": null, + "payment_method_status": null, + "updated": "2025-07-20T09:15:11.005Z", + "split_payments": null, + "frm_metadata": null, + "extended_authorization_applied": null, + "capture_before": null, + "merchant_order_reference_id": "test_ord", + "order_tax_amount": null, + "connector_mandate_id": null, + "card_discovery": null, + "force_3ds_challenge": false, + "force_3ds_challenge_trigger": false, + "issuer_error_code": null, + "issuer_error_message": null, + "is_iframe_redirection_enabled": null, + "whole_connector_response": "" +} + +``` + +
+ +PSync + +
+Response + +``` +{ + "payment_id": "pay_XjFcIk2szvriZS6pZrJI", + "merchant_id": "merchant_1752988771", + "status": "processing", + "amount": 100, + ... +} +``` + +
+ +--- + +
+Webhook + +Screenshot 2025-07-23 at 3 23 23 PM + +
+ +## Checklist + + +- [x] I formatted the code `cargo +nightly fmt --all` +- [x] I addressed lints thrown by `cargo clippy` +- [x] I reviewed the submitted code +- [ ] I added unit tests for my changes where possible +COMMENTS: +- semanticdiff-com[bot]: Review changes with  SemanticDiff +
+Changed Files +
+ +| File | Status | +| :--- | :--- | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/paypal.rs)  [crates/hyperswitch\_connectors/src/connectors/paypal\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/paypal.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/paypal.rs)  60% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/default_implementations.rs)  [crates/hyperswitch\_connectors/src/default\_implementations\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/default_implementations.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/default_implementations.rs)  16% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/dwolla.rs)  [crates/hyperswitch\_connectors/src/connectors/dwolla\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/dwolla.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/dwolla.rs)  7% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/dwolla/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/dwolla/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/dwolla/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/dwolla/transformers.rs)  6% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/router/src/core/payments/tokenization.rs)  [crates/router/src/core/payments/tokenization\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/router/src/core/payments/tokenization.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/router/src/core/payments/tokenization.rs)  1% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#api-reference/v1/openapi_spec_v1.json)  [api\-reference/v1/openapi\_spec\_v1\.json](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#api-reference/v1/openapi_spec_v1.json) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#api-reference/v1/openapi_spec_v1.json)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#api-reference/v2/openapi_spec_v2.json)  [api\-reference/v2/openapi\_spec\_v2\.json](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#api-reference/v2/openapi_spec_v2.json) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#api-reference/v2/openapi_spec_v2.json)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#config/config.example.toml)  [config/config\.example\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#config/config.example.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#config/deployments/integration_test.toml)  [config/deployments/integration\_test\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#config/deployments/integration_test.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#config/deployments/production.toml)  [config/deployments/production\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#config/deployments/production.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#config/deployments/sandbox.toml)  [config/deployments/sandbox\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#config/deployments/sandbox.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#config/development.toml)  [config/development\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#config/development.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#config/docker_compose.toml)  [config/docker\_compose\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#config/docker_compose.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/api_models/src/enums.rs)  [crates/api\_models/src/enums\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/api_models/src/enums.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/api_models/src/enums.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/common_enums/src/connector_enums.rs)  [crates/common\_enums/src/connector\_enums\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/common_enums/src/connector_enums.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/common_enums/src/connector_enums.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/connector_configs/src/connector.rs)  [crates/connector\_configs/src/connector\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/connector_configs/src/connector.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/connector_configs/src/connector.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/connector_configs/toml/development.toml)  [crates/connector\_configs/toml/development\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/connector_configs/toml/development.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/connector_configs/toml/production.toml)  [crates/connector\_configs/toml/production\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/connector_configs/toml/production.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/connector_configs/toml/sandbox.toml)  [crates/connector\_configs/toml/sandbox\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/connector_configs/toml/sandbox.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/aci.rs)  [crates/hyperswitch\_connectors/src/connectors/aci\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/aci.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/aci.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/adyen.rs)  [crates/hyperswitch\_connectors/src/connectors/adyen\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/adyen.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/adyen.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/adyen/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/adyenplatform.rs)  [crates/hyperswitch\_connectors/src/connectors/adyenplatform\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/adyenplatform.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/adyenplatform.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/affirm.rs)  [crates/hyperswitch\_connectors/src/connectors/affirm\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/affirm.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/affirm.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/airwallex.rs)  [crates/hyperswitch\_connectors/src/connectors/airwallex\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/airwallex.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/airwallex.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/amazonpay.rs)  [crates/hyperswitch\_connectors/src/connectors/amazonpay\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/amazonpay.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/amazonpay.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/archipel.rs)  [crates/hyperswitch\_connectors/src/connectors/archipel\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/archipel.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/archipel.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/archipel/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/archipel/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/archipel/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/archipel/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/authipay/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/authipay/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/authipay/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/authipay/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/authorizedotnet.rs)  [crates/hyperswitch\_connectors/src/connectors/authorizedotnet\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/authorizedotnet.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/authorizedotnet.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/authorizedotnet/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/bambora.rs)  [crates/hyperswitch\_connectors/src/connectors/bambora\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/bambora.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/bambora.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/bamboraapac.rs)  [crates/hyperswitch\_connectors/src/connectors/bamboraapac\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/bamboraapac.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/bamboraapac.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/bamboraapac/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/bamboraapac/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/bamboraapac/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/bamboraapac/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/bankofamerica.rs)  [crates/hyperswitch\_connectors/src/connectors/bankofamerica\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/bankofamerica.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/bankofamerica.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/bankofamerica/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/barclaycard.rs)  [crates/hyperswitch\_connectors/src/connectors/barclaycard\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/barclaycard.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/barclaycard.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/barclaycard/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/barclaycard/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/barclaycard/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/barclaycard/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/billwerk.rs)  [crates/hyperswitch\_connectors/src/connectors/billwerk\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/billwerk.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/billwerk.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/billwerk/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/billwerk/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/billwerk/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/billwerk/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/bitpay.rs)  [crates/hyperswitch\_connectors/src/connectors/bitpay\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/bitpay.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/bitpay.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/blackhawknetwork.rs)  [crates/hyperswitch\_connectors/src/connectors/blackhawknetwork\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/blackhawknetwork.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/blackhawknetwork.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/bluecode.rs)  [crates/hyperswitch\_connectors/src/connectors/bluecode\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/bluecode.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/bluecode.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/bluesnap.rs)  [crates/hyperswitch\_connectors/src/connectors/bluesnap\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/bluesnap.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/bluesnap.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/boku.rs)  [crates/hyperswitch\_connectors/src/connectors/boku\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/boku.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/boku.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/braintree.rs)  [crates/hyperswitch\_connectors/src/connectors/braintree\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/braintree.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/braintree.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/braintree/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/braintree/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/braintree/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/braintree/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/breadpay.rs)  [crates/hyperswitch\_connectors/src/connectors/breadpay\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/breadpay.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/breadpay.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/cashtocode.rs)  [crates/hyperswitch\_connectors/src/connectors/cashtocode\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/cashtocode.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/cashtocode.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/cashtocode/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/cashtocode/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/cashtocode/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/cashtocode/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/celero.rs)  [crates/hyperswitch\_connectors/src/connectors/celero\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/celero.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/celero.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/chargebee.rs)  [crates/hyperswitch\_connectors/src/connectors/chargebee\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/chargebee.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/chargebee.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/checkbook.rs)  [crates/hyperswitch\_connectors/src/connectors/checkbook\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/checkbook.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/checkbook.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/checkout.rs)  [crates/hyperswitch\_connectors/src/connectors/checkout\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/checkout.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/checkout.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/checkout/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/checkout/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/checkout/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/checkout/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/coinbase.rs)  [crates/hyperswitch\_connectors/src/connectors/coinbase\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/coinbase.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/coinbase.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/coingate.rs)  [crates/hyperswitch\_connectors/src/connectors/coingate\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/coingate.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/coingate.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/cryptopay.rs)  [crates/hyperswitch\_connectors/src/connectors/cryptopay\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/cryptopay.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/cryptopay.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/cryptopay/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/cryptopay/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/cryptopay/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/cryptopay/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/custombilling.rs)  [crates/hyperswitch\_connectors/src/connectors/custombilling\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/custombilling.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/custombilling.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/cybersource.rs)  [crates/hyperswitch\_connectors/src/connectors/cybersource\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/cybersource.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/cybersource.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/cybersource/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/datatrans.rs)  [crates/hyperswitch\_connectors/src/connectors/datatrans\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/datatrans.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/datatrans.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/datatrans/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/datatrans/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/datatrans/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/datatrans/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/deutschebank.rs)  [crates/hyperswitch\_connectors/src/connectors/deutschebank\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/deutschebank.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/deutschebank.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/deutschebank/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/deutschebank/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/deutschebank/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/deutschebank/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/digitalvirgo.rs)  [crates/hyperswitch\_connectors/src/connectors/digitalvirgo\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/digitalvirgo.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/digitalvirgo.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/dlocal.rs)  [crates/hyperswitch\_connectors/src/connectors/dlocal\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/dlocal.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/dlocal.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/dummyconnector.rs)  [crates/hyperswitch\_connectors/src/connectors/dummyconnector\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/dummyconnector.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/dummyconnector.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/ebanx.rs)  [crates/hyperswitch\_connectors/src/connectors/ebanx\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/ebanx.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/ebanx.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/elavon/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/elavon/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/elavon/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/elavon/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/facilitapay/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/facilitapay/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/facilitapay/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/facilitapay/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/fiserv.rs)  [crates/hyperswitch\_connectors/src/connectors/fiserv\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/fiserv.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/fiserv.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/fiservemea.rs)  [crates/hyperswitch\_connectors/src/connectors/fiservemea\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/fiservemea.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/fiservemea.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/fiuu.rs)  [crates/hyperswitch\_connectors/src/connectors/fiuu\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/fiuu.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/fiuu.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/fiuu/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/flexiti.rs)  [crates/hyperswitch\_connectors/src/connectors/flexiti\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/flexiti.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/flexiti.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/forte.rs)  [crates/hyperswitch\_connectors/src/connectors/forte\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/forte.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/forte.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/getnet.rs)  [crates/hyperswitch\_connectors/src/connectors/getnet\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/getnet.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/getnet.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/globalpay.rs)  [crates/hyperswitch\_connectors/src/connectors/globalpay\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/globalpay.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/globalpay.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/globalpay/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/globalpay/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/globalpay/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/globalpay/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/globepay.rs)  [crates/hyperswitch\_connectors/src/connectors/globepay\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/globepay.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/globepay.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/globepay/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/globepay/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/globepay/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/globepay/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/gocardless.rs)  [crates/hyperswitch\_connectors/src/connectors/gocardless\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/gocardless.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/gocardless.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/gpayments.rs)  [crates/hyperswitch\_connectors/src/connectors/gpayments\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/gpayments.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/gpayments.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/helcim.rs)  [crates/hyperswitch\_connectors/src/connectors/helcim\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/helcim.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/helcim.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/hipay.rs)  [crates/hyperswitch\_connectors/src/connectors/hipay\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/hipay.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/hipay.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/hipay/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/hipay/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/hipay/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/hipay/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/hyperswitch_vault.rs)  [crates/hyperswitch\_connectors/src/connectors/hyperswitch\_vault\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/hyperswitch_vault.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/hyperswitch_vault.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/hyperwallet.rs)  [crates/hyperswitch\_connectors/src/connectors/hyperwallet\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/hyperwallet.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/hyperwallet.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/iatapay.rs)  [crates/hyperswitch\_connectors/src/connectors/iatapay\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/iatapay.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/iatapay.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/iatapay/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/iatapay/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/iatapay/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/iatapay/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/inespay.rs)  [crates/hyperswitch\_connectors/src/connectors/inespay\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/inespay.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/inespay.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/inespay/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/inespay/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/inespay/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/inespay/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/itaubank.rs)  [crates/hyperswitch\_connectors/src/connectors/itaubank\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/itaubank.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/itaubank.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/jpmorgan.rs)  [crates/hyperswitch\_connectors/src/connectors/jpmorgan\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/jpmorgan.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/jpmorgan.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/juspaythreedsserver.rs)  [crates/hyperswitch\_connectors/src/connectors/juspaythreedsserver\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/juspaythreedsserver.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/juspaythreedsserver.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/katapult.rs)  [crates/hyperswitch\_connectors/src/connectors/katapult\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/katapult.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/katapult.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/klarna.rs)  [crates/hyperswitch\_connectors/src/connectors/klarna\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/klarna.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/klarna.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/mifinity.rs)  [crates/hyperswitch\_connectors/src/connectors/mifinity\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/mifinity.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/mifinity.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/mollie.rs)  [crates/hyperswitch\_connectors/src/connectors/mollie\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/mollie.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/mollie.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/moneris.rs)  [crates/hyperswitch\_connectors/src/connectors/moneris\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/moneris.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/moneris.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/mpgs.rs)  [crates/hyperswitch\_connectors/src/connectors/mpgs\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/mpgs.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/mpgs.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/multisafepay/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/multisafepay/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/multisafepay/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/multisafepay/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/netcetera.rs)  [crates/hyperswitch\_connectors/src/connectors/netcetera\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/netcetera.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/netcetera.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/netcetera/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/netcetera/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/netcetera/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/netcetera/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/nexinets.rs)  [crates/hyperswitch\_connectors/src/connectors/nexinets\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/nexinets.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/nexinets.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/nexixpay.rs)  [crates/hyperswitch\_connectors/src/connectors/nexixpay\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/nexixpay.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/nexixpay.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/nexixpay/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/nmi.rs)  [crates/hyperswitch\_connectors/src/connectors/nmi\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/nmi.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/nmi.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/nmi/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/nmi/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/nmi/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/nmi/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/nomupay.rs)  [crates/hyperswitch\_connectors/src/connectors/nomupay\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/nomupay.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/nomupay.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/noon.rs)  [crates/hyperswitch\_connectors/src/connectors/noon\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/noon.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/noon.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/noon/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/noon/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/noon/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/noon/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/nordea.rs)  [crates/hyperswitch\_connectors/src/connectors/nordea\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/nordea.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/nordea.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/nordea/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/nordea/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/nordea/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/nordea/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/novalnet.rs)  [crates/hyperswitch\_connectors/src/connectors/novalnet\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/novalnet.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/novalnet.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/novalnet/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/nuvei/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/opayo.rs)  [crates/hyperswitch\_connectors/src/connectors/opayo\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/opayo.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/opayo.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/opennode.rs)  [crates/hyperswitch\_connectors/src/connectors/opennode\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/opennode.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/opennode.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/paybox.rs)  [crates/hyperswitch\_connectors/src/connectors/paybox\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/paybox.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/paybox.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/paybox/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/paybox/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/paybox/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/paybox/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/payeezy.rs)  [crates/hyperswitch\_connectors/src/connectors/payeezy\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/payeezy.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/payeezy.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/payload.rs)  [crates/hyperswitch\_connectors/src/connectors/payload\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/payload.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/payload.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/payload/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/payload/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/payload/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/payload/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/payme.rs)  [crates/hyperswitch\_connectors/src/connectors/payme\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/payme.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/payme.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/payme/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/payme/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/payme/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/payme/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/payone.rs)  [crates/hyperswitch\_connectors/src/connectors/payone\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/payone.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/payone.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/paystack.rs)  [crates/hyperswitch\_connectors/src/connectors/paystack\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/paystack.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/paystack.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/paystack/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/paystack/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/paystack/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/paystack/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/paytm.rs)  [crates/hyperswitch\_connectors/src/connectors/paytm\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/paytm.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/paytm.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/payu.rs)  [crates/hyperswitch\_connectors/src/connectors/payu\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/payu.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/payu.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/phonepe.rs)  [crates/hyperswitch\_connectors/src/connectors/phonepe\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/phonepe.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/phonepe.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/placetopay.rs)  [crates/hyperswitch\_connectors/src/connectors/placetopay\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/placetopay.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/placetopay.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/plaid.rs)  [crates/hyperswitch\_connectors/src/connectors/plaid\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/plaid.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/plaid.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/plaid/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/plaid/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/plaid/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/plaid/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/powertranz.rs)  [crates/hyperswitch\_connectors/src/connectors/powertranz\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/powertranz.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/powertranz.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/powertranz/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/powertranz/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/powertranz/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/powertranz/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/prophetpay.rs)  [crates/hyperswitch\_connectors/src/connectors/prophetpay\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/prophetpay.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/prophetpay.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/prophetpay/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/prophetpay/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/prophetpay/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/prophetpay/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/rapyd.rs)  [crates/hyperswitch\_connectors/src/connectors/rapyd\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/rapyd.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/rapyd.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/rapyd/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/rapyd/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/rapyd/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/rapyd/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/razorpay.rs)  [crates/hyperswitch\_connectors/src/connectors/razorpay\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/razorpay.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/razorpay.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/recurly.rs)  [crates/hyperswitch\_connectors/src/connectors/recurly\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/recurly.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/recurly.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/redsys.rs)  [crates/hyperswitch\_connectors/src/connectors/redsys\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/redsys.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/redsys.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/redsys/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/redsys/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/redsys/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/redsys/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/riskified.rs)  [crates/hyperswitch\_connectors/src/connectors/riskified\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/riskified.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/riskified.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/santander.rs)  [crates/hyperswitch\_connectors/src/connectors/santander\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/santander.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/santander.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/shift4.rs)  [crates/hyperswitch\_connectors/src/connectors/shift4\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/shift4.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/shift4.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/sift.rs)  [crates/hyperswitch\_connectors/src/connectors/sift\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/sift.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/sift.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/signifyd.rs)  [crates/hyperswitch\_connectors/src/connectors/signifyd\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/signifyd.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/signifyd.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/silverflow.rs)  [crates/hyperswitch\_connectors/src/connectors/silverflow\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/silverflow.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/silverflow.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/square.rs)  [crates/hyperswitch\_connectors/src/connectors/square\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/square.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/square.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/stax.rs)  [crates/hyperswitch\_connectors/src/connectors/stax\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/stax.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/stax.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/stripe.rs)  [crates/hyperswitch\_connectors/src/connectors/stripe\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/stripe.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/stripe.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/stripe/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/stripe/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/stripe/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/stripe/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/stripebilling.rs)  [crates/hyperswitch\_connectors/src/connectors/stripebilling\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/stripebilling.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/stripebilling.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/taxjar.rs)  [crates/hyperswitch\_connectors/src/connectors/taxjar\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/taxjar.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/taxjar.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/threedsecureio.rs)  [crates/hyperswitch\_connectors/src/connectors/threedsecureio\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/threedsecureio.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/threedsecureio.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/threedsecureio/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/threedsecureio/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/threedsecureio/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/threedsecureio/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/thunes.rs)  [crates/hyperswitch\_connectors/src/connectors/thunes\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/thunes.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/thunes.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/tokenio.rs)  [crates/hyperswitch\_connectors/src/connectors/tokenio\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/tokenio.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/tokenio.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/tokenio/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/tokenio/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/tokenio/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/tokenio/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/trustpay.rs)  [crates/hyperswitch\_connectors/src/connectors/trustpay\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/trustpay.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/trustpay.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/trustpay/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/trustpay/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/trustpay/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/trustpay/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/trustpayments.rs)  [crates/hyperswitch\_connectors/src/connectors/trustpayments\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/trustpayments.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/trustpayments.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/tsys/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/tsys/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/tsys/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/tsys/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/unified_authentication_service.rs)  [crates/hyperswitch\_connectors/src/connectors/unified\_authentication\_service\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/unified_authentication_service.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/unified_authentication_service.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/unified_authentication_service/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/unified\_authentication\_service/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/unified_authentication_service/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/unified_authentication_service/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/vgs.rs)  [crates/hyperswitch\_connectors/src/connectors/vgs\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/vgs.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/vgs.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/volt.rs)  [crates/hyperswitch\_connectors/src/connectors/volt\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/volt.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/volt.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/volt/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/volt/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/volt/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/volt/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/wellsfargo.rs)  [crates/hyperswitch\_connectors/src/connectors/wellsfargo\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/wellsfargo.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/wellsfargo.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/wellsfargo/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/wellsfargo/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/wellsfargo/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/wellsfargo/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/wellsfargopayout.rs)  [crates/hyperswitch\_connectors/src/connectors/wellsfargopayout\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/wellsfargopayout.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/wellsfargopayout.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/wise.rs)  [crates/hyperswitch\_connectors/src/connectors/wise\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/wise.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/wise.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/worldpay.rs)  [crates/hyperswitch\_connectors/src/connectors/worldpay\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/worldpay.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/worldpay.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/worldpay/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/worldpay/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/worldpay/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/worldpay/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/worldpayvantiv.rs)  [crates/hyperswitch\_connectors/src/connectors/worldpayvantiv\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/worldpayvantiv.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/worldpayvantiv.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/worldpayvantiv/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/worldpayvantiv/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/worldpayvantiv/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/worldpayvantiv/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/worldpayxml.rs)  [crates/hyperswitch\_connectors/src/connectors/worldpayxml\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/worldpayxml.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/worldpayxml.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/worldpayxml/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/worldpayxml/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/worldpayxml/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/worldpayxml/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/xendit.rs)  [crates/hyperswitch\_connectors/src/connectors/xendit\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/xendit.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/xendit.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/xendit/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/xendit/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/xendit/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/xendit/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/zen.rs)  [crates/hyperswitch\_connectors/src/connectors/zen\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/zen.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/zen.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/zen/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/zen/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/zen/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/zen/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/zsl.rs)  [crates/hyperswitch\_connectors/src/connectors/zsl\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/zsl.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/zsl.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/zsl/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/zsl/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/zsl/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/connectors/zsl/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/utils.rs)  [crates/hyperswitch\_connectors/src/utils\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/utils.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_connectors/src/utils.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_domain_models/src/errors/api_error_response.rs)  [crates/hyperswitch\_domain\_models/src/errors/api\_error\_response\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_domain_models/src/errors/api_error_response.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_domain_models/src/errors/api_error_response.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_domain_models/src/router_data.rs)  [crates/hyperswitch\_domain\_models/src/router\_data\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_domain_models/src/router_data.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_domain_models/src/router_data.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_interfaces/src/api.rs)  [crates/hyperswitch\_interfaces/src/api\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_interfaces/src/api.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_interfaces/src/api.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_interfaces/src/connector_integration_v2.rs)  [crates/hyperswitch\_interfaces/src/connector\_integration\_v2\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_interfaces/src/connector_integration_v2.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/hyperswitch_interfaces/src/connector_integration_v2.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/payment_methods/src/configs/payment_connector_required_fields.rs)  [crates/payment\_methods/src/configs/payment\_connector\_required\_fields\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/payment_methods/src/configs/payment_connector_required_fields.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/payment_methods/src/configs/payment_connector_required_fields.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/router/src/connector/utils.rs)  [crates/router/src/connector/utils\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/router/src/connector/utils.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/router/src/connector/utils.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/router/src/core/connector_validation.rs)  [crates/router/src/core/connector\_validation\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/router/src/core/connector_validation.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/router/src/core/connector_validation.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/router/src/core/payments/access_token.rs)  [crates/router/src/core/payments/access\_token\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/router/src/core/payments/access_token.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/router/src/core/payments/access_token.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/router/src/core/payments/transformers.rs)  [crates/router/src/core/payments/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/router/src/core/payments/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/router/src/core/payments/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/router/src/core/payouts/access_token.rs)  [crates/router/src/core/payouts/access\_token\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/router/src/core/payouts/access_token.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/router/src/core/payouts/access_token.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/router/src/core/unified_connector_service/transformers.rs)  [crates/router/src/core/unified\_connector\_service/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/router/src/core/unified_connector_service/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/router/src/core/unified_connector_service/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/router/src/services/api.rs)  [crates/router/src/services/api\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/router/src/services/api.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/router/src/services/api.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/router/src/types/api/connector_mapping.rs)  [crates/router/src/types/api/connector\_mapping\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/router/src/types/api/connector_mapping.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/router/src/types/api/connector_mapping.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/router/src/types/connector_transformers.rs)  [crates/router/src/types/connector\_transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/router/src/types/connector_transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/router/src/types/connector_transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/router/src/utils.rs)  [crates/router/src/utils\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/router/src/utils.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#crates/router/src/utils.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#loadtest/config/development.toml)  [loadtest/config/development\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8586/changes#loadtest/config/development.toml) | Unsupported file format | + +
+- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/dwolla.rs:484]: Move this to transformers.rs +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/dwolla.rs:497]: You can directly pass `req.request.minor_amount` +The above parsing is not needed. +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/dwolla/transformers.rs:172]: you don't need to specify the error message +it is already handled in get_billing_first_name function. +also the same for get_billing_last_name and get_billing_email +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/dwolla/transformers.rs:288]: We should get destination url as input from merchant from dashboard? +Are we doing that or is merchant going to send destination url in payment request metadata? +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/dwolla/transformers.rs:389]: Why is Processing marked as Authorizing +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/dwolla/transformers.rs:472]: Why do we need this transformation? +- Vani-1107 [crates/hyperswitch_connectors/src/connectors/dwolla/transformers.rs:472]: Since the topic is extracted as a string from the headers of the incoming webhook request, we use this transformation to convert the string into a defined webhook event type. +- Vani-1107 [crates/hyperswitch_connectors/src/connectors/dwolla/transformers.rs:288]: We are getting the merchant's funding ID from the metadata in the MCA call . +- Vani-1107 [crates/hyperswitch_connectors/src/connectors/dwolla/transformers.rs:389]: Fixed +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/dwolla.rs:992]: Please add get_supported_webhook_flows function as well +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/dwolla/transformers.rs:147]: Use camel case here instead of renaming +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/dwolla/transformers.rs:156]: Use camel case for the full struct except _links +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/dwolla/transformers.rs:216]: Use camel case for the full struct except _links +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/dwolla/transformers.rs:312]: dont generate uuid +instead use item.router_data.connector_request_reference_id +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/dwolla/transformers.rs:419]: instead of generating uuid use the hyperswitch refund id +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/dwolla/transformers.rs:515]: This is not needed if you use camelCase +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/dwolla/transformers.rs:518]: This is not needed if you use camelCase +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/dwolla/transformers.rs:569]: Please attach screenshots of source_verfied being true in pr description under test cases +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/dwolla/transformers.rs:411]: ```suggestion + correlation_id: format!("refund_{}", item.router_data.request.refund_id), +``` +- sahkal [crates/router/src/services/api.rs:378]: Can you please explain this part, why are we handling 4xx response as 2xx, also put comments for such unintuitive approaches + +=== COMMIT === +SUBJECT: feat(connector): [DWOLLA] Connector integration (#8586) +BODY: +Co-authored-by: Vani Gupta +Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> + +=== FILES === +Summary: 206 files changed, +1760 -331 +- api-reference/v1/openapi_spec_v1.json (+30 -0) +- api-reference/v2/openapi_spec_v2.json (+30 -0) +- config/config.example.toml (+5 -1) +- config/deployments/integration_test.toml (+5 -1) +- config/deployments/production.toml (+5 -1) +- config/deployments/sandbox.toml (+5 -1) +- config/development.toml (+5 -1) +- config/docker_compose.toml (+5 -1) +- crates/api_models/src/enums.rs (+2 -0) +- crates/common_enums/src/connector_enums.rs (+6 -5) +- crates/connector_configs/src/connector.rs (+1 -0) +- crates/connector_configs/toml/development.toml (+15 -0) +- crates/connector_configs/toml/production.toml (+14 -0) +- crates/connector_configs/toml/sandbox.toml (+15 -0) +- crates/hyperswitch_connectors/src/connectors/aci.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/adyen.rs (+2 -0) +- crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs (+9 -0) +- crates/hyperswitch_connectors/src/connectors/adyenplatform.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/affirm.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/airwallex.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/amazonpay.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/archipel.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/archipel/transformers.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/authipay/transformers.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/authorizedotnet.rs (+4 -0) +- crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers.rs (+6 -0) +- crates/hyperswitch_connectors/src/connectors/bambora.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/bamboraapac.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/bamboraapac/transformers.rs (+4 -0) +- crates/hyperswitch_connectors/src/connectors/bankofamerica.rs (+6 -0) +- crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs (+3 -0) +- crates/hyperswitch_connectors/src/connectors/barclaycard.rs (+5 -0) +- crates/hyperswitch_connectors/src/connectors/barclaycard/transformers.rs (+2 -0) +- crates/hyperswitch_connectors/src/connectors/billwerk.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/billwerk/transformers.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/bitpay.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/blackhawknetwork.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/bluecode.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/bluesnap.rs (+3 -0) +- crates/hyperswitch_connectors/src/connectors/boku.rs (+2 -0) +- crates/hyperswitch_connectors/src/connectors/braintree.rs (+2 -0) +- crates/hyperswitch_connectors/src/connectors/braintree/transformers.rs (+9 -0) +- crates/hyperswitch_connectors/src/connectors/breadpay.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/cashtocode.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/cashtocode/transformers.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/celero.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/chargebee.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/checkbook.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/checkout.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/checkout/transformers.rs (+2 -0) +- crates/hyperswitch_connectors/src/connectors/coinbase.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/coingate.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/cryptopay.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/cryptopay/transformers.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/custombilling.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/cybersource.rs (+10 -0) +- crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs (+3 -0) +- crates/hyperswitch_connectors/src/connectors/datatrans.rs (+2 -0) +- crates/hyperswitch_connectors/src/connectors/datatrans/transformers.rs (+6 -0) +- crates/hyperswitch_connectors/src/connectors/deutschebank.rs (+3 -0) +- crates/hyperswitch_connectors/src/connectors/deutschebank/transformers.rs (+2 -0) +- crates/hyperswitch_connectors/src/connectors/digitalvirgo.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/dlocal.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/dummyconnector.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/dwolla.rs (+591 -155) +- crates/hyperswitch_connectors/src/connectors/dwolla/transformers.rs (+523 -150) +- crates/hyperswitch_connectors/src/connectors/ebanx.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/elavon/transformers.rs (+6 -0) +- crates/hyperswitch_connectors/src/connectors/facilitapay/transformers.rs (+3 -0) +- crates/hyperswitch_connectors/src/connectors/fiserv.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/fiservemea.rs (+2 -0) +- crates/hyperswitch_connectors/src/connectors/fiuu.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs (+10 -0) +- crates/hyperswitch_connectors/src/connectors/flexiti.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/forte.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/getnet.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/globalpay.rs (+2 -0) +- crates/hyperswitch_connectors/src/connectors/globalpay/transformers.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/globepay.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/globepay/transformers.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/gocardless.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/gpayments.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/helcim.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/hipay.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/hipay/transformers.rs (+3 -0) +- crates/hyperswitch_connectors/src/connectors/hyperswitch_vault.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/hyperwallet.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/iatapay.rs (+3 -0) +- crates/hyperswitch_connectors/src/connectors/iatapay/transformers.rs (+3 -0) +- crates/hyperswitch_connectors/src/connectors/inespay.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/inespay/transformers.rs (+4 -0) +- crates/hyperswitch_connectors/src/connectors/itaubank.rs (+2 -0) +- crates/hyperswitch_connectors/src/connectors/jpmorgan.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/juspaythreedsserver.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/katapult.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/klarna.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/mifinity.rs (+2 -0) +- crates/hyperswitch_connectors/src/connectors/mollie.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/moneris.rs (+2 -0) +- crates/hyperswitch_connectors/src/connectors/mpgs.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/multisafepay/transformers.rs (+2 -0) +- crates/hyperswitch_connectors/src/connectors/netcetera.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/netcetera/transformers.rs (+2 -0) +- crates/hyperswitch_connectors/src/connectors/nexinets.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/nexixpay.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/nmi.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/nmi/transformers.rs (+3 -0) +- crates/hyperswitch_connectors/src/connectors/nomupay.rs (+6 -0) +- crates/hyperswitch_connectors/src/connectors/noon.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/noon/transformers.rs (+3 -0) +- crates/hyperswitch_connectors/src/connectors/nordea.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/nordea/transformers.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/novalnet.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/opayo.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/opennode.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/paybox.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/paybox/transformers.rs (+7 -0) +- crates/hyperswitch_connectors/src/connectors/payeezy.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/payload.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/payload/transformers.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/payme.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/payme/transformers.rs (+5 -0) +- crates/hyperswitch_connectors/src/connectors/payone.rs (+2 -0) +- crates/hyperswitch_connectors/src/connectors/paypal.rs (+7 -3) +- crates/hyperswitch_connectors/src/connectors/paystack.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/paystack/transformers.rs (+4 -0) +- crates/hyperswitch_connectors/src/connectors/paytm.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/payu.rs (+2 -0) +- crates/hyperswitch_connectors/src/connectors/phonepe.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/placetopay.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/plaid.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/plaid/transformers.rs (+2 -0) +- crates/hyperswitch_connectors/src/connectors/powertranz.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/powertranz/transformers.rs (+2 -0) +- crates/hyperswitch_connectors/src/connectors/prophetpay.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/prophetpay/transformers.rs (+5 -0) +- crates/hyperswitch_connectors/src/connectors/rapyd.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/rapyd/transformers.rs (+2 -0) +- crates/hyperswitch_connectors/src/connectors/razorpay.rs (+3 -0) +- crates/hyperswitch_connectors/src/connectors/recurly.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/redsys.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/redsys/transformers.rs (+14 -0) +- crates/hyperswitch_connectors/src/connectors/riskified.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/santander.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/shift4.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/sift.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/signifyd.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/silverflow.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/square.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/stax.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/stripe.rs (+14 -0) +- crates/hyperswitch_connectors/src/connectors/stripe/transformers.rs (+4 -0) +- crates/hyperswitch_connectors/src/connectors/stripebilling.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/taxjar.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/threedsecureio.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/threedsecureio/transformers.rs (+3 -0) +- crates/hyperswitch_connectors/src/connectors/thunes.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/tokenio.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/tokenio/transformers.rs (+2 -0) +- crates/hyperswitch_connectors/src/connectors/trustpay.rs (+2 -0) +- crates/hyperswitch_connectors/src/connectors/trustpay/transformers.rs (+10 -0) +- crates/hyperswitch_connectors/src/connectors/trustpayments.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/tsys/transformers.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/unified_authentication_service.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/unified_authentication_service/transformers.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/vgs.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/volt.rs (+2 -0) +- crates/hyperswitch_connectors/src/connectors/volt/transformers.rs (+2 -0) +- crates/hyperswitch_connectors/src/connectors/wellsfargo.rs (+8 -0) +- crates/hyperswitch_connectors/src/connectors/wellsfargo/transformers.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/wellsfargopayout.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/wise.rs (+4 -0) +- crates/hyperswitch_connectors/src/connectors/worldpay.rs (+2 -0) +- crates/hyperswitch_connectors/src/connectors/worldpay/transformers.rs (+2 -0) +- crates/hyperswitch_connectors/src/connectors/worldpayvantiv.rs (+3 -0) +- crates/hyperswitch_connectors/src/connectors/worldpayvantiv/transformers.rs (+17 -0) +- crates/hyperswitch_connectors/src/connectors/worldpayxml.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/worldpayxml/transformers.rs (+7 -0) +- crates/hyperswitch_connectors/src/connectors/xendit.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/xendit/transformers.rs (+3 -0) +- crates/hyperswitch_connectors/src/connectors/zen.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/zen/transformers.rs (+2 -0) +- crates/hyperswitch_connectors/src/connectors/zsl.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/zsl/transformers.rs (+3 -0) +- crates/hyperswitch_connectors/src/default_implementations.rs (+0 -1) +- crates/hyperswitch_connectors/src/utils.rs (+1 -0) +- crates/hyperswitch_domain_models/src/errors/api_error_response.rs (+1 -0) +- crates/hyperswitch_domain_models/src/router_data.rs (+8 -0) +- crates/hyperswitch_interfaces/src/api.rs (+2 -0) +- crates/hyperswitch_interfaces/src/connector_integration_v2.rs (+1 -0) +- crates/payment_methods/src/configs/payment_connector_required_fields.rs (+50 -0) +- crates/router/src/connector/utils.rs (+1 -0) +- crates/router/src/core/connector_validation.rs (+4 -4) +- crates/router/src/core/payments/access_token.rs (+2 -0) +- crates/router/src/core/payments/tokenization.rs (+23 -1) +- crates/router/src/core/payments/transformers.rs (+1 -0) +- crates/router/src/core/payouts/access_token.rs (+1 -0) +- crates/router/src/core/unified_connector_service/transformers.rs (+4 -0) +- crates/router/src/services/api.rs (+2 -1) +- crates/router/src/types/api/connector_mapping.rs (+3 -3) +- crates/router/src/types/connector_transformers.rs (+1 -1) +- crates/router/src/utils.rs (+1 -0) +- loadtest/config/development.toml (+5 -1) + +=== PATCH === +diff --git a/api-reference/v1/openapi_spec_v1.json b/api-reference/v1/openapi_spec_v1.json +index 27750c56..eaab79a7 100644 +--- a/api-reference/v1/openapi_spec_v1.json ++++ b/api-reference/v1/openapi_spec_v1.json +@@ -11834,6 +11834,7 @@ + "deutschebank", + "digitalvirgo", + "dlocal", ++ "dwolla", + "ebanx", + "elavon", + "facilitapay", +@@ -15431,6 +15432,34 @@ + "user_bank_routing_number" + ] + }, ++ { ++ "type": "object", ++ "required": [ ++ "user_bank_type" ++ ], ++ "properties": { ++ "user_bank_type": { ++ "type": "object", ++ "required": [ ++ "options" ++ ], ++ "properties": { ++ "options": { ++ "type": "array", ++ "items": { ++ "type": "string" ++ } ++ } ++ } ++ } ++ } ++ }, ++ { ++ "type": "string", ++ "enum": [ ++ "user_bank_account_holder_name" ++ ] ++ }, + { + "type": "string", + "enum": [ +@@ -29771,6 +29800,7 @@ + "deutschebank", + "digitalvirgo", + "dlocal", ++ "dwolla", + "ebanx", + "elavon", + "facilitapay", +diff --git a/api-reference/v2/openapi_spec_v2.json b/api-reference/v2/openapi_spec_v2.json +index e9bd39ac..b34623cd 100644 +--- a/api-reference/v2/openapi_spec_v2.json ++++ b/api-reference/v2/openapi_spec_v2.json +@@ -8382,6 +8382,7 @@ + "deutschebank", + "digitalvirgo", + "dlocal", ++ "dwolla", + "ebanx", + "elavon", + "facilitapay", +@@ -11530,6 +11531,34 @@ + "user_bank_routing_number" + ] + }, ++ { ++ "type": "object", ++ "required": [ ++ "user_bank_type" ++ ], ++ "properties": { ++ "user_bank_type": { ++ "type": "object", ++ "required": [ ++ "options" ++ ], ++ "properties": { ++ "options": { ++ "type": "array", ++ "items": { ++ "type": "string" ++ } ++ } ++ } ++ } ++ } ++ }, ++ { ++ "type": "string", ++ "enum": [ ++ "user_bank_account_holder_name" ++ ] ++ }, + { + "type": "string", + "enum": [ +@@ -23342,6 +23371,7 @@ + "deutschebank", + "digitalvirgo", + "dlocal", ++ "dwolla", + "ebanx", + "elavon", + "facilitapay", +diff --git a/config/config.example.toml b/config/config.example.toml +index 91a663d8..af9af674 100644 +--- a/config/config.example.toml ++++ b/config/config.example.toml +@@ -478,6 +478,7 @@ braintree = { long_lived_token = false, payment_method = "card" } + gocardless = { long_lived_token = true, payment_method = "bank_debit" } + billwerk = { long_lived_token = false, payment_method = "card" } + globalpay = { long_lived_token = false, payment_method = "card", flow = "mandates" } ++dwolla = { long_lived_token = true, payment_method = "bank_debit" } + + [debit_routing_config] # Debit Routing configs + supported_currencies = "USD" # Supported currencies for debit routing +@@ -899,8 +900,11 @@ pix = { country = "BR", currency = "BRL" } + [pm_filters.bluecode] + bluecode = { country = "AT,BE,BG,HR,CY,CZ,DK,EE,FI,FR,DE,GR,HU,IE,IT,LV,LT,LU,MT,NL,PL,PT,RO,SK,SI,ES,SE,IS,LI,NO", currency = "EUR" } + ++[pm_filters.dwolla] ++ach = { country = "US", currency = "USD" } ++ + [connector_customer] +-connector_list = "authorizedotnet,facilitapay,gocardless,hyperswitch_vault,stax,stripe" ++connector_list = "authorizedotnet,dwolla,facilitapay,gocardless,hyperswitch_vault,stax,stripe" + payout_connector_list = "nomupay,stripe,wise" + + [bank_config.online_banking_fpx] +diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml +index 40f755b1..40efdcf0 100644 +--- a/config/deployments/integration_test.toml ++++ b/config/deployments/integration_test.toml +@@ -194,7 +194,7 @@ force_cookies = true + enabled = true + + [connector_customer] +-connector_list = "authorizedotnet,facilitapay,gocardless,hyperswitch_vault,stax,stripe" ++connector_list = "authorizedotnet,dwolla,facilitapay,gocardless,hyperswitch_vault,stax,stripe" + payout_connector_list = "nomupay,stripe,wise" + + [delayed_session_response] +@@ -403,6 +403,9 @@ google_pay = {currency = "CHF,DKK,EUR,GBP,NOK,PLN,SEK,USD,AUD,NZD,CAD"} + apple_pay = {currency = "EUR,GBP,ISK,USD,AUD,CAD,BRL,CLP,COP,CRC,CZK,DKK,EGP,GEL,GHS,GTQ,HNL,HKD,HUF,ILS,INR,JPY,KZT,KRW,KWD,MAD,MXN,MYR,NOK,NZD,PEN,PLN,PYG,QAR,RON,SAR,SEK,SGD,THB,TWD,UAH,AED,VND,ZAR"} + paypal = {currency = "AUD,BRL,CAD,CHF,CNY,CZK,DKK,EUR,GBP,HKD,HUF,ILS,JPY,MXN,MYR,NOK,NZD,PHP,PLN,SEK,SGD,THB,TWD,USD"} + ++[pm_filters.dwolla] ++ach = { country = "US", currency = "USD" } ++ + [pm_filters.bambora] + credit = { country = "US,CA", currency = "USD" } + debit = { country = "US,CA", currency = "USD" } +@@ -795,6 +798,7 @@ stax = { long_lived_token = true, payment_method = "card,bank_debit" } + stripe = { long_lived_token = false, payment_method = "wallet", payment_method_type = { list = "google_pay", type = "disable_only" } } + billwerk = {long_lived_token = false, payment_method = "card"} + globalpay = { long_lived_token = false, payment_method = "card", flow = "mandates" } ++dwolla = { long_lived_token = true, payment_method = "bank_debit" } + + [webhooks] + outgoing_enabled = true +diff --git a/config/deployments/production.toml b/config/deployments/production.toml +index 3ea362f8..85b8ebbb 100644 +--- a/config/deployments/production.toml ++++ b/config/deployments/production.toml +@@ -15,7 +15,7 @@ open_banking_uk.adyen.banks = "aib,bank_of_scotland,danske_bank,first_direct,fir + przelewy24.stripe.banks = "alior_bank,bank_millennium,bank_nowy_bfg_sa,bank_pekao_sa,banki_spbdzielcze,blik,bnp_paribas,boz,citi,credit_agricole,e_transfer_pocztowy24,getin_bank,idea_bank,inteligo,mbank_mtransfer,nest_przelew,noble_pay,pbac_z_ipko,plus_bank,santander_przelew24,toyota_bank,volkswagen_bank" + + [connector_customer] +-connector_list = "authorizedotnet,facilitapay,gocardless,hyperswitch_vault,stax,stripe" ++connector_list = "authorizedotnet,dwolla,facilitapay,gocardless,hyperswitch_vault,stax,stripe" + payout_connector_list = "nomupay,stripe,wise" + + # Connector configuration, provided attributes will be used to fulfill API requests. +@@ -414,6 +414,9 @@ google_pay = {currency = "CHF,DKK,EUR,GBP,NOK,PLN,SEK,USD,AUD,NZD,CAD"} + apple_pay = {currency = "EUR,GBP,ISK,USD,AUD,CAD,BRL,CLP,COP,CRC,CZK,DKK,EGP,GEL,GHS,GTQ,HNL,HKD,HUF,ILS,INR,JPY,KZT,KRW,KWD,MAD,MXN,MYR,NOK,NZD,PEN,PLN,PYG,QAR,RON,SAR,SEK,SGD,THB,TWD,UAH,AED,VND,ZAR"} + paypal = {currency = "AUD,BRL,CAD,CHF,CNY,CZK,DKK,EUR,GBP,HKD,HUF,ILS,JPY,MXN,MYR,NOK,NZD,PHP,PLN,SEK,SGD,THB,TWD,USD"} + ++[pm_filters.dwolla] ++ach = { country = "US", currency = "USD" } ++ + [pm_filters.bambora] + credit = { country = "US,CA", currency = "USD" } + debit = { country = "US,CA", currency = "USD" } +@@ -805,6 +808,7 @@ stax = { long_lived_token = true, payment_method = "card,bank_debit" } + stripe = { long_lived_token = false, payment_method = "wallet", payment_method_type = { list = "google_pay", type = "disable_only" } } + billwerk = {long_lived_token = false, payment_method = "card"} + globalpay = { long_lived_token = false, payment_method = "card", flow = "mandates" } ++dwolla = { long_lived_token = true, payment_method = "bank_debit" } + + [webhooks] + outgoing_enabled = true +diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml +index 3044dde9..bad07aa9 100644 +--- a/config/deployments/sandbox.toml ++++ b/config/deployments/sandbox.toml +@@ -15,7 +15,7 @@ open_banking_uk.adyen.banks = "aib,bank_of_scotland,danske_bank,first_direct,fir + przelewy24.stripe.banks = "alior_bank,bank_millennium,bank_nowy_bfg_sa,bank_pekao_sa,banki_spbdzielcze,blik,bnp_paribas,boz,citi,credit_agricole,e_transfer_pocztowy24,getin_bank,idea_bank,inteligo,mbank_mtransfer,nest_przelew,noble_pay,pbac_z_ipko,plus_bank,santander_przelew24,toyota_bank,volkswagen_bank" + + [connector_customer] +-connector_list = "authorizedotnet,facilitapay,gocardless,hyperswitch_vault,stax,stripe" ++connector_list = "authorizedotnet,dwolla,facilitapay,gocardless,hyperswitch_vault,stax,stripe" + payout_connector_list = "nomupay,stripe,wise" + + # Connector configuration, provided attributes will be used to fulfill API requests. +@@ -423,6 +423,9 @@ google_pay = {currency = "CHF,DKK,EUR,GBP,NOK,PLN,SEK,USD,AUD,NZD,CAD"} + apple_pay = {currency = "EUR,GBP,ISK,USD,AUD,CAD,BRL,CLP,COP,CRC,CZK,DKK,EGP,GEL,GHS,GTQ,HNL,HKD,HUF,ILS,INR,JPY,KZT,KRW,KWD,MAD,MXN,MYR,NOK,NZD,PEN,PLN,PYG,QAR,RON,SAR,SEK,SGD,THB,TWD,UAH,AED,VND,ZAR"} + paypal = {currency = "AUD,BRL,CAD,CHF,CNY,CZK,DKK,EUR,GBP,HKD,HUF,ILS,JPY,MXN,MYR,NOK,NZD,PHP,PLN,SEK,SGD,THB,TWD,USD"} + ++[pm_filters.dwolla] ++ach = { country = "US", currency = "USD" } ++ + [pm_filters.bambora] + credit = { country = "US,CA", currency = "USD" } + debit = { country = "US,CA", currency = "USD" } +@@ -812,6 +815,7 @@ stax = { long_lived_token = true, payment_method = "card,bank_debit" } + stripe = { long_lived_token = false, payment_method = "wallet", payment_method_type = { list = "google_pay", type = "disable_only" } } + billwerk = {long_lived_token = false, payment_method = "card"} + globalpay = { long_lived_token = false, payment_method = "card", flow = "mandates" } ++dwolla = { long_lived_token = true, payment_method = "bank_debit" } + + [webhooks] + outgoing_enabled = true +diff --git a/config/development.toml b/config/development.toml +index 02e14497..c1533620 100644 +--- a/config/development.toml ++++ b/config/development.toml +@@ -818,6 +818,9 @@ google_pay = {currency = "CHF,DKK,EUR,GBP,NOK,PLN,SEK,USD,AUD,NZD,CAD"} + apple_pay = {currency = "EUR,GBP,ISK,USD,AUD,CAD,BRL,CLP,COP,CRC,CZK,DKK,EGP,GEL,GHS,GTQ,HNL,HKD,HUF,ILS,INR,JPY,KZT,KRW,KWD,MAD,MXN,MYR,NOK,NZD,PEN,PLN,PYG,QAR,RON,SAR,SEK,SGD,THB,TWD,UAH,AED,VND,ZAR"} + paypal = {currency = "AUD,BRL,CAD,CHF,CNY,CZK,DKK,EUR,GBP,HKD,HUF,ILS,JPY,MXN,MYR,NOK,NZD,PHP,PLN,SEK,SGD,THB,TWD,USD"} + ++[pm_filters.dwolla] ++ach = { country = "US", currency = "USD" } ++ + [pm_filters.worldpay] + debit = { country = "AF,DZ,AW,AU,AZ,BS,BH,BD,BB,BZ,BM,BT,BO,BA,BW,BR,BN,BG,BI,KH,CA,CV,KY,CL,CO,KM,CD,CR,CZ,DK,DJ,ST,DO,EC,EG,SV,ER,ET,FK,FJ,GM,GE,GH,GI,GT,GN,GY,HT,HN,HK,HU,IS,IN,ID,IR,IQ,IE,IL,IT,JM,JP,JO,KZ,KE,KW,LA,LB,LS,LR,LY,LT,MO,MK,MG,MW,MY,MV,MR,MU,MX,MD,MN,MA,MZ,MM,NA,NZ,NI,NG,KP,NO,AR,PK,PG,PY,PE,UY,PH,PL,GB,QA,OM,RO,RU,RW,WS,SG,ST,ZA,KR,LK,SH,SD,SR,SZ,SE,CH,SY,TW,TJ,TZ,TH,TT,TN,TR,UG,UA,US,UZ,VU,VE,VN,ZM,ZW", currency = "AFN,DZD,ANG,AWG,AUD,AZN,BSD,BHD,BDT,BBD,BZD,BMD,BTN,BOB,BAM,BWP,BRL,BND,BGN,BIF,KHR,CAD,CVE,KYD,XOF,XAF,XPF,CLP,COP,KMF,CDF,CRC,EUR,CZK,DKK,DJF,DOP,XCD,EGP,SVC,ERN,ETB,EUR,FKP,FJD,GMD,GEL,GHS,GIP,GTQ,GNF,GYD,HTG,HNL,HKD,HUF,ISK,INR,IDR,IRR,IQD,ILS,JMD,JPY,JOD,KZT,KES,KWD,LAK,LBP,LSL,LRD,LYD,MOP,MKD,MGA,MWK,MYR,MVR,MRU,MUR,MXN,MDL,MNT,MAD,MZN,MMK,NAD,NPR,NZD,NIO,NGN,KPW,NOK,ARS,PKR,PAB,PGK,PYG,PEN,UYU,PHP,PLN,GBP,QAR,OMR,RON,RUB,RWF,WST,SAR,RSD,SCR,SLL,SGD,STN,SBD,SOS,ZAR,KRW,LKR,SHP,SDG,SRD,SZL,SEK,CHF,SYP,TWD,TJS,TZS,THB,TOP,TTD,TND,TRY,TMT,AED,UGX,UAH,USD,UZS,VUV,VND,YER,CNY,ZMW,ZWL" } + credit = { country = "AF,DZ,AW,AU,AZ,BS,BH,BD,BB,BZ,BM,BT,BO,BA,BW,BR,BN,BG,BI,KH,CA,CV,KY,CL,CO,KM,CD,CR,CZ,DK,DJ,ST,DO,EC,EG,SV,ER,ET,FK,FJ,GM,GE,GH,GI,GT,GN,GY,HT,HN,HK,HU,IS,IN,ID,IR,IQ,IE,IL,IT,JM,JP,JO,KZ,KE,KW,LA,LB,LS,LR,LY,LT,MO,MK,MG,MW,MY,MV,MR,MU,MX,MD,MN,MA,MZ,MM,NA,NZ,NI,NG,KP,NO,AR,PK,PG,PY,PE,UY,PH,PL,GB,QA,OM,RO,RU,RW,WS,SG,ST,ZA,KR,LK,SH,SD,SR,SZ,SE,CH,SY,TW,TJ,TZ,TH,TT,TN,TR,UG,UA,US,UZ,VU,VE,VN,ZM,ZW", currency = "AFN,DZD,ANG,AWG,AUD,AZN,BSD,BHD,BDT,BBD,BZD,BMD,BTN,BOB,BAM,BWP,BRL,BND,BGN,BIF,KHR,CAD,CVE,KYD,XOF,XAF,XPF,CLP,COP,KMF,CDF,CRC,EUR,CZK,DKK,DJF,DOP,XCD,EGP,SVC,ERN,ETB,EUR,FKP,FJD,GMD,GEL,GHS,GIP,GTQ,GNF,GYD,HTG,HNL,HKD,HUF,ISK,INR,IDR,IRR,IQD,ILS,JMD,JPY,JOD,KZT,KES,KWD,LAK,LBP,LSL,LRD,LYD,MOP,MKD,MGA,MWK,MYR,MVR,MRU,MUR,MXN,MDL,MNT,MAD,MZN,MMK,NAD,NPR,NZD,NIO,NGN,KPW,NOK,ARS,PKR,PAB,PGK,PYG,PEN,UYU,PHP,PLN,GBP,QAR,OMR,RON,RUB,RWF,WST,SAR,RSD,SCR,SLL,SGD,STN,SBD,SOS,ZAR,KRW,LKR,SHP,SDG,SRD,SZL,SEK,CHF,SYP,TWD,TJS,TZS,THB,TOP,TTD,TND,TRY,TMT,AED,UGX,UAH,USD,UZS,VUV,VND,YER,CNY,ZMW,ZWL" } +@@ -941,6 +944,7 @@ braintree = { long_lived_token = false, payment_method = "card" } + payme = { long_lived_token = false, payment_method = "card" } + gocardless = { long_lived_token = true, payment_method = "bank_debit" } + billwerk = { long_lived_token = false, payment_method = "card" } ++dwolla = { long_lived_token = true, payment_method = "bank_debit" } + globalpay = { long_lived_token = false, payment_method = "card", flow = "mandates" } + + [temp_locker_enable_config] +@@ -958,7 +962,7 @@ nexixpay = { payment_method = "card" } + redsys = { payment_method = "card" } + + [connector_customer] +-connector_list = "authorizedotnet,facilitapay,gocardless,hyperswitch_vault,stax,stripe" ++connector_list = "authorizedotnet,dwolla,facilitapay,gocardless,hyperswitch_vault,stax,stripe" + payout_connector_list = "nomupay,stripe,wise" + + [dummy_connector] +diff --git a/config/docker_compose.toml b/config/docker_compose.toml +index 9b619f3d..cf0057d5 100644 +--- a/config/docker_compose.toml ++++ b/config/docker_compose.toml +@@ -401,6 +401,7 @@ braintree = { long_lived_token = false, payment_method = "card" } + gocardless = { long_lived_token = true, payment_method = "bank_debit" } + billwerk = { long_lived_token = false, payment_method = "card" } + globalpay = { long_lived_token = false, payment_method = "card", flow = "mandates" } ++dwolla = { long_lived_token = true, payment_method = "bank_debit" } + + [temp_locker_enable_config] + stripe = { payment_method = "bank_transfer" } +@@ -863,6 +864,9 @@ google_pay = {currency = "CHF,DKK,EUR,GBP,NOK,PLN,SEK,USD,AUD,NZD,CAD"} + apple_pay = {currency = "EUR,GBP,ISK,USD,AUD,CAD,BRL,CLP,COP,CRC,CZK,DKK,EGP,GEL,GHS,GTQ,HNL,HKD,HUF,ILS,INR,JPY,KZT,KRW,KWD,MAD,MXN,MYR,NOK,NZD,PEN,PLN,PYG,QAR,RON,SAR,SEK,SGD,THB,TWD,UAH,AED,VND,ZAR"} + paypal = {currency = "AUD,BRL,CAD,CHF,CNY,CZK,DKK,EUR,GBP,HKD,HUF,ILS,JPY,MXN,MYR,NOK,NZD,PHP,PLN,SEK,SGD,THB,TWD,USD"} + ++[pm_filters.dwolla] ++ach = { country = "US", currency = "USD" } ++ + [pm_filters.braintree] + credit = { country = "AD,AT,AU,BE,BG,CA,CH,CY,CZ,DE,DK,EE,ES,FI,FR,GB,GG,GI,GR,HK,HR,HU,IE,IM,IT,JE,LI,LT,LU,LV,MT,MC,MY,NL,NO,NZ,PL,PT,RO,SE,SG,SI,SK,SM,US", currency = "AED,AMD,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BIF,BMD,BND,BOB,BRL,BSD,BWP,BYN,BZD,CAD,CHF,CLP,CNY,COP,CRC,CVE,CZK,DJF,DKK,DOP,DZD,EGP,ETB,EUR,FJD,FKP,GBP,GEL,GHS,GIP,GMD,GNF,GTQ,GYD,HKD,HNL,HRK,HTG,HUF,IDR,ILS,INR,ISK,JMD,JPY,KES,KGS,KHR,KMF,KRW,KYD,KZT,LAK,LBP,LKR,LRD,LSL,MAD,MDL,MKD,MNT,MOP,MUR,MVR,MWK,MXN,MYR,MZN,NAD,NGN,NIO,NOK,NPR,NZD,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SEK,SGD,SHP,SLL,SOS,SRD,STD,SVC,SYP,SZL,THB,TJS,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW,ZWL"} + debit = { country = "AD,AT,AU,BE,BG,CA,CH,CY,CZ,DE,DK,EE,ES,FI,FR,GB,GG,GI,GR,HK,HR,HU,IE,IM,IT,JE,LI,LT,LU,LV,MT,MC,MY,NL,NO,NZ,PL,PT,RO,SE,SG,SI,SK,SM,US", currency = "AED,AMD,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BIF,BMD,BND,BOB,BRL,BSD,BWP,BYN,BZD,CAD,CHF,CLP,CNY,COP,CRC,CVE,CZK,DJF,DKK,DOP,DZD,EGP,ETB,EUR,FJD,FKP,GBP,GEL,GHS,GIP,GMD,GNF,GTQ,GYD,HKD,HNL,HRK,HTG,HUF,IDR,ILS,INR,ISK,JMD,JPY,KES,KGS,KHR,KMF,KRW,KYD,KZT,LAK,LBP,LKR,LRD,LSL,MAD,MDL,MKD,MNT,MOP,MUR,MVR,MWK,MXN,MYR,MZN,NAD,NGN,NIO,NOK,NPR,NZD,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SEK,SGD,SHP,SLL,SOS,SRD,STD,SVC,SYP,SZL,THB,TJS,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW,ZWL"} +@@ -959,7 +963,7 @@ card.debit = { connector_list = "cybersource" } + connector_list = "adyen,archipel,cybersource,novalnet,stripe,worldpay,worldpayvantiv" + + [connector_customer] +-connector_list = "authorizedotnet,facilitapay,gocardless,hyperswitch_vault,stax,stripe" ++connector_list = "authorizedotnet,dwolla,facilitapay,gocardless,hyperswitch_vault,stax,stripe" + payout_connector_list = "nomupay,stripe,wise" + + +diff --git a/crates/api_models/src/enums.rs b/crates/api_models/src/enums.rs +index ac0cd707..c8664b4e 100644 +--- a/crates/api_models/src/enums.rs ++++ b/crates/api_models/src/enums.rs +@@ -274,6 +274,8 @@ pub enum FieldType { + UserBsbNumber, + UserBankSortCode, + UserBankRoutingNumber, ++ UserBankType { options: Vec }, ++ UserBankAccountHolderName, + UserMsisdn, + UserClientIdentifier, + OrderDetailsProductName, +diff --git a/crates/common_enums/src/connector_enums.rs b/crates/common_enums/src/connector_enums.rs +index d7501896..cb0e4462 100644 +--- a/crates/common_enums/src/connector_enums.rs ++++ b/crates/common_enums/src/connector_enums.rs +@@ -90,7 +90,7 @@ pub enum RoutableConnectors { + Deutschebank, + Digitalvirgo, + Dlocal, +- // Dwolla, ++ Dwolla, + Ebanx, + Elavon, + Facilitapay, +@@ -259,7 +259,7 @@ pub enum Connector { + Deutschebank, + Digitalvirgo, + Dlocal, +- // Dwolla, ++ Dwolla, + Ebanx, + Elavon, + Facilitapay, +@@ -397,6 +397,7 @@ impl Connector { + | (Self::Volt, _) + | (Self::Itaubank, _) + | (Self::Facilitapay, _) ++ | (Self::Dwolla, _) + ) + } + pub fn requires_order_creation_before_payment(self, payment_method: PaymentMethod) -> bool { +@@ -450,7 +451,7 @@ impl Connector { + | Self::Deutschebank + | Self::Digitalvirgo + | Self::Dlocal +- // | Self::Dwolla ++ | Self::Dwolla + | Self::Ebanx + | Self::Elavon + | Self::Facilitapay +@@ -624,7 +625,7 @@ impl From for Connector { + RoutableConnectors::Deutschebank => Self::Deutschebank, + RoutableConnectors::Digitalvirgo => Self::Digitalvirgo, + RoutableConnectors::Dlocal => Self::Dlocal, +- // RoutableConnectors::Dwolla => Self::Dwolla, ++ RoutableConnectors::Dwolla => Self::Dwolla, + RoutableConnectors::Ebanx => Self::Ebanx, + RoutableConnectors::Elavon => Self::Elavon, + RoutableConnectors::Facilitapay => Self::Facilitapay, +@@ -755,7 +756,7 @@ impl TryFrom for RoutableConnectors { + Connector::Deutschebank => Ok(Self::Deutschebank), + Connector::Digitalvirgo => Ok(Self::Digitalvirgo), + Connector::Dlocal => Ok(Self::Dlocal), +- // Connector::Dwolla => Ok(Self::Dwolla), ++ Connector::Dwolla => Ok(Self::Dwolla), + Connector::Ebanx => Ok(Self::Ebanx), + Connector::Elavon => Ok(Self::Elavon), + Connector::Facilitapay => Ok(Self::Facilitapay), +diff --git a/crates/connector_configs/src/connector.rs b/crates/connector_configs/src/connector.rs +index 6605e781..63fb9640 100644 +--- a/crates/connector_configs/src/connector.rs ++++ b/crates/connector_configs/src/connector.rs +@@ -433,6 +433,7 @@ impl ConnectorConfig { + Connector::Deutschebank => Ok(connector_data.deutschebank), + Connector::Digitalvirgo => Ok(connector_data.digitalvirgo), + Connector::Dlocal => Ok(connector_data.dlocal), ++ Connector::Dwolla => Ok(connector_data.dwolla), + Connector::Ebanx => Ok(connector_data.ebanx_payout), + Connector::Elavon => Ok(connector_data.elavon), + Connector::Facilitapay => Ok(connector_data.facilitapay), +diff --git a/crates/connector_configs/toml/development.toml b/crates/connector_configs/toml/development.toml +index b1867003..d007b4a9 100644 +--- a/crates/connector_configs/toml/development.toml ++++ b/crates/connector_configs/toml/development.toml +@@ -2048,6 +2048,21 @@ api_secret="Secret Key" + [dlocal.connector_webhook_details] + merchant_secret="Source verification key" + ++[[dwolla.bank_debit]] ++ payment_method_type = "ach" ++[dwolla.connector_auth.BodyKey] ++api_key="Client ID" ++key1="Client Secret" ++[dwolla.connector_webhook_details] ++merchant_secret="Source verification key" ++ ++[dwolla.metadata.merchant_funding_source] ++name = "merchant_funding_source" ++label = "Funding Source ID" ++placeholder = "Enter your funding source ID" ++required = true ++type = "Text" ++ + [ebanx_payout] + [[ebanx_payout.bank_transfer]] + payment_method_type = "pix" +diff --git a/crates/connector_configs/toml/production.toml b/crates/connector_configs/toml/production.toml +index 82ad0848..aa6dac8d 100644 +--- a/crates/connector_configs/toml/production.toml ++++ b/crates/connector_configs/toml/production.toml +@@ -1684,6 +1684,20 @@ api_secret = "Secret Key" + [dlocal.connector_webhook_details] + merchant_secret = "Source verification key" + ++[[dwolla.bank_debit]] ++ payment_method_type = "ach" ++[dwolla.connector_auth.BodyKey] ++api_key="Client ID" ++key1="Client Secret" ++[dwolla.connector_webhook_details] ++merchant_secret="Source verification key" ++ ++[dwolla.metadata.merchant_funding_source] ++name = "merchant_funding_source" ++label = "Funding Source ID" ++placeholder = "Enter your funding source ID" ++required = true ++type = "Text" + + [fiserv] + [[fiserv.credit]] +diff --git a/crates/connector_configs/toml/sandbox.toml b/crates/connector_configs/toml/sandbox.toml +index ff0dd913..138c28b7 100644 +--- a/crates/connector_configs/toml/sandbox.toml ++++ b/crates/connector_configs/toml/sandbox.toml +@@ -2024,6 +2024,21 @@ api_secret = "Secret Key" + [dlocal.connector_webhook_details] + merchant_secret = "Source verification key" + ++[[dwolla.bank_debit]] ++ payment_method_type = "ach" ++[dwolla.connector_auth.BodyKey] ++api_key="Client ID" ++key1="Client Secret" ++[dwolla.connector_webhook_details] ++merchant_secret="Source verification key" ++ ++[dwolla.metadata.merchant_funding_source] ++name = "merchant_funding_source" ++label = "Funding Source ID" ++placeholder = "Enter your funding source ID" ++required = true ++type = "Text" ++ + [ebanx_payout] + [[ebanx_payout.bank_transfer]] + payment_method_type = "pix" +diff --git a/crates/hyperswitch_connectors/src/connectors/aci.rs b/crates/hyperswitch_connectors/src/connectors/aci.rs +index 16a85965..ebd20edb 100644 +--- a/crates/hyperswitch_connectors/src/connectors/aci.rs ++++ b/crates/hyperswitch_connectors/src/connectors/aci.rs +@@ -132,6 +132,7 @@ impl ConnectorCommon for Aci { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/adyen.rs b/crates/hyperswitch_connectors/src/connectors/adyen.rs +index 302c33f6..256e6578 100644 +--- a/crates/hyperswitch_connectors/src/connectors/adyen.rs ++++ b/crates/hyperswitch_connectors/src/connectors/adyen.rs +@@ -155,6 +155,7 @@ impl ConnectorCommon for Adyen { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +@@ -1036,6 +1037,7 @@ impl ConnectorIntegration for AcceptDisputeRouterData { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }), + ..data.clone() + }) +@@ -5907,6 +5914,7 @@ impl ForeignTryFrom<(&Self, AdyenDisputeResponse)> for SubmitEvidenceRouterData + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }), + ..data.clone() + }) +@@ -5950,6 +5958,7 @@ impl ForeignTryFrom<(&Self, AdyenDisputeResponse)> for DefendDisputeRouterData { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }), + ..data.clone() + }) +diff --git a/crates/hyperswitch_connectors/src/connectors/adyenplatform.rs b/crates/hyperswitch_connectors/src/connectors/adyenplatform.rs +index 9f7b1b77..78c8c4c8 100644 +--- a/crates/hyperswitch_connectors/src/connectors/adyenplatform.rs ++++ b/crates/hyperswitch_connectors/src/connectors/adyenplatform.rs +@@ -123,6 +123,7 @@ impl ConnectorCommon for Adyenplatform { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/affirm.rs b/crates/hyperswitch_connectors/src/connectors/affirm.rs +index 9a0a6fb4..9d1b1df2 100644 +--- a/crates/hyperswitch_connectors/src/connectors/affirm.rs ++++ b/crates/hyperswitch_connectors/src/connectors/affirm.rs +@@ -153,6 +153,7 @@ impl ConnectorCommon for Affirm { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/airwallex.rs b/crates/hyperswitch_connectors/src/connectors/airwallex.rs +index 43584028..e18f798f 100644 +--- a/crates/hyperswitch_connectors/src/connectors/airwallex.rs ++++ b/crates/hyperswitch_connectors/src/connectors/airwallex.rs +@@ -146,6 +146,7 @@ impl ConnectorCommon for Airwallex { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/amazonpay.rs b/crates/hyperswitch_connectors/src/connectors/amazonpay.rs +index 9ea2a476..3c38065e 100644 +--- a/crates/hyperswitch_connectors/src/connectors/amazonpay.rs ++++ b/crates/hyperswitch_connectors/src/connectors/amazonpay.rs +@@ -148,6 +148,7 @@ impl ConnectorCommon for Amazonpay { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/archipel.rs b/crates/hyperswitch_connectors/src/connectors/archipel.rs +index 5e56d1f9..997cbbb9 100644 +--- a/crates/hyperswitch_connectors/src/connectors/archipel.rs ++++ b/crates/hyperswitch_connectors/src/connectors/archipel.rs +@@ -162,6 +162,7 @@ impl ConnectorCommon for Archipel { + network_decline_code: None, + network_advice_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + Err(error) => { +diff --git a/crates/hyperswitch_connectors/src/connectors/archipel/transformers.rs b/crates/hyperswitch_connectors/src/connectors/archipel/transformers.rs +index e9e0262d..0b478265 100644 +--- a/crates/hyperswitch_connectors/src/connectors/archipel/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/archipel/transformers.rs +@@ -1459,6 +1459,7 @@ impl From for ErrorResponse { + network_decline_code: None, + network_advice_code: None, + network_error_message: None, ++ connector_metadata: None, + } + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/authipay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/authipay/transformers.rs +index c7c21404..ae47bb96 100644 +--- a/crates/hyperswitch_connectors/src/connectors/authipay/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/authipay/transformers.rs +@@ -619,6 +619,7 @@ impl From<&AuthipayErrorResponse> for ErrorResponse { + network_decline_code: None, + network_advice_code: None, + network_error_message: None, ++ connector_metadata: None, + } + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/authorizedotnet.rs b/crates/hyperswitch_connectors/src/connectors/authorizedotnet.rs +index 3f9c771f..d8ddf71a 100644 +--- a/crates/hyperswitch_connectors/src/connectors/authorizedotnet.rs ++++ b/crates/hyperswitch_connectors/src/connectors/authorizedotnet.rs +@@ -256,6 +256,7 @@ impl ConnectorIntegration { +@@ -1142,6 +1145,7 @@ fn get_error_response( + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers.rs b/crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers.rs +index db05933e..b887fe6f 100644 +--- a/crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers.rs +@@ -645,6 +645,7 @@ impl TryFrom + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }); + Ok(Self { + response, +@@ -1481,6 +1483,7 @@ impl + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + }); + let metadata = transaction_response +@@ -1581,6 +1584,7 @@ impl TryFrom TryFrom> + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + }); + +@@ -2028,6 +2033,7 @@ fn get_err_response( + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + +diff --git a/crates/hyperswitch_connectors/src/connectors/bambora.rs b/crates/hyperswitch_connectors/src/connectors/bambora.rs +index d876f698..ed67d9b2 100644 +--- a/crates/hyperswitch_connectors/src/connectors/bambora.rs ++++ b/crates/hyperswitch_connectors/src/connectors/bambora.rs +@@ -157,6 +157,7 @@ impl ConnectorCommon for Bambora { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/bamboraapac.rs b/crates/hyperswitch_connectors/src/connectors/bamboraapac.rs +index 17fad3a9..43a90be1 100644 +--- a/crates/hyperswitch_connectors/src/connectors/bamboraapac.rs ++++ b/crates/hyperswitch_connectors/src/connectors/bamboraapac.rs +@@ -166,6 +166,7 @@ impl ConnectorCommon for Bamboraapac { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + Err(error_msg) => { +diff --git a/crates/hyperswitch_connectors/src/connectors/bamboraapac/transformers.rs b/crates/hyperswitch_connectors/src/connectors/bamboraapac/transformers.rs +index 64601968..342b2145 100644 +--- a/crates/hyperswitch_connectors/src/connectors/bamboraapac/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/bamboraapac/transformers.rs +@@ -348,6 +348,7 @@ impl + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }), + ..item.data + }) +@@ -506,6 +507,7 @@ impl + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }), + ..item.data + }) +@@ -671,6 +673,7 @@ impl + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }), + ..item.data + }) +@@ -955,6 +958,7 @@ impl + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }), + ..item.data + }) +diff --git a/crates/hyperswitch_connectors/src/connectors/bankofamerica.rs b/crates/hyperswitch_connectors/src/connectors/bankofamerica.rs +index 5370f232..e7c4d885 100644 +--- a/crates/hyperswitch_connectors/src/connectors/bankofamerica.rs ++++ b/crates/hyperswitch_connectors/src/connectors/bankofamerica.rs +@@ -279,6 +279,7 @@ impl ConnectorCommon for Bankofamerica { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + transformers::BankOfAmericaErrorResponse::AuthenticationError(response) => { +@@ -292,6 +293,7 @@ impl ConnectorCommon for Bankofamerica { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +@@ -443,6 +445,7 @@ impl ConnectorIntegration fo + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +@@ -885,6 +890,7 @@ impl ConnectorIntegration for Ba + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs b/crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs +index 5d788dc0..07f0a961 100644 +--- a/crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs +@@ -1587,6 +1587,7 @@ fn map_error_response( + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }); + + match transaction_status { +@@ -2408,6 +2409,7 @@ fn get_error_response( + network_advice_code, + network_decline_code, + network_error_message: None, ++ connector_metadata: None, + } + } + +@@ -2714,6 +2716,7 @@ fn convert_to_error_response_from_error_info( + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + } + } + +diff --git a/crates/hyperswitch_connectors/src/connectors/barclaycard.rs b/crates/hyperswitch_connectors/src/connectors/barclaycard.rs +index 8448855a..86b862bc 100644 +--- a/crates/hyperswitch_connectors/src/connectors/barclaycard.rs ++++ b/crates/hyperswitch_connectors/src/connectors/barclaycard.rs +@@ -289,6 +289,7 @@ impl ConnectorCommon for Barclaycard { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + transformers::BarclaycardErrorResponse::AuthenticationError(response) => { +@@ -302,6 +303,7 @@ impl ConnectorCommon for Barclaycard { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +@@ -446,6 +448,7 @@ impl ConnectorIntegration fo + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +@@ -764,6 +768,7 @@ impl ConnectorIntegration for Ba + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/barclaycard/transformers.rs b/crates/hyperswitch_connectors/src/connectors/barclaycard/transformers.rs +index 7d3b8158..db963149 100644 +--- a/crates/hyperswitch_connectors/src/connectors/barclaycard/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/barclaycard/transformers.rs +@@ -841,6 +841,7 @@ fn map_error_response( + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }); + + match transaction_status { +@@ -1647,6 +1648,7 @@ fn get_error_response( + network_advice_code, + network_decline_code, + network_error_message: None, ++ connector_metadata: None, + } + } + +diff --git a/crates/hyperswitch_connectors/src/connectors/billwerk.rs b/crates/hyperswitch_connectors/src/connectors/billwerk.rs +index 4d5e324b..e5931f92 100644 +--- a/crates/hyperswitch_connectors/src/connectors/billwerk.rs ++++ b/crates/hyperswitch_connectors/src/connectors/billwerk.rs +@@ -158,6 +158,7 @@ impl ConnectorCommon for Billwerk { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/billwerk/transformers.rs b/crates/hyperswitch_connectors/src/connectors/billwerk/transformers.rs +index 18b5cf0f..feb8db1c 100644 +--- a/crates/hyperswitch_connectors/src/connectors/billwerk/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/billwerk/transformers.rs +@@ -282,6 +282,7 @@ impl TryFrom ErrorResponse { +@@ -197,6 +198,7 @@ impl ConnectorCommon for Bluesnap { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }, + bluesnap::BluesnapErrors::General(error_response) => { + let (error_res, attempt_status) = if res.status_code == 403 +@@ -221,6 +223,7 @@ impl ConnectorCommon for Bluesnap { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + } + } + }; +diff --git a/crates/hyperswitch_connectors/src/connectors/boku.rs b/crates/hyperswitch_connectors/src/connectors/boku.rs +index 09533cc3..2eda599e 100644 +--- a/crates/hyperswitch_connectors/src/connectors/boku.rs ++++ b/crates/hyperswitch_connectors/src/connectors/boku.rs +@@ -166,6 +166,7 @@ impl ConnectorCommon for Boku { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + Err(_) => get_xml_deserialized(res, event_builder), +@@ -711,6 +712,7 @@ fn get_xml_deserialized( + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/braintree.rs b/crates/hyperswitch_connectors/src/connectors/braintree.rs +index 7891ffc1..24c9a9af 100644 +--- a/crates/hyperswitch_connectors/src/connectors/braintree.rs ++++ b/crates/hyperswitch_connectors/src/connectors/braintree.rs +@@ -182,6 +182,7 @@ impl ConnectorCommon for Braintree { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + Ok(braintree::ErrorResponses::BraintreeErrorResponse(response)) => { +@@ -198,6 +199,7 @@ impl ConnectorCommon for Braintree { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + Err(error_msg) => { +diff --git a/crates/hyperswitch_connectors/src/connectors/braintree/transformers.rs b/crates/hyperswitch_connectors/src/connectors/braintree/transformers.rs +index 9d6a3611..89072159 100644 +--- a/crates/hyperswitch_connectors/src/connectors/braintree/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/braintree/transformers.rs +@@ -482,6 +482,7 @@ impl + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } else { + Ok(PaymentsResponseData::TransactionResponse { +@@ -575,6 +576,7 @@ fn get_error_response( + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }, + )) + } +@@ -668,6 +670,7 @@ impl + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } else { + Ok(PaymentsResponseData::TransactionResponse { +@@ -756,6 +759,7 @@ impl + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } else { + Ok(PaymentsResponseData::TransactionResponse { +@@ -825,6 +829,7 @@ impl + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } else { + Ok(PaymentsResponseData::TransactionResponse { +@@ -1019,6 +1024,7 @@ impl TryFrom> + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } else { + Ok(RefundsResponseData { +@@ -1381,6 +1387,7 @@ impl TryFrom> + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } else { + Ok(PaymentsResponseData::TransactionResponse { +@@ -1584,6 +1591,7 @@ impl TryFrom TryFrom + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }), + ), + CashtocodePaymentsResponse::CashtoCodeData(response_data) => { +diff --git a/crates/hyperswitch_connectors/src/connectors/celero.rs b/crates/hyperswitch_connectors/src/connectors/celero.rs +index 5d37d737..9db111a1 100644 +--- a/crates/hyperswitch_connectors/src/connectors/celero.rs ++++ b/crates/hyperswitch_connectors/src/connectors/celero.rs +@@ -147,6 +147,7 @@ impl ConnectorCommon for Celero { + network_decline_code: None, + network_advice_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/chargebee.rs b/crates/hyperswitch_connectors/src/connectors/chargebee.rs +index 4dcda9ad..f6f38d20 100644 +--- a/crates/hyperswitch_connectors/src/connectors/chargebee.rs ++++ b/crates/hyperswitch_connectors/src/connectors/chargebee.rs +@@ -158,6 +158,7 @@ impl ConnectorCommon for Chargebee { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/checkbook.rs b/crates/hyperswitch_connectors/src/connectors/checkbook.rs +index 90148c84..5c4411c6 100644 +--- a/crates/hyperswitch_connectors/src/connectors/checkbook.rs ++++ b/crates/hyperswitch_connectors/src/connectors/checkbook.rs +@@ -156,6 +156,7 @@ impl ConnectorCommon for Checkbook { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/checkout.rs b/crates/hyperswitch_connectors/src/connectors/checkout.rs +index e8d48ae9..7fc205a0 100644 +--- a/crates/hyperswitch_connectors/src/connectors/checkout.rs ++++ b/crates/hyperswitch_connectors/src/connectors/checkout.rs +@@ -189,6 +189,7 @@ impl ConnectorCommon for Checkout { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/checkout/transformers.rs b/crates/hyperswitch_connectors/src/connectors/checkout/transformers.rs +index 7343327e..6e83e08b 100644 +--- a/crates/hyperswitch_connectors/src/connectors/checkout/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/checkout/transformers.rs +@@ -720,6 +720,7 @@ impl TryFrom> for PaymentsAuthorize + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } else { + None +@@ -775,6 +776,7 @@ impl TryFrom> for PaymentsSyncR + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } else { + None +diff --git a/crates/hyperswitch_connectors/src/connectors/coinbase.rs b/crates/hyperswitch_connectors/src/connectors/coinbase.rs +index 171df928..e776a2d3 100644 +--- a/crates/hyperswitch_connectors/src/connectors/coinbase.rs ++++ b/crates/hyperswitch_connectors/src/connectors/coinbase.rs +@@ -151,6 +151,7 @@ impl ConnectorCommon for Coinbase { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/coingate.rs b/crates/hyperswitch_connectors/src/connectors/coingate.rs +index e6a4e06f..1c50c4fc 100644 +--- a/crates/hyperswitch_connectors/src/connectors/coingate.rs ++++ b/crates/hyperswitch_connectors/src/connectors/coingate.rs +@@ -157,6 +157,7 @@ impl ConnectorCommon for Coingate { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/cryptopay.rs b/crates/hyperswitch_connectors/src/connectors/cryptopay.rs +index e2c3b340..723e662b 100644 +--- a/crates/hyperswitch_connectors/src/connectors/cryptopay.rs ++++ b/crates/hyperswitch_connectors/src/connectors/cryptopay.rs +@@ -193,6 +193,7 @@ impl ConnectorCommon for Cryptopay { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/cryptopay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/cryptopay/transformers.rs +index 59c76c64..a9bc6f27 100644 +--- a/crates/hyperswitch_connectors/src/connectors/cryptopay/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/cryptopay/transformers.rs +@@ -178,6 +178,7 @@ impl + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } else { + let redirection_data = item +diff --git a/crates/hyperswitch_connectors/src/connectors/custombilling.rs b/crates/hyperswitch_connectors/src/connectors/custombilling.rs +index 709f5c63..209dc3ed 100644 +--- a/crates/hyperswitch_connectors/src/connectors/custombilling.rs ++++ b/crates/hyperswitch_connectors/src/connectors/custombilling.rs +@@ -141,6 +141,7 @@ impl ConnectorCommon for Custombilling { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/cybersource.rs b/crates/hyperswitch_connectors/src/connectors/cybersource.rs +index 36dbee63..0a1061e2 100644 +--- a/crates/hyperswitch_connectors/src/connectors/cybersource.rs ++++ b/crates/hyperswitch_connectors/src/connectors/cybersource.rs +@@ -242,6 +242,7 @@ impl ConnectorCommon for Cybersource { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + Ok(transformers::CybersourceErrorResponse::AuthenticationError(response)) => { +@@ -257,6 +258,7 @@ impl ConnectorCommon for Cybersource { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + Ok(transformers::CybersourceErrorResponse::NotAvailableError(response)) => { +@@ -284,6 +286,7 @@ impl ConnectorCommon for Cybersource { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + Err(error_msg) => { +@@ -518,6 +521,7 @@ impl ConnectorIntegration fo + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +@@ -1079,6 +1085,7 @@ impl ConnectorIntegration for Cyber + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +@@ -1321,6 +1329,7 @@ impl ConnectorIntegration for Cy + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs b/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs +index ca41d12e..42bc6f92 100644 +--- a/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs +@@ -3197,6 +3197,7 @@ impl + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }), + status: enums::AttemptStatus::AuthenticationFailed, + ..item.data +@@ -3613,6 +3614,7 @@ impl + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }); + Ok(Self { + response, +@@ -4512,6 +4514,7 @@ pub fn get_error_response( + network_advice_code, + network_decline_code, + network_error_message: None, ++ connector_metadata: None, + } + } + +diff --git a/crates/hyperswitch_connectors/src/connectors/datatrans.rs b/crates/hyperswitch_connectors/src/connectors/datatrans.rs +index e81ce40f..d6bde306 100644 +--- a/crates/hyperswitch_connectors/src/connectors/datatrans.rs ++++ b/crates/hyperswitch_connectors/src/connectors/datatrans.rs +@@ -156,6 +156,7 @@ impl ConnectorCommon for Datatrans { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } else { + let response: datatrans::DatatransErrorResponse = res +@@ -174,6 +175,7 @@ impl ConnectorCommon for Datatrans { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/datatrans/transformers.rs b/crates/hyperswitch_connectors/src/connectors/datatrans/transformers.rs +index 173a1aa4..7ae1dbd7 100644 +--- a/crates/hyperswitch_connectors/src/connectors/datatrans/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/datatrans/transformers.rs +@@ -563,6 +563,7 @@ impl + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }), + DatatransResponse::TransactionResponse(response) => { + Ok(PaymentsResponseData::TransactionResponse { +@@ -635,6 +636,7 @@ impl + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }), + DatatransResponse::TransactionResponse(response) => { + Ok(PaymentsResponseData::TransactionResponse { +@@ -713,6 +715,7 @@ impl TryFrom> + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }), + ..item.data + }), +@@ -745,6 +748,7 @@ impl TryFrom> + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }), + DatatransSyncResponse::Response(response) => Ok(RefundsResponseData { + connector_refund_id: response.transaction_id.to_string(), +@@ -777,6 +781,7 @@ impl TryFrom> + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }); + Ok(Self { + response, +@@ -803,6 +808,7 @@ impl TryFrom> + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } else { + let mandate_reference = sync_response +diff --git a/crates/hyperswitch_connectors/src/connectors/deutschebank.rs b/crates/hyperswitch_connectors/src/connectors/deutschebank.rs +index 725bbbbe..c0fb5e9a 100644 +--- a/crates/hyperswitch_connectors/src/connectors/deutschebank.rs ++++ b/crates/hyperswitch_connectors/src/connectors/deutschebank.rs +@@ -176,6 +176,7 @@ impl ConnectorCommon for Deutschebank { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +@@ -309,6 +310,7 @@ impl ConnectorIntegration + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }), + deutschebank::DeutschebankError::AccessTokenErrorResponse(response) => { + Ok(ErrorResponse { +@@ -321,6 +323,7 @@ impl ConnectorIntegration + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/deutschebank/transformers.rs b/crates/hyperswitch_connectors/src/connectors/deutschebank/transformers.rs +index e56e7206..bf6e9c3a 100644 +--- a/crates/hyperswitch_connectors/src/connectors/deutschebank/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/deutschebank/transformers.rs +@@ -447,6 +447,7 @@ impl + connector_transaction_id: None,network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }), + ..item.data + }), +@@ -519,6 +520,7 @@ fn get_error_response(error_code: String, error_reason: String, status_code: u16 + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + } + } + +diff --git a/crates/hyperswitch_connectors/src/connectors/digitalvirgo.rs b/crates/hyperswitch_connectors/src/connectors/digitalvirgo.rs +index 7ee7f9c6..e0e1263c 100644 +--- a/crates/hyperswitch_connectors/src/connectors/digitalvirgo.rs ++++ b/crates/hyperswitch_connectors/src/connectors/digitalvirgo.rs +@@ -165,6 +165,7 @@ impl ConnectorCommon for Digitalvirgo { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/dlocal.rs b/crates/hyperswitch_connectors/src/connectors/dlocal.rs +index efe00eca..fdf3ceb8 100644 +--- a/crates/hyperswitch_connectors/src/connectors/dlocal.rs ++++ b/crates/hyperswitch_connectors/src/connectors/dlocal.rs +@@ -168,6 +168,7 @@ impl ConnectorCommon for Dlocal { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/dummyconnector.rs b/crates/hyperswitch_connectors/src/connectors/dummyconnector.rs +index 0803cb67..eeff74a4 100644 +--- a/crates/hyperswitch_connectors/src/connectors/dummyconnector.rs ++++ b/crates/hyperswitch_connectors/src/connectors/dummyconnector.rs +@@ -161,6 +161,7 @@ impl ConnectorCommon for DummyConnector { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/dwolla.rs b/crates/hyperswitch_connectors/src/connectors/dwolla.rs +index a228366b..e6bd12ea 100644 +--- a/crates/hyperswitch_connectors/src/connectors/dwolla.rs ++++ b/crates/hyperswitch_connectors/src/connectors/dwolla.rs +@@ -1,28 +1,38 @@ + pub mod transformers; + ++use std::sync::LazyLock; ++ ++use base64::engine::Engine; ++use common_enums::enums; + use common_utils::{ ++ consts::BASE64_ENGINE, ++ crypto, + errors::CustomResult, +- ext_traits::BytesExt, ++ ext_traits::{ByteSliceExt, BytesExt}, + request::{Method, Request, RequestBuilder, RequestContent}, +- types::{AmountConvertor, StringMajorUnit, StringMajorUnitForConnector}, ++ types::{AmountConvertor, MinorUnit, StringMajorUnit, StringMajorUnitForConnector}, + }; + use error_stack::{report, ResultExt}; + use hyperswitch_domain_models::{ +- router_data::{AccessToken, ConnectorAuthType, ErrorResponse, RouterData}, ++ router_data::{AccessToken, ErrorResponse, PaymentMethodToken as PMT, RouterData}, + router_flow_types::{ + access_token_auth::AccessTokenAuth, + payments::{Authorize, Capture, PSync, PaymentMethodToken, Session, SetupMandate, Void}, + refunds::{Execute, RSync}, ++ CreateConnectorCustomer, + }, + router_request_types::{ +- AccessTokenRequestData, PaymentMethodTokenizationData, PaymentsAuthorizeData, +- PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData, +- RefundsData, SetupMandateRequestData, ++ AccessTokenRequestData, ConnectorCustomerData, PaymentMethodTokenizationData, ++ PaymentsAuthorizeData, PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, ++ PaymentsSyncData, RefundsData, ResponseId, SetupMandateRequestData, ++ }, ++ router_response_types::{ ++ ConnectorInfo, PaymentMethodDetails, PaymentsResponseData, RefundsResponseData, ++ SupportedPaymentMethods, SupportedPaymentMethodsExt, + }, +- router_response_types::{PaymentsResponseData, RefundsResponseData}, + types::{ +- PaymentsAuthorizeRouterData, PaymentsCaptureRouterData, PaymentsSyncRouterData, +- RefundSyncRouterData, RefundsRouterData, ++ ConnectorCustomerRouterData, PaymentsAuthorizeRouterData, PaymentsSyncRouterData, ++ RefreshTokenRouterData, RefundSyncRouterData, RefundsRouterData, TokenizationRouterData, + }, + }; + use hyperswitch_interfaces::{ +@@ -33,13 +43,19 @@ use hyperswitch_interfaces::{ + configs::Connectors, + errors, + events::connector_api_logs::ConnectorEvent, +- types::{self, Response}, ++ types::{self, RefreshTokenType, Response, TokenizationType}, + webhooks, + }; +-use masking::{ExposeInterface, Mask}; ++use masking::{ExposeInterface, Mask, Secret}; ++use ring::hmac; + use transformers as dwolla; ++use transformers::extract_token_from_body; + +-use crate::{constants::headers, types::ResponseRouterData, utils}; ++use crate::{ ++ constants::headers, ++ types::ResponseRouterData, ++ utils::{convert_amount, get_http_header, RefundsRequestData, RouterData as RD}, ++}; + + #[derive(Clone)] + pub struct Dwolla { +@@ -54,6 +70,7 @@ impl Dwolla { + } + } + ++impl api::ConnectorCustomer for Dwolla {} + impl api::Payment for Dwolla {} + impl api::PaymentSession for Dwolla {} + impl api::ConnectorAccessToken for Dwolla {} +@@ -67,12 +84,6 @@ impl api::RefundExecute for Dwolla {} + impl api::RefundSync for Dwolla {} + impl api::PaymentToken for Dwolla {} + +-impl ConnectorIntegration +- for Dwolla +-{ +- // Not Implemented (R) +-} +- + impl ConnectorCommonExt for Dwolla + where + Self: ConnectorIntegration, +@@ -82,12 +93,28 @@ where + req: &RouterData, + _connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { +- let mut header = vec![( +- headers::CONTENT_TYPE.to_string(), +- self.get_content_type().to_string().into(), +- )]; +- let mut api_key = self.get_auth_header(&req.connector_auth_type)?; +- header.append(&mut api_key); ++ let access_token = req ++ .access_token ++ .clone() ++ .ok_or(errors::ConnectorError::FailedToObtainAuthType)?; ++ let header = vec![ ++ ( ++ headers::CONTENT_TYPE.to_string(), ++ self.common_get_content_type().to_string().into(), ++ ), ++ ( ++ headers::ACCEPT.to_string(), ++ self.common_get_content_type().to_string().into(), ++ ), ++ ( ++ headers::AUTHORIZATION.to_string(), ++ format!("Bearer {}", access_token.token.expose()).into_masked(), ++ ), ++ ( ++ headers::IDEMPOTENCY_KEY.to_string(), ++ uuid::Uuid::new_v4().to_string().into(), ++ ), ++ ]; + Ok(header) + } + } +@@ -102,25 +129,13 @@ impl ConnectorCommon for Dwolla { + } + + fn common_get_content_type(&self) -> &'static str { +- "application/json" ++ "application/vnd.dwolla.v1.hal+json" + } + + fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str { + connectors.dwolla.base_url.as_ref() + } + +- fn get_auth_header( +- &self, +- auth_type: &ConnectorAuthType, +- ) -> CustomResult)>, errors::ConnectorError> { +- let auth = dwolla::DwollaAuthType::try_from(auth_type) +- .change_context(errors::ConnectorError::FailedToObtainAuthType)?; +- Ok(vec![( +- headers::AUTHORIZATION.to_string(), +- auth.api_key.expose().into_masked(), +- )]) +- } +- + fn build_error_response( + &self, + res: Response, +@@ -138,12 +153,18 @@ impl ConnectorCommon for Dwolla { + status_code: res.status_code, + code: response.code, + message: response.message, +- reason: response.reason, ++ reason: response ++ ._embedded ++ .as_ref() ++ .and_then(|errors_vec| errors_vec.first()) ++ .and_then(|details| details.errors.first()) ++ .and_then(|err_detail| err_detail.message.clone()), + attempt_status: None, + connector_transaction_id: None, + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +@@ -156,85 +177,179 @@ impl ConnectorIntegration fo + //TODO: implement sessions flow + } + +-impl ConnectorIntegration for Dwolla {} +- +-impl ConnectorIntegration for Dwolla {} ++impl ConnectorIntegration for Dwolla { ++ fn get_url( ++ &self, ++ _req: &RefreshTokenRouterData, ++ connectors: &Connectors, ++ ) -> CustomResult { ++ Ok(format!("{}/token", self.base_url(connectors))) ++ } + +-impl ConnectorIntegration for Dwolla { + fn get_headers( + &self, +- req: &PaymentsAuthorizeRouterData, +- connectors: &Connectors, ++ req: &RefreshTokenRouterData, ++ _connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { +- self.build_headers(req, connectors) ++ let auth = dwolla::DwollaAuthType::try_from(&req.connector_auth_type)?; ++ let mut headers = vec![( ++ headers::CONTENT_TYPE.to_string(), ++ "application/x-www-form-urlencoded".to_string().into(), ++ )]; ++ ++ let auth_str = format!( ++ "{}:{}", ++ auth.client_id.expose(), ++ auth.client_secret.expose() ++ ); ++ ++ let encoded = BASE64_ENGINE.encode(auth_str); ++ let auth_header_value = format!("Basic {encoded}"); ++ headers.push(( ++ headers::AUTHORIZATION.to_string(), ++ auth_header_value.into_masked(), ++ )); ++ ++ Ok(headers) + } + +- fn get_content_type(&self) -> &'static str { +- self.common_get_content_type() ++ fn build_request( ++ &self, ++ req: &RefreshTokenRouterData, ++ connectors: &Connectors, ++ ) -> CustomResult, errors::ConnectorError> { ++ let headers = self.get_headers(req, connectors)?; ++ ++ let connector_req = dwolla::DwollaAccessTokenRequest { ++ grant_type: "client_credentials".to_string(), ++ }; ++ let body = RequestContent::FormUrlEncoded(Box::new(connector_req)); ++ ++ let req = Some( ++ RequestBuilder::new() ++ .method(Method::Post) ++ .headers(headers) ++ .url(&RefreshTokenType::get_url(self, req, connectors)?) ++ .set_body(body) ++ .build(), ++ ); ++ Ok(req) + } + ++ fn handle_response( ++ &self, ++ data: &RefreshTokenRouterData, ++ event_builder: Option<&mut ConnectorEvent>, ++ res: Response, ++ ) -> CustomResult { ++ let response: dwolla::DwollaAccessTokenResponse = res ++ .response ++ .parse_struct("Dwolla DwollaAccessTokenResponse") ++ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; ++ ++ event_builder.map(|i| i.set_response_body(&response)); ++ router_env::logger::info!(connector_response=?response); ++ ++ RouterData::try_from(ResponseRouterData { ++ response, ++ data: data.clone(), ++ http_code: res.status_code, ++ }) ++ } ++ ++ fn get_error_response( ++ &self, ++ res: Response, ++ event_builder: Option<&mut ConnectorEvent>, ++ ) -> CustomResult { ++ self.build_error_response(res, event_builder) ++ } ++} ++ ++impl ConnectorIntegration ++ for Dwolla ++{ + fn get_url( + &self, +- _req: &PaymentsAuthorizeRouterData, +- _connectors: &Connectors, ++ _req: &ConnectorCustomerRouterData, ++ connectors: &Connectors, + ) -> CustomResult { +- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into()) ++ Ok(format!("{}/customers", self.base_url(connectors))) ++ } ++ ++ fn get_content_type(&self) -> &'static str { ++ self.common_get_content_type() ++ } ++ ++ fn get_headers( ++ &self, ++ req: &ConnectorCustomerRouterData, ++ connectors: &Connectors, ++ ) -> CustomResult)>, errors::ConnectorError> { ++ self.build_headers(req, connectors) + } + + fn get_request_body( + &self, +- req: &PaymentsAuthorizeRouterData, ++ req: &ConnectorCustomerRouterData, + _connectors: &Connectors, + ) -> CustomResult { +- let amount = utils::convert_amount( +- self.amount_converter, +- req.request.minor_amount, +- req.request.currency, +- )?; +- +- let connector_router_data = dwolla::DwollaRouterData::from((amount, req)); +- let connector_req = dwolla::DwollaPaymentsRequest::try_from(&connector_router_data)?; ++ let connector_req = dwolla::DwollaCustomerRequest::try_from(req)?; + Ok(RequestContent::Json(Box::new(connector_req))) + } + + fn build_request( + &self, +- req: &PaymentsAuthorizeRouterData, ++ req: &ConnectorCustomerRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { +- Ok(Some( ++ let request = Some( + RequestBuilder::new() + .method(Method::Post) +- .url(&types::PaymentsAuthorizeType::get_url( ++ .url(&types::ConnectorCustomerType::get_url( + self, req, connectors, + )?) + .attach_default_headers() +- .headers(types::PaymentsAuthorizeType::get_headers( ++ .headers(types::ConnectorCustomerType::get_headers( + self, req, connectors, + )?) +- .set_body(types::PaymentsAuthorizeType::get_request_body( ++ .set_body(types::ConnectorCustomerType::get_request_body( + self, req, connectors, + )?) + .build(), +- )) ++ ); ++ Ok(request) + } + + fn handle_response( + &self, +- data: &PaymentsAuthorizeRouterData, ++ data: &ConnectorCustomerRouterData, + event_builder: Option<&mut ConnectorEvent>, + res: Response, +- ) -> CustomResult { +- let response: dwolla::DwollaPaymentsResponse = res +- .response +- .parse_struct("Dwolla PaymentsAuthorizeResponse") +- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; ++ ) -> CustomResult { ++ let headers = res ++ .headers ++ .as_ref() ++ .ok_or(errors::ConnectorError::ResponseHandlingFailed)?; ++ let location = get_http_header("Location", headers) ++ .change_context(errors::ConnectorError::ResponseHandlingFailed)?; ++ ++ let connector_customer_id = location ++ .split('/') ++ .next_back() ++ .ok_or(errors::ConnectorError::ResponseHandlingFailed)? ++ .to_string(); ++ ++ let response = serde_json::json!({"connector_customer_id": connector_customer_id.clone()}); + event_builder.map(|i| i.set_response_body(&response)); + router_env::logger::info!(connector_response=?response); +- RouterData::try_from(ResponseRouterData { +- response, +- data: data.clone(), +- http_code: res.status_code, ++ ++ Ok(RouterData { ++ connector_customer: Some(connector_customer_id.clone()), ++ response: Ok(PaymentsResponseData::ConnectorCustomerResponse { ++ connector_customer_id, ++ }), ++ ..data.clone() + }) + } + +@@ -247,10 +362,12 @@ impl ConnectorIntegration for Dwolla { ++impl ConnectorIntegration ++ for Dwolla ++{ + fn get_headers( + &self, +- req: &PaymentsSyncRouterData, ++ req: &TokenizationRouterData, + connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { + self.build_headers(req, connectors) +@@ -262,43 +379,67 @@ impl ConnectorIntegration for Dwo + + fn get_url( + &self, +- _req: &PaymentsSyncRouterData, +- _connectors: &Connectors, ++ req: &TokenizationRouterData, ++ connectors: &Connectors, + ) -> CustomResult { +- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into()) ++ let customer_id = req.get_connector_customer_id()?; ++ Ok(format!( ++ "{}/customers/{}/funding-sources", ++ self.base_url(connectors), ++ customer_id ++ )) ++ } ++ ++ fn get_request_body( ++ &self, ++ req: &TokenizationRouterData, ++ _connectors: &Connectors, ++ ) -> CustomResult { ++ let connector_req = dwolla::DwollaFundingSourceRequest::try_from(req)?; ++ Ok(RequestContent::Json(Box::new(connector_req))) + } + + fn build_request( + &self, +- req: &PaymentsSyncRouterData, ++ req: &TokenizationRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { + Ok(Some( + RequestBuilder::new() +- .method(Method::Get) +- .url(&types::PaymentsSyncType::get_url(self, req, connectors)?) ++ .method(Method::Post) ++ .url(&TokenizationType::get_url(self, req, connectors)?) + .attach_default_headers() +- .headers(types::PaymentsSyncType::get_headers(self, req, connectors)?) ++ .headers(TokenizationType::get_headers(self, req, connectors)?) ++ .set_body(TokenizationType::get_request_body(self, req, connectors)?) + .build(), + )) + } + + fn handle_response( + &self, +- data: &PaymentsSyncRouterData, ++ data: &TokenizationRouterData, + event_builder: Option<&mut ConnectorEvent>, + res: Response, +- ) -> CustomResult { +- let response: dwolla::DwollaPaymentsResponse = res +- .response +- .parse_struct("dwolla PaymentsSyncResponse") +- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; +- event_builder.map(|i| i.set_response_body(&response)); ++ ) -> CustomResult { ++ let token = res ++ .headers ++ .as_ref() ++ .and_then(|headers| get_http_header("Location", headers).ok()) ++ .and_then(|location| location.rsplit('/').next().map(|s| s.to_string())) ++ .ok_or_else(|| report!(errors::ConnectorError::ResponseHandlingFailed))?; ++ ++ let response = serde_json::json!({ "payment_token": token }); ++ ++ if let Some(builder) = event_builder { ++ builder.set_response_body(&response); ++ } ++ + router_env::logger::info!(connector_response=?response); +- RouterData::try_from(ResponseRouterData { +- response, +- data: data.clone(), +- http_code: res.status_code, ++ ++ Ok(RouterData { ++ payment_method_token: Some(PMT::Token(token.clone().into())), ++ response: Ok(PaymentsResponseData::TokenizationResponse { token }), ++ ..data.clone() + }) + } + +@@ -307,14 +448,48 @@ impl ConnectorIntegration for Dwo + res: Response, + event_builder: Option<&mut ConnectorEvent>, + ) -> CustomResult { ++ if let Ok(body) = std::str::from_utf8(&res.response) { ++ if res.status_code == 400 && body.contains("Duplicate") { ++ let token = extract_token_from_body(&res.response); ++ let metadata = Some(Secret::new( ++ serde_json::json!({ "payment_method_token": token? }), ++ )); ++ let response: dwolla::DwollaErrorResponse = res ++ .response ++ .parse_struct("DwollaErrorResponse") ++ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; ++ ++ event_builder.map(|i| i.set_response_body(&response)); ++ ++ return Ok(ErrorResponse { ++ status_code: res.status_code, ++ code: response.code, ++ message: response.message, ++ reason: response ++ ._embedded ++ .as_ref() ++ .and_then(|errors_vec| errors_vec.first()) ++ .and_then(|details| details.errors.first()) ++ .and_then(|err_detail| err_detail.message.clone()), ++ attempt_status: None, ++ connector_transaction_id: None, ++ network_advice_code: None, ++ network_decline_code: None, ++ network_error_message: None, ++ connector_metadata: metadata, ++ }); ++ } ++ } + self.build_error_response(res, event_builder) + } + } + +-impl ConnectorIntegration for Dwolla { ++impl ConnectorIntegration for Dwolla {} ++ ++impl ConnectorIntegration for Dwolla { + fn get_headers( + &self, +- req: &PaymentsCaptureRouterData, ++ req: &PaymentsAuthorizeRouterData, + connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { + self.build_headers(req, connectors) +@@ -326,34 +501,44 @@ impl ConnectorIntegration fo + + fn get_url( + &self, +- _req: &PaymentsCaptureRouterData, +- _connectors: &Connectors, ++ _req: &PaymentsAuthorizeRouterData, ++ connectors: &Connectors, + ) -> CustomResult { +- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into()) ++ Ok(format!("{}/transfers", self.base_url(connectors))) + } + + fn get_request_body( + &self, +- _req: &PaymentsCaptureRouterData, +- _connectors: &Connectors, ++ req: &PaymentsAuthorizeRouterData, ++ connectors: &Connectors, + ) -> CustomResult { +- Err(errors::ConnectorError::NotImplemented("get_request_body method".to_string()).into()) ++ let amount = convert_amount( ++ self.amount_converter, ++ req.request.minor_amount, ++ req.request.currency, ++ )?; ++ let connector_router_data = ++ dwolla::DwollaRouterData::try_from((amount, req, self.base_url(connectors)))?; ++ let connector_req = dwolla::DwollaPaymentsRequest::try_from(&connector_router_data)?; ++ Ok(RequestContent::Json(Box::new(connector_req))) + } + + fn build_request( + &self, +- req: &PaymentsCaptureRouterData, ++ req: &PaymentsAuthorizeRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { + Ok(Some( + RequestBuilder::new() + .method(Method::Post) +- .url(&types::PaymentsCaptureType::get_url(self, req, connectors)?) ++ .url(&types::PaymentsAuthorizeType::get_url( ++ self, req, connectors, ++ )?) + .attach_default_headers() +- .headers(types::PaymentsCaptureType::get_headers( ++ .headers(types::PaymentsAuthorizeType::get_headers( + self, req, connectors, + )?) +- .set_body(types::PaymentsCaptureType::get_request_body( ++ .set_body(types::PaymentsAuthorizeType::get_request_body( + self, req, connectors, + )?) + .build(), +@@ -362,13 +547,115 @@ impl ConnectorIntegration fo + + fn handle_response( + &self, +- data: &PaymentsCaptureRouterData, ++ data: &PaymentsAuthorizeRouterData, ++ event_builder: Option<&mut ConnectorEvent>, ++ res: Response, ++ ) -> CustomResult { ++ let headers = res ++ .headers ++ .as_ref() ++ .ok_or(errors::ConnectorError::ResponseHandlingFailed)?; ++ let location = get_http_header("Location", headers) ++ .change_context(errors::ConnectorError::ResponseHandlingFailed)?; ++ ++ let payment_id = location ++ .split('/') ++ .next_back() ++ .ok_or(errors::ConnectorError::ResponseHandlingFailed)? ++ .to_string(); ++ let response = serde_json::json!({"payment_id : ": payment_id.clone()}); ++ ++ event_builder.map(|i| i.set_response_body(&response)); ++ router_env::logger::info!(connector_response=?response); ++ ++ let connector_metadata = data ++ .payment_method_token ++ .as_ref() ++ .and_then(|token| match token { ++ PMT::Token(t) => Some(serde_json::json!({ "payment_token": t.clone().expose() })), ++ _ => None, ++ }); ++ ++ Ok(RouterData { ++ payment_method_token: data.payment_method_token.clone(), ++ response: Ok(PaymentsResponseData::TransactionResponse { ++ resource_id: ResponseId::ConnectorTransactionId(payment_id.clone()), ++ redirection_data: Box::new(None), ++ mandate_reference: Box::new(None), ++ connector_metadata, ++ network_txn_id: None, ++ connector_response_reference_id: Some(payment_id.clone()), ++ incremental_authorization_allowed: None, ++ charges: None, ++ }), ++ amount_captured: Some(data.request.amount), ++ ..data.clone() ++ }) ++ } ++ ++ fn get_error_response( ++ &self, ++ res: Response, ++ event_builder: Option<&mut ConnectorEvent>, ++ ) -> CustomResult { ++ self.build_error_response(res, event_builder) ++ } ++} ++ ++impl ConnectorIntegration for Dwolla { ++ fn get_headers( ++ &self, ++ req: &PaymentsSyncRouterData, ++ connectors: &Connectors, ++ ) -> CustomResult)>, errors::ConnectorError> { ++ self.build_headers(req, connectors) ++ } ++ ++ fn get_content_type(&self) -> &'static str { ++ self.common_get_content_type() ++ } ++ ++ fn get_url( ++ &self, ++ req: &PaymentsSyncRouterData, ++ connectors: &Connectors, ++ ) -> CustomResult { ++ let connector_payment_id = req ++ .request ++ .connector_transaction_id ++ .get_connector_transaction_id() ++ .change_context(errors::ConnectorError::MissingConnectorTransactionID)?; ++ Ok(format!( ++ "{}/transfers/{}", ++ self.base_url(connectors), ++ connector_payment_id.clone() ++ )) ++ } ++ ++ fn build_request( ++ &self, ++ req: &PaymentsSyncRouterData, ++ connectors: &Connectors, ++ ) -> CustomResult, errors::ConnectorError> { ++ Ok(Some( ++ RequestBuilder::new() ++ .method(Method::Get) ++ .url(&types::PaymentsSyncType::get_url(self, req, connectors)?) ++ .attach_default_headers() ++ .headers(types::PaymentsSyncType::get_headers(self, req, connectors)?) ++ .build(), ++ )) ++ } ++ ++ fn handle_response( ++ &self, ++ data: &PaymentsSyncRouterData, + event_builder: Option<&mut ConnectorEvent>, + res: Response, +- ) -> CustomResult { +- let response: dwolla::DwollaPaymentsResponse = res ++ ) -> CustomResult { ++ let response: dwolla::DwollaPSyncResponse = res + .response +- .parse_struct("Dwolla PaymentsCaptureResponse") ++ .parse_struct("dwolla DwollaPSyncResponse") + .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; + event_builder.map(|i| i.set_response_body(&response)); + router_env::logger::info!(connector_response=?response); +@@ -388,7 +675,13 @@ impl ConnectorIntegration fo + } + } + +-impl ConnectorIntegration for Dwolla {} ++impl ConnectorIntegration for Dwolla { ++ //Not implemented for Dwolla ++} ++ ++impl ConnectorIntegration for Dwolla { ++ //Not implemented for Dwolla ++} + + impl ConnectorIntegration for Dwolla { + fn get_headers( +@@ -406,24 +699,25 @@ impl ConnectorIntegration for Dwolla + fn get_url( + &self, + _req: &RefundsRouterData, +- _connectors: &Connectors, ++ connectors: &Connectors, + ) -> CustomResult { +- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into()) ++ Ok(format!("{}/transfers", self.base_url(connectors))) + } + + fn get_request_body( + &self, + req: &RefundsRouterData, +- _connectors: &Connectors, ++ connectors: &Connectors, + ) -> CustomResult { +- let refund_amount = utils::convert_amount( ++ let amount_in_minor_unit = MinorUnit::new(req.request.refund_amount); ++ let amount = convert_amount( + self.amount_converter, +- req.request.minor_refund_amount, ++ amount_in_minor_unit, + req.request.currency, + )?; +- +- let connector_router_data = dwolla::DwollaRouterData::from((refund_amount, req)); +- let connector_req = dwolla::DwollaRefundRequest::try_from(&connector_router_data)?; ++ let connector_router_data = ++ dwolla::DwollaRouterData::try_from((amount, req, self.base_url(connectors)))?; ++ let connector_req = dwolla::DwollaRefundsRequest::try_from(&connector_router_data)?; + Ok(RequestContent::Json(Box::new(connector_req))) + } + +@@ -432,18 +726,19 @@ impl ConnectorIntegration for Dwolla + req: &RefundsRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { +- let request = RequestBuilder::new() +- .method(Method::Post) +- .url(&types::RefundExecuteType::get_url(self, req, connectors)?) +- .attach_default_headers() +- .headers(types::RefundExecuteType::get_headers( +- self, req, connectors, +- )?) +- .set_body(types::RefundExecuteType::get_request_body( +- self, req, connectors, +- )?) +- .build(); +- Ok(Some(request)) ++ Ok(Some( ++ RequestBuilder::new() ++ .method(Method::Post) ++ .url(&types::RefundExecuteType::get_url(self, req, connectors)?) ++ .attach_default_headers() ++ .headers(types::RefundExecuteType::get_headers( ++ self, req, connectors, ++ )?) ++ .set_body(types::RefundExecuteType::get_request_body( ++ self, req, connectors, ++ )?) ++ .build(), ++ )) + } + + fn handle_response( +@@ -452,16 +747,30 @@ impl ConnectorIntegration for Dwolla + event_builder: Option<&mut ConnectorEvent>, + res: Response, + ) -> CustomResult, errors::ConnectorError> { +- let response: dwolla::RefundResponse = +- res.response +- .parse_struct("dwolla RefundResponse") +- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; ++ let headers = res ++ .headers ++ .as_ref() ++ .ok_or(errors::ConnectorError::ResponseHandlingFailed)?; ++ let location = get_http_header("Location", headers) ++ .change_context(errors::ConnectorError::ResponseHandlingFailed)?; ++ ++ let refund_id = location ++ .split('/') ++ .next_back() ++ .ok_or(errors::ConnectorError::ResponseHandlingFailed)? ++ .to_string(); ++ ++ let response = serde_json::json!({"refund_id : ": refund_id.clone()}); ++ + event_builder.map(|i| i.set_response_body(&response)); + router_env::logger::info!(connector_response=?response); +- RouterData::try_from(ResponseRouterData { +- response, +- data: data.clone(), +- http_code: res.status_code, ++ ++ Ok(RouterData { ++ response: Ok(RefundsResponseData { ++ connector_refund_id: refund_id.clone(), ++ refund_status: enums::RefundStatus::Pending, ++ }), ++ ..data.clone() + }) + } + +@@ -489,10 +798,15 @@ impl ConnectorIntegration for Dwolla { + + fn get_url( + &self, +- _req: &RefundSyncRouterData, +- _connectors: &Connectors, ++ req: &RefundSyncRouterData, ++ connectors: &Connectors, + ) -> CustomResult { +- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into()) ++ let connector_refund_id = req.request.get_connector_refund_id()?; ++ Ok(format!( ++ "{}/transfers/{}", ++ self.base_url(connectors), ++ connector_refund_id.clone() ++ )) + } + + fn build_request( +@@ -506,9 +820,6 @@ impl ConnectorIntegration for Dwolla { + .url(&types::RefundSyncType::get_url(self, req, connectors)?) + .attach_default_headers() + .headers(types::RefundSyncType::get_headers(self, req, connectors)?) +- .set_body(types::RefundSyncType::get_request_body( +- self, req, connectors, +- )?) + .build(), + )) + } +@@ -519,9 +830,9 @@ impl ConnectorIntegration for Dwolla { + event_builder: Option<&mut ConnectorEvent>, + res: Response, + ) -> CustomResult { +- let response: dwolla::RefundResponse = res ++ let response: dwolla::DwollaRSyncResponse = res + .response +- .parse_struct("dwolla RefundSyncResponse") ++ .parse_struct("dwolla DwollaRSyncResponse") + .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; + event_builder.map(|i| i.set_response_body(&response)); + router_env::logger::info!(connector_response=?response); +@@ -543,26 +854,151 @@ impl ConnectorIntegration for Dwolla { + + #[async_trait::async_trait] + impl webhooks::IncomingWebhook for Dwolla { +- fn get_webhook_object_reference_id( ++ fn get_webhook_source_verification_algorithm( + &self, + _request: &webhooks::IncomingWebhookRequestDetails<'_>, ++ ) -> CustomResult, errors::ConnectorError> { ++ Ok(Box::new(crypto::HmacSha256)) ++ } ++ ++ fn get_webhook_source_verification_signature( ++ &self, ++ request: &webhooks::IncomingWebhookRequestDetails<'_>, ++ _secrets: &api_models::webhooks::ConnectorWebhookSecrets, ++ ) -> CustomResult, errors::ConnectorError> { ++ let sig = request ++ .headers ++ .get("X-Request-Signature-SHA-256") ++ .and_then(|hv| hv.to_str().ok()) ++ .ok_or(errors::ConnectorError::WebhookSignatureNotFound)?; ++ hex::decode(sig).map_err(|_| errors::ConnectorError::WebhookSignatureNotFound.into()) ++ } ++ ++ async fn verify_webhook_source( ++ &self, ++ request: &webhooks::IncomingWebhookRequestDetails<'_>, ++ merchant_id: &common_utils::id_type::MerchantId, ++ connector_webhook_details: Option, ++ _connector_account_details: crypto::Encryptable>, ++ connector_name: &str, ++ ) -> CustomResult { ++ let connector_webhook_secrets = self ++ .get_webhook_source_verification_merchant_secret( ++ merchant_id, ++ connector_name, ++ connector_webhook_details, ++ ) ++ .await?; ++ ++ let signature = self ++ .get_webhook_source_verification_signature(request, &connector_webhook_secrets) ++ .change_context(errors::ConnectorError::WebhookSignatureNotFound)?; ++ ++ let secret_bytes = connector_webhook_secrets.secret.as_ref(); ++ let key = hmac::Key::new(hmac::HMAC_SHA256, secret_bytes); ++ ++ let verify = hmac::verify(&key, request.body, &signature) ++ .map(|_| true) ++ .map_err(|_| errors::ConnectorError::WebhookSourceVerificationFailed)?; ++ Ok(verify) ++ } ++ ++ fn get_webhook_object_reference_id( ++ &self, ++ request: &webhooks::IncomingWebhookRequestDetails<'_>, + ) -> CustomResult { +- Err(report!(errors::ConnectorError::WebhooksNotImplemented)) ++ let details: dwolla::DwollaWebhookDetails = request ++ .body ++ .parse_struct("DwollaWebhookDetails") ++ .change_context(errors::ConnectorError::WebhookReferenceIdNotFound)?; ++ ++ if let Some(correlation_id) = &details.correlation_id { ++ if correlation_id.starts_with("refund_") { ++ Ok(api_models::webhooks::ObjectReferenceId::RefundId( ++ api_models::webhooks::RefundIdType::ConnectorRefundId( ++ details.resource_id.clone(), ++ ), ++ )) ++ } else if correlation_id.starts_with("payment_") { ++ Ok(api_models::webhooks::ObjectReferenceId::PaymentId( ++ api_models::payments::PaymentIdType::ConnectorTransactionId( ++ details.resource_id.clone(), ++ ), ++ )) ++ } else { ++ Err(report!(errors::ConnectorError::WebhookReferenceIdNotFound)) ++ } ++ } else { ++ Err(report!(errors::ConnectorError::WebhookReferenceIdNotFound)) ++ } + } + + fn get_webhook_event_type( + &self, +- _request: &webhooks::IncomingWebhookRequestDetails<'_>, ++ request: &webhooks::IncomingWebhookRequestDetails<'_>, + ) -> CustomResult { +- Err(report!(errors::ConnectorError::WebhooksNotImplemented)) ++ let details: dwolla::DwollaWebhookDetails = request ++ .body ++ .parse_struct("DwollaWebhookDetails") ++ .change_context(errors::ConnectorError::WebhookEventTypeNotFound)?; ++ ++ let incoming = api_models::webhooks::IncomingWebhookEvent::try_from(details)?; ++ Ok(incoming) + } + + fn get_webhook_resource_object( + &self, +- _request: &webhooks::IncomingWebhookRequestDetails<'_>, ++ request: &webhooks::IncomingWebhookRequestDetails<'_>, + ) -> CustomResult, errors::ConnectorError> { +- Err(report!(errors::ConnectorError::WebhooksNotImplemented)) ++ let details: dwolla::DwollaWebhookDetails = request ++ .body ++ .parse_struct("DwollaWebhookDetails") ++ .change_context(errors::ConnectorError::WebhookResourceObjectNotFound)?; ++ Ok(Box::new(details)) + } + } + +-impl ConnectorSpecifications for Dwolla {} ++static DWOLLA_SUPPORTED_PAYMENT_METHODS: LazyLock = LazyLock::new(|| { ++ let supported_capture_methods = vec![ ++ enums::CaptureMethod::Automatic, ++ enums::CaptureMethod::SequentialAutomatic, ++ ]; ++ ++ let mut dwolla_supported_payment_methods = SupportedPaymentMethods::new(); ++ ++ dwolla_supported_payment_methods.add( ++ enums::PaymentMethod::BankDebit, ++ enums::PaymentMethodType::Ach, ++ PaymentMethodDetails { ++ mandates: enums::FeatureStatus::NotSupported, ++ refunds: enums::FeatureStatus::Supported, ++ supported_capture_methods: supported_capture_methods.clone(), ++ specific_features: None, ++ }, ++ ); ++ ++ dwolla_supported_payment_methods ++}); ++ ++static DWOLLA_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { ++ display_name: "Dwolla", ++ description: "Dwolla is a multinational financial technology company offering financial services and software as a service (SaaS)", ++ connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++}; ++ ++static DWOLLA_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 2] = ++ [enums::EventClass::Payments, enums::EventClass::Refunds]; ++ ++impl ConnectorSpecifications for Dwolla { ++ fn get_connector_about(&self) -> Option<&'static ConnectorInfo> { ++ Some(&DWOLLA_CONNECTOR_INFO) ++ } ++ ++ fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> { ++ Some(&*DWOLLA_SUPPORTED_PAYMENT_METHODS) ++ } ++ ++ fn get_supported_webhook_flows(&self) -> Option<&'static [enums::EventClass]> { ++ Some(&DWOLLA_SUPPORTED_WEBHOOK_FLOWS) ++ } ++} +diff --git a/crates/hyperswitch_connectors/src/connectors/dwolla/transformers.rs b/crates/hyperswitch_connectors/src/connectors/dwolla/transformers.rs +index da79358d..bcb32027 100644 +--- a/crates/hyperswitch_connectors/src/connectors/dwolla/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/dwolla/transformers.rs +@@ -1,228 +1,601 @@ +-use common_enums::enums; +-use common_utils::types::StringMajorUnit; ++use common_enums::{enums, AttemptStatus}; ++use common_utils::{errors::CustomResult, types::StringMajorUnit}; ++use error_stack::{report, ResultExt}; + use hyperswitch_domain_models::{ +- payment_method_data::PaymentMethodData, +- router_data::{ConnectorAuthType, RouterData}, +- router_flow_types::refunds::{Execute, RSync}, ++ payment_method_data::{BankDebitData, PaymentMethodData}, ++ router_data::{AccessToken, ConnectorAuthType, PaymentMethodToken, RouterData}, ++ router_flow_types::refunds::RSync, + router_request_types::ResponseId, + router_response_types::{PaymentsResponseData, RefundsResponseData}, ++ types, + types::{PaymentsAuthorizeRouterData, RefundsRouterData}, + }; + use hyperswitch_interfaces::errors; +-use masking::Secret; ++use masking::{ExposeInterface, Secret}; + use serde::{Deserialize, Serialize}; + + use crate::{ + types::{RefundsResponseRouterData, ResponseRouterData}, +- utils::PaymentsAuthorizeRequestData, ++ utils::{self, CustomerData, RouterData as _}, + }; + +-//TODO: Fill the struct with respective fields +-pub struct DwollaRouterData { +- pub amount: StringMajorUnit, // The type of amount that a connector accepts, for example, String, i64, f64, etc. +- pub router_data: T, ++pub struct DwollaAuthType { ++ pub(super) client_id: Secret, ++ pub(super) client_secret: Secret, + } + +-impl From<(StringMajorUnit, T)> for DwollaRouterData { +- fn from((amount, item): (StringMajorUnit, T)) -> Self { +- //Todo : use utils to convert the amount to the type of amount that a connector accepts +- Self { +- amount, +- router_data: item, ++impl TryFrom<&ConnectorAuthType> for DwollaAuthType { ++ type Error = error_stack::Report; ++ fn try_from(auth_type: &ConnectorAuthType) -> Result { ++ match auth_type { ++ ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self { ++ client_id: api_key.to_owned(), ++ client_secret: key1.to_owned(), ++ }), ++ _ => Err(errors::ConnectorError::FailedToObtainAuthType.into()), + } + } + } + +-//TODO: Fill the struct with respective fields + #[derive(Default, Debug, Serialize, PartialEq)] +-pub struct DwollaPaymentsRequest { +- amount: StringMajorUnit, +- card: DwollaCard, ++pub struct DwollaAccessTokenRequest { ++ pub grant_type: String, + } + +-#[derive(Default, Debug, Serialize, Eq, PartialEq)] +-pub struct DwollaCard { +- number: cards::CardNumber, +- expiry_month: Secret, +- expiry_year: Secret, +- cvc: Secret, +- complete: bool, ++#[derive(Default, Debug, Clone, Deserialize, PartialEq, Serialize)] ++pub struct DwollaAccessTokenResponse { ++ access_token: Secret, ++ expires_in: i64, ++ token_type: String, + } + +-impl TryFrom<&DwollaRouterData<&PaymentsAuthorizeRouterData>> for DwollaPaymentsRequest { +- type Error = error_stack::Report; +- fn try_from( +- item: &DwollaRouterData<&PaymentsAuthorizeRouterData>, +- ) -> Result { +- match item.router_data.request.payment_method_data.clone() { +- PaymentMethodData::Card(req_card) => { +- let card = DwollaCard { +- number: req_card.card_number, +- expiry_month: req_card.card_exp_month, +- expiry_year: req_card.card_exp_year, +- cvc: req_card.card_cvc, +- complete: item.router_data.request.is_auto_capture()?, +- }; +- Ok(Self { +- amount: item.amount.clone(), +- card, +- }) +- } +- _ => Err(errors::ConnectorError::NotImplemented("Payment method".to_string()).into()), +- } +- } +-} ++pub fn extract_token_from_body(body: &[u8]) -> CustomResult { ++ let parsed: serde_json::Value = serde_json::from_slice(body) ++ .map_err(|_| report!(errors::ConnectorError::ResponseDeserializationFailed))?; + +-//TODO: Fill the struct with respective fields +-// Auth Struct +-pub struct DwollaAuthType { +- pub(super) api_key: Secret, ++ parsed ++ .get("_links") ++ .and_then(|links| links.get("about")) ++ .and_then(|about| about.get("href")) ++ .and_then(|href| href.as_str()) ++ .and_then(|url| url.rsplit('/').next()) ++ .map(|id| id.to_string()) ++ .ok_or_else(|| report!(errors::ConnectorError::ResponseHandlingFailed)) + } + +-impl TryFrom<&ConnectorAuthType> for DwollaAuthType { +- type Error = error_stack::Report; +- fn try_from(auth_type: &ConnectorAuthType) -> Result { +- match auth_type { +- ConnectorAuthType::HeaderKey { api_key } => Ok(Self { +- api_key: api_key.to_owned(), +- }), +- _ => Err(errors::ConnectorError::FailedToObtainAuthType.into()), ++fn map_topic_to_status(topic: &str) -> DwollaPaymentStatus { ++ match topic { ++ "customer_transfer_created" | "customer_bank_transfer_created" => { ++ DwollaPaymentStatus::Pending + } +- } +-} +-// PaymentsResponse +-//TODO: Append the remaining status flags +-#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)] +-#[serde(rename_all = "lowercase")] +-pub enum DwollaPaymentStatus { +- Succeeded, +- Failed, +- #[default] +- Processing, +-} +- +-impl From for common_enums::AttemptStatus { +- fn from(item: DwollaPaymentStatus) -> Self { +- match item { +- DwollaPaymentStatus::Succeeded => Self::Charged, +- DwollaPaymentStatus::Failed => Self::Failure, +- DwollaPaymentStatus::Processing => Self::Authorizing, ++ "customer_transfer_completed" | "customer_bank_transfer_completed" => { ++ DwollaPaymentStatus::Succeeded + } ++ "customer_transfer_failed" | "customer_bank_transfer_failed" => DwollaPaymentStatus::Failed, ++ _ => DwollaPaymentStatus::Pending, + } + } + +-//TODO: Fill the struct with respective fields +-#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)] +-pub struct DwollaPaymentsResponse { +- status: DwollaPaymentStatus, +- id: String, +-} +- +-impl TryFrom> +- for RouterData ++impl TryFrom> ++ for RouterData + { + type Error = error_stack::Report; + fn try_from( +- item: ResponseRouterData, ++ item: ResponseRouterData, + ) -> Result { + Ok(Self { +- status: common_enums::AttemptStatus::from(item.response.status), +- response: Ok(PaymentsResponseData::TransactionResponse { +- resource_id: ResponseId::ConnectorTransactionId(item.response.id), +- redirection_data: Box::new(None), +- mandate_reference: Box::new(None), +- connector_metadata: None, +- network_txn_id: None, +- connector_response_reference_id: None, +- incremental_authorization_allowed: None, +- charges: None, ++ response: Ok(AccessToken { ++ token: item.response.access_token, ++ expires: item.response.expires_in, + }), + ..item.data + }) + } + } + +-//TODO: Fill the struct with respective fields +-// REFUND : +-// Type definition for RefundRequest +-#[derive(Default, Debug, Serialize)] +-pub struct DwollaRefundRequest { ++#[derive(Debug)] ++pub struct DwollaRouterData<'a, T> { + pub amount: StringMajorUnit, ++ pub router_data: T, ++ pub base_url: &'a str, + } + +-impl TryFrom<&DwollaRouterData<&RefundsRouterData>> for DwollaRefundRequest { ++impl<'a, T> TryFrom<(StringMajorUnit, T, &'a str)> for DwollaRouterData<'a, T> { + type Error = error_stack::Report; +- fn try_from(item: &DwollaRouterData<&RefundsRouterData>) -> Result { ++ fn try_from( ++ (amount, router_data, base_url): (StringMajorUnit, T, &'a str), ++ ) -> Result { + Ok(Self { +- amount: item.amount.to_owned(), ++ amount, ++ router_data, ++ base_url, + }) + } + } + +-// Type definition for Refund Response ++#[derive(Default, Debug, Serialize, PartialEq)] ++#[serde(rename_all = "camelCase")] ++pub struct DwollaCustomerRequest { ++ first_name: Secret, ++ last_name: Secret, ++ email: common_utils::pii::Email, ++} ++ ++#[derive(Default, Debug, Serialize, Deserialize, PartialEq)] ++pub struct DwollaCustomerResponse {} + +-#[allow(dead_code)] +-#[derive(Debug, Serialize, Default, Deserialize, Clone)] +-pub enum RefundStatus { +- Succeeded, +- Failed, +- #[default] +- Processing, ++#[derive(Default, Debug, Serialize, Deserialize, PartialEq)] ++pub struct DwollaFundingSourceResponse {} ++ ++#[derive(Debug, Serialize)] ++#[serde(rename_all = "camelCase")] ++pub struct DwollaFundingSourceRequest { ++ routing_number: Secret, ++ account_number: Secret, ++ #[serde(rename = "type")] ++ account_type: common_enums::BankType, ++ name: Secret, + } + +-impl From for enums::RefundStatus { +- fn from(item: RefundStatus) -> Self { +- match item { +- RefundStatus::Succeeded => Self::Success, +- RefundStatus::Failed => Self::Failure, +- RefundStatus::Processing => Self::Pending, +- //TODO: Review mapping ++#[derive(Debug, Serialize, PartialEq, Deserialize, Clone)] ++#[serde(rename_all = "camelCase")] ++pub struct DwollaPaymentsRequest { ++ #[serde(rename = "_links")] ++ links: DwollaPaymentLinks, ++ amount: DwollaAmount, ++ correlation_id: String, ++} ++ ++#[derive(Default, Debug, Serialize, PartialEq, Deserialize, Clone)] ++pub struct DwollaPaymentLinks { ++ source: DwollaRequestLink, ++ destination: DwollaRequestLink, ++} ++ ++#[derive(Default, Debug, Serialize, PartialEq, Deserialize, Clone)] ++pub struct DwollaRequestLink { ++ href: String, ++} ++ ++#[derive(Debug, Serialize, PartialEq, Deserialize, Clone)] ++pub struct DwollaAmount { ++ pub currency: common_enums::Currency, ++ pub value: StringMajorUnit, ++} ++ ++#[derive(Debug, Serialize, PartialEq, Deserialize, Clone)] ++#[serde(untagged)] ++pub enum DwollaPSyncResponse { ++ Payment(DwollaPaymentSyncResponse), ++ Webhook(DwollaWebhookDetails), ++} ++ ++#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)] ++pub struct DwollaPaymentSyncResponse { ++ pub id: String, ++ pub status: DwollaPaymentStatus, ++ pub amount: DwollaAmount, ++} ++ ++#[derive(Debug, Serialize, PartialEq, Deserialize, Clone)] ++#[serde(untagged)] ++pub enum DwollaRSyncResponse { ++ Payment(DwollaRefundSyncResponse), ++ Webhook(DwollaWebhookDetails), ++} ++ ++#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)] ++pub struct DwollaRefundSyncResponse { ++ id: String, ++ status: DwollaPaymentStatus, ++ amount: DwollaAmount, ++} ++ ++#[derive(Serialize, Deserialize, Debug)] ++pub struct DwollaMetaData { ++ pub merchant_funding_source: Secret, ++} ++ ++#[derive(Debug, Serialize, PartialEq, Deserialize, Clone)] ++#[serde(rename_all = "camelCase")] ++pub struct DwollaRefundsRequest { ++ #[serde(rename = "_links")] ++ links: DwollaPaymentLinks, ++ amount: DwollaAmount, ++ correlation_id: String, ++} ++ ++impl TryFrom<&types::ConnectorCustomerRouterData> for DwollaCustomerRequest { ++ type Error = error_stack::Report; ++ fn try_from(item: &types::ConnectorCustomerRouterData) -> Result { ++ Ok(Self { ++ first_name: item.get_billing_first_name()?, ++ last_name: item.get_billing_last_name()?, ++ email: item ++ .request ++ .get_email() ++ .or_else(|_| item.get_billing_email())?, ++ }) ++ } ++} ++ ++impl TryFrom<&types::TokenizationRouterData> for DwollaFundingSourceRequest { ++ type Error = error_stack::Report; ++ fn try_from(item: &types::TokenizationRouterData) -> Result { ++ match item.request.payment_method_data.clone() { ++ PaymentMethodData::BankDebit(BankDebitData::AchBankDebit { ++ ref routing_number, ++ ref account_number, ++ ref bank_type, ++ ref bank_account_holder_name, ++ .. ++ }) => { ++ let account_type = ++ (*bank_type).ok_or_else(|| errors::ConnectorError::MissingRequiredField { ++ field_name: "bank_type", ++ })?; ++ ++ let name = bank_account_holder_name.clone().ok_or_else(|| { ++ errors::ConnectorError::MissingRequiredField { ++ field_name: "bank_account_holder_name", ++ } ++ })?; ++ ++ let request = Self { ++ routing_number: routing_number.clone(), ++ account_number: account_number.clone(), ++ account_type, ++ name, ++ }; ++ Ok(request) ++ } ++ _ => Err(errors::ConnectorError::NotImplemented( ++ utils::get_unimplemented_payment_method_error_message("dwolla"), ++ ))?, + } + } + } + +-//TODO: Fill the struct with respective fields +-#[derive(Default, Debug, Clone, Serialize, Deserialize)] +-pub struct RefundResponse { +- id: String, +- status: RefundStatus, ++impl<'a> TryFrom<&DwollaRouterData<'a, &PaymentsAuthorizeRouterData>> for DwollaPaymentsRequest { ++ type Error = error_stack::Report; ++ fn try_from( ++ item: &DwollaRouterData<'a, &PaymentsAuthorizeRouterData>, ++ ) -> Result { ++ let source_funding = match item.router_data.get_payment_method_token().ok() { ++ Some(PaymentMethodToken::Token(pm_token)) => pm_token, ++ _ => { ++ return Err(report!(errors::ConnectorError::MissingRequiredField { ++ field_name: "payment_method_token", ++ })) ++ } ++ }; ++ ++ let metadata = utils::to_connector_meta_from_secret::( ++ item.router_data.connector_meta_data.clone(), ++ ) ++ .change_context(errors::ConnectorError::InvalidConnectorConfig { config: "metadata" })?; ++ ++ let source_url = format!( ++ "{}/funding-sources/{}", ++ item.base_url, ++ source_funding.expose() ++ ); ++ ++ let destination_url = format!( ++ "{}/funding-sources/{}", ++ item.base_url, ++ metadata.merchant_funding_source.expose() ++ ); ++ ++ let request = Self { ++ links: DwollaPaymentLinks { ++ source: DwollaRequestLink { href: source_url }, ++ destination: DwollaRequestLink { ++ href: destination_url, ++ }, ++ }, ++ amount: DwollaAmount { ++ currency: item.router_data.request.currency, ++ value: item.amount.to_owned(), ++ }, ++ correlation_id: format!( ++ "payment_{}", ++ item.router_data.connector_request_reference_id ++ ), ++ }; ++ ++ Ok(request) ++ } + } + +-impl TryFrom> for RefundsRouterData { ++impl TryFrom> ++ for RouterData ++{ + type Error = error_stack::Report; + fn try_from( +- item: RefundsResponseRouterData, ++ item: ResponseRouterData, + ) -> Result { +- Ok(Self { +- response: Ok(RefundsResponseData { +- connector_refund_id: item.response.id.to_string(), +- refund_status: enums::RefundStatus::from(item.response.status), +- }), +- ..item.data +- }) ++ let connector_metadata = ++ item.data ++ .payment_method_token ++ .as_ref() ++ .and_then(|token| match token { ++ PaymentMethodToken::Token(t) => { ++ Some(serde_json::json!({ "payment_token": t.clone().expose() })) ++ } ++ _ => None, ++ }); ++ match item.response { ++ DwollaPSyncResponse::Payment(payment_response) => { ++ let payment_id = payment_response.id.clone(); ++ let status = payment_response.status; ++ Ok(Self { ++ response: Ok(PaymentsResponseData::TransactionResponse { ++ resource_id: ResponseId::ConnectorTransactionId(payment_id.clone()), ++ redirection_data: Box::new(None), ++ mandate_reference: Box::new(None), ++ connector_metadata, ++ network_txn_id: None, ++ connector_response_reference_id: Some(payment_id.clone()), ++ incremental_authorization_allowed: None, ++ charges: None, ++ }), ++ status: AttemptStatus::from(status), ++ ..item.data ++ }) ++ } ++ DwollaPSyncResponse::Webhook(webhook_response) => { ++ let payment_id = webhook_response.resource_id.clone(); ++ ++ Ok(Self { ++ response: Ok(PaymentsResponseData::TransactionResponse { ++ resource_id: ResponseId::ConnectorTransactionId(payment_id.clone()), ++ redirection_data: Box::new(None), ++ mandate_reference: Box::new(None), ++ connector_metadata, ++ network_txn_id: None, ++ connector_response_reference_id: Some(payment_id.clone()), ++ incremental_authorization_allowed: None, ++ charges: None, ++ }), ++ status: AttemptStatus::from(map_topic_to_status( ++ webhook_response.topic.as_str(), ++ )), ++ ..item.data ++ }) ++ } ++ } ++ } ++} ++ ++impl<'a, F> TryFrom<&DwollaRouterData<'a, &RefundsRouterData>> for DwollaRefundsRequest { ++ type Error = error_stack::Report; ++ fn try_from(item: &DwollaRouterData<'a, &RefundsRouterData>) -> Result { ++ let destination_funding = item ++ .router_data ++ .request ++ .connector_metadata ++ .as_ref() ++ .and_then(|meta| { ++ meta.get("payment_token") ++ .and_then(|token| token.as_str().map(|s| s.to_string())) ++ }) ++ .ok_or_else(|| errors::ConnectorError::MissingRequiredField { ++ field_name: "payment_token", ++ })?; ++ ++ let metadata = utils::to_connector_meta_from_secret::( ++ item.router_data.connector_meta_data.clone(), ++ ) ++ .change_context(errors::ConnectorError::InvalidConnectorConfig { config: "metadata" })?; ++ ++ let source_url = format!( ++ "{}/funding-sources/{}", ++ item.base_url, ++ metadata.merchant_funding_source.expose() ++ ); ++ ++ let destination_url = format!("{}/funding-sources/{}", item.base_url, destination_funding); ++ ++ let request = Self { ++ links: DwollaPaymentLinks { ++ source: DwollaRequestLink { href: source_url }, ++ destination: DwollaRequestLink { ++ href: destination_url, ++ }, ++ }, ++ amount: DwollaAmount { ++ currency: item.router_data.request.currency, ++ value: item.amount.to_owned(), ++ }, ++ correlation_id: format!("refund_{}", item.router_data.connector_request_reference_id), ++ }; ++ ++ Ok(request) + } + } + +-impl TryFrom> for RefundsRouterData { ++impl TryFrom> for RefundsRouterData { + type Error = error_stack::Report; + fn try_from( +- item: RefundsResponseRouterData, ++ item: RefundsResponseRouterData, + ) -> Result { +- Ok(Self { +- response: Ok(RefundsResponseData { +- connector_refund_id: item.response.id.to_string(), +- refund_status: enums::RefundStatus::from(item.response.status), +- }), +- ..item.data +- }) ++ match item.response { ++ DwollaRSyncResponse::Payment(refund_response) => { ++ let refund_id = refund_response.id.clone(); ++ let status = refund_response.status; ++ Ok(Self { ++ response: Ok(RefundsResponseData { ++ connector_refund_id: refund_id, ++ refund_status: enums::RefundStatus::from(status), ++ }), ++ ..item.data ++ }) ++ } ++ DwollaRSyncResponse::Webhook(webhook_response) => { ++ let refund_id = webhook_response.resource_id.clone(); ++ let status = map_topic_to_status(webhook_response.topic.as_str()); ++ Ok(Self { ++ response: Ok(RefundsResponseData { ++ connector_refund_id: refund_id, ++ refund_status: enums::RefundStatus::from(status), ++ }), ++ ..item.data ++ }) ++ } ++ } ++ } ++} ++ ++#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)] ++#[serde(rename_all = "lowercase")] ++pub enum DwollaPaymentStatus { ++ Succeeded, ++ Failed, ++ Pending, ++ #[default] ++ Processing, ++ Processed, ++} ++ ++impl From for AttemptStatus { ++ fn from(item: DwollaPaymentStatus) -> Self { ++ match item { ++ DwollaPaymentStatus::Succeeded => Self::Charged, ++ DwollaPaymentStatus::Processed => Self::Charged, ++ DwollaPaymentStatus::Failed => Self::Failure, ++ DwollaPaymentStatus::Processing => Self::Pending, ++ DwollaPaymentStatus::Pending => Self::Pending, ++ } ++ } ++} ++ ++impl From for enums::RefundStatus { ++ fn from(item: DwollaPaymentStatus) -> Self { ++ match item { ++ DwollaPaymentStatus::Succeeded => Self::Success, ++ DwollaPaymentStatus::Processed => Self::Success, ++ DwollaPaymentStatus::Failed => Self::Failure, ++ DwollaPaymentStatus::Processing => Self::Pending, ++ DwollaPaymentStatus::Pending => Self::Pending, ++ } + } + } + +-//TODO: Fill the struct with respective fields + #[derive(Default, Debug, Serialize, Deserialize, PartialEq)] + pub struct DwollaErrorResponse { +- pub status_code: u16, + pub code: String, + pub message: String, ++ pub _embedded: Option>, + pub reason: Option, + } ++ ++#[derive(Default, Debug, Serialize, Deserialize, PartialEq)] ++pub struct DwollaErrorDetails { ++ pub errors: Vec, ++} ++#[derive(Default, Debug, Serialize, Deserialize, PartialEq)] ++pub struct DwollaErrorDetail { ++ pub code: Option, ++ pub message: Option, ++} ++ ++#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] ++#[serde(rename_all = "camelCase")] ++pub struct DwollaWebhookDetails { ++ pub id: String, ++ pub resource_id: String, ++ pub topic: String, ++ pub correlation_id: Option, ++} ++ ++impl From<&str> for DwollaWebhookEventType { ++ fn from(topic: &str) -> Self { ++ match topic { ++ "customer_created" => Self::CustomerCreated, ++ "customer_verified" => Self::CustomerVerified, ++ "customer_funding_source_added" => Self::CustomerFundingSourceAdded, ++ "customer_funding_source_removed" => Self::CustomerFundingSourceRemoved, ++ "customer_funding_source_verified" => Self::CustomerFundingSourceVerified, ++ "customer_funding_source_unverified" => Self::CustomerFundingSourceUnverified, ++ "customer_microdeposits_added" => Self::CustomerMicrodepositsAdded, ++ "customer_microdeposits_failed" => Self::CustomerMicrodepositsFailed, ++ "customer_microdeposits_completed" => Self::CustomerMicrodepositsCompleted, ++ "customer_microdeposits_maxattempts" => Self::CustomerMicrodepositsMaxAttempts, ++ "customer_bank_transfer_creation_failed" => Self::CustomerBankTransferCreationFailed, ++ "customer_bank_transfer_created" => Self::CustomerBankTransferCreated, ++ "customer_transfer_created" => Self::CustomerTransferCreated, ++ "customer_bank_transfer_failed" => Self::CustomerBankTransferFailed, ++ "customer_bank_transfer_completed" => Self::CustomerBankTransferCompleted, ++ "customer_transfer_completed" => Self::CustomerTransferCompleted, ++ "customer_transfer_failed" => Self::CustomerTransferFailed, ++ "transfer_created" => Self::TransferCreated, ++ "transfer_pending" => Self::TransferPending, ++ "transfer_completed" => Self::TransferCompleted, ++ "transfer_failed" => Self::TransferFailed, ++ _ => Self::Unknown, ++ } ++ } ++} ++ ++#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] ++#[serde(rename_all = "kebab-case")] ++pub enum DwollaWebhookEventType { ++ CustomerCreated, ++ CustomerVerified, ++ CustomerFundingSourceAdded, ++ CustomerFundingSourceRemoved, ++ CustomerFundingSourceUnverified, ++ CustomerFundingSourceVerified, ++ CustomerMicrodepositsAdded, ++ CustomerMicrodepositsFailed, ++ CustomerMicrodepositsCompleted, ++ CustomerMicrodepositsMaxAttempts, ++ CustomerTransferCreated, ++ CustomerBankTransferCreationFailed, ++ CustomerBankTransferCreated, ++ CustomerBankTransferCompleted, ++ CustomerBankTransferFailed, ++ CustomerTransferCompleted, ++ CustomerTransferFailed, ++ TransferCreated, ++ TransferPending, ++ TransferCompleted, ++ TransferFailed, ++ #[serde(other)] ++ Unknown, ++} ++ ++impl TryFrom for api_models::webhooks::IncomingWebhookEvent { ++ type Error = errors::ConnectorError; ++ fn try_from(details: DwollaWebhookDetails) -> Result { ++ let correlation_id = match details.correlation_id.as_deref() { ++ Some(cid) => cid, ++ None => { ++ return Ok(Self::EventNotSupported); ++ } ++ }; ++ let event_type = DwollaWebhookEventType::from(details.topic.as_str()); ++ let is_refund = correlation_id.starts_with("refund_"); ++ Ok(match (event_type, is_refund) { ++ (DwollaWebhookEventType::CustomerTransferCompleted, true) ++ | (DwollaWebhookEventType::CustomerBankTransferCompleted, true) => Self::RefundSuccess, ++ (DwollaWebhookEventType::CustomerTransferFailed, true) ++ | (DwollaWebhookEventType::CustomerBankTransferFailed, true) => Self::RefundFailure, ++ ++ (DwollaWebhookEventType::CustomerTransferCreated, false) ++ | (DwollaWebhookEventType::CustomerBankTransferCreated, false) => { ++ Self::PaymentIntentProcessing ++ } ++ (DwollaWebhookEventType::CustomerTransferCompleted, false) ++ | (DwollaWebhookEventType::CustomerBankTransferCompleted, false) => { ++ Self::PaymentIntentSuccess ++ } ++ (DwollaWebhookEventType::CustomerTransferFailed, false) ++ | (DwollaWebhookEventType::CustomerBankTransferFailed, false) => { ++ Self::PaymentIntentFailure ++ } ++ _ => Self::EventNotSupported, ++ }) ++ } ++} +diff --git a/crates/hyperswitch_connectors/src/connectors/ebanx.rs b/crates/hyperswitch_connectors/src/connectors/ebanx.rs +index 49d5c186..f0727a2c 100644 +--- a/crates/hyperswitch_connectors/src/connectors/ebanx.rs ++++ b/crates/hyperswitch_connectors/src/connectors/ebanx.rs +@@ -149,6 +149,7 @@ impl ConnectorCommon for Ebanx { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/elavon/transformers.rs b/crates/hyperswitch_connectors/src/connectors/elavon/transformers.rs +index ead6d039..cd7a3e4c 100644 +--- a/crates/hyperswitch_connectors/src/connectors/elavon/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/elavon/transformers.rs +@@ -285,6 +285,7 @@ impl + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }), + ElavonResult::Success(response) => { + if status == enums::AttemptStatus::Failure { +@@ -298,6 +299,7 @@ impl + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } else { + Ok(PaymentsResponseData::TransactionResponse { +@@ -508,6 +510,7 @@ impl TryFrom> + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }), + ElavonResult::Success(response) => { + if status == enums::AttemptStatus::Failure { +@@ -521,6 +524,7 @@ impl TryFrom> + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } else { + Ok(PaymentsResponseData::TransactionResponse { +@@ -567,6 +571,7 @@ impl TryFrom> + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }), + ElavonResult::Success(response) => { + if status == enums::RefundStatus::Failure { +@@ -580,6 +585,7 @@ impl TryFrom> + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } else { + Ok(RefundsResponseData { +diff --git a/crates/hyperswitch_connectors/src/connectors/facilitapay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/facilitapay/transformers.rs +index d0e186cf..3d8c57fb 100644 +--- a/crates/hyperswitch_connectors/src/connectors/facilitapay/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/facilitapay/transformers.rs +@@ -270,6 +270,7 @@ pub fn parse_facilitapay_error_response( + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + +@@ -442,6 +443,7 @@ impl TryFrom Ok(ErrorResponse { +@@ -255,6 +256,7 @@ impl ConnectorCommon for Fiservemea { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }), + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/fiuu.rs b/crates/hyperswitch_connectors/src/connectors/fiuu.rs +index 1c6337e1..50dde63f 100644 +--- a/crates/hyperswitch_connectors/src/connectors/fiuu.rs ++++ b/crates/hyperswitch_connectors/src/connectors/fiuu.rs +@@ -242,6 +242,7 @@ impl ConnectorCommon for Fiuu { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs b/crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs +index 16c1be11..992d5415 100644 +--- a/crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs +@@ -903,6 +903,7 @@ impl + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }), + ..item.data + }), +@@ -976,6 +977,7 @@ impl + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } else { + Ok(PaymentsResponseData::TransactionResponse { +@@ -1025,6 +1027,7 @@ impl + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } else { + Ok(PaymentsResponseData::TransactionResponse { +@@ -1161,6 +1164,7 @@ impl TryFrom> + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }), + ..item.data + }), +@@ -1188,6 +1192,7 @@ impl TryFrom> + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }), + ..item.data + }) +@@ -1389,6 +1394,7 @@ impl TryFrom> for PaymentsSy + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } else { + None +@@ -1456,6 +1462,7 @@ impl TryFrom> for PaymentsSy + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } else { + None +@@ -1626,6 +1633,7 @@ impl TryFrom> + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } else { + None +@@ -1741,6 +1749,7 @@ impl TryFrom> + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } else { + None +@@ -1839,6 +1848,7 @@ impl TryFrom> + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }), + ..item.data + }), +diff --git a/crates/hyperswitch_connectors/src/connectors/flexiti.rs b/crates/hyperswitch_connectors/src/connectors/flexiti.rs +index b14094ca..7516cfad 100644 +--- a/crates/hyperswitch_connectors/src/connectors/flexiti.rs ++++ b/crates/hyperswitch_connectors/src/connectors/flexiti.rs +@@ -164,6 +164,7 @@ impl ConnectorCommon for Flexiti { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/forte.rs b/crates/hyperswitch_connectors/src/connectors/forte.rs +index 1d8410ff..f190ab82 100644 +--- a/crates/hyperswitch_connectors/src/connectors/forte.rs ++++ b/crates/hyperswitch_connectors/src/connectors/forte.rs +@@ -170,6 +170,7 @@ impl ConnectorCommon for Forte { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/getnet.rs b/crates/hyperswitch_connectors/src/connectors/getnet.rs +index 12c59f92..bf5bd83c 100644 +--- a/crates/hyperswitch_connectors/src/connectors/getnet.rs ++++ b/crates/hyperswitch_connectors/src/connectors/getnet.rs +@@ -163,6 +163,7 @@ impl ConnectorCommon for Getnet { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/globalpay.rs b/crates/hyperswitch_connectors/src/connectors/globalpay.rs +index 215c8322..29d033c3 100644 +--- a/crates/hyperswitch_connectors/src/connectors/globalpay.rs ++++ b/crates/hyperswitch_connectors/src/connectors/globalpay.rs +@@ -156,6 +156,7 @@ impl ConnectorCommon for Globalpay { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +@@ -371,6 +372,7 @@ impl ConnectorIntegration + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/globalpay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/globalpay/transformers.rs +index e4239d28..690abe05 100644 +--- a/crates/hyperswitch_connectors/src/connectors/globalpay/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/globalpay/transformers.rs +@@ -434,6 +434,7 @@ impl TryFrom Ok(PaymentsResponseData::TransactionResponse { + resource_id: ResponseId::ConnectorTransactionId(item.response.id.clone()), +diff --git a/crates/hyperswitch_connectors/src/connectors/globepay.rs b/crates/hyperswitch_connectors/src/connectors/globepay.rs +index 0f7d4d02..0e19e686 100644 +--- a/crates/hyperswitch_connectors/src/connectors/globepay.rs ++++ b/crates/hyperswitch_connectors/src/connectors/globepay.rs +@@ -162,6 +162,7 @@ impl ConnectorCommon for Globepay { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/globepay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/globepay/transformers.rs +index eafb54d8..af27e27b 100644 +--- a/crates/hyperswitch_connectors/src/connectors/globepay/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/globepay/transformers.rs +@@ -332,6 +332,7 @@ fn get_error_response( + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + } + } + +diff --git a/crates/hyperswitch_connectors/src/connectors/gocardless.rs b/crates/hyperswitch_connectors/src/connectors/gocardless.rs +index 806e2395..f0dd07cf 100644 +--- a/crates/hyperswitch_connectors/src/connectors/gocardless.rs ++++ b/crates/hyperswitch_connectors/src/connectors/gocardless.rs +@@ -170,6 +170,7 @@ impl ConnectorCommon for Gocardless { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/gpayments.rs b/crates/hyperswitch_connectors/src/connectors/gpayments.rs +index 945852cf..4db7eace 100644 +--- a/crates/hyperswitch_connectors/src/connectors/gpayments.rs ++++ b/crates/hyperswitch_connectors/src/connectors/gpayments.rs +@@ -161,6 +161,7 @@ impl ConnectorCommon for Gpayments { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/helcim.rs b/crates/hyperswitch_connectors/src/connectors/helcim.rs +index 4845b2cb..bfa78cfd 100644 +--- a/crates/hyperswitch_connectors/src/connectors/helcim.rs ++++ b/crates/hyperswitch_connectors/src/connectors/helcim.rs +@@ -188,6 +188,7 @@ impl ConnectorCommon for Helcim { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/hipay.rs b/crates/hyperswitch_connectors/src/connectors/hipay.rs +index c0d02156..dc3aba65 100644 +--- a/crates/hyperswitch_connectors/src/connectors/hipay.rs ++++ b/crates/hyperswitch_connectors/src/connectors/hipay.rs +@@ -252,6 +252,7 @@ impl ConnectorCommon for Hipay { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/hipay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/hipay/transformers.rs +index a967eefb..a3058275 100644 +--- a/crates/hyperswitch_connectors/src/connectors/hipay/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/hipay/transformers.rs +@@ -375,6 +375,7 @@ impl + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } else { + Ok(PaymentsResponseData::TransactionResponse { +@@ -727,6 +728,7 @@ impl TryFrom> for PaymentsSync + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }); + Ok(Self { + status: enums::AttemptStatus::Failure, +@@ -754,6 +756,7 @@ impl TryFrom> for PaymentsSync + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } else { + Ok(PaymentsResponseData::TransactionResponse { +diff --git a/crates/hyperswitch_connectors/src/connectors/hyperswitch_vault.rs b/crates/hyperswitch_connectors/src/connectors/hyperswitch_vault.rs +index e6007d1e..6fd91612 100644 +--- a/crates/hyperswitch_connectors/src/connectors/hyperswitch_vault.rs ++++ b/crates/hyperswitch_connectors/src/connectors/hyperswitch_vault.rs +@@ -243,6 +243,7 @@ impl ConnectorCommon for HyperswitchVault { + network_decline_code: None, + network_advice_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/hyperwallet.rs b/crates/hyperswitch_connectors/src/connectors/hyperwallet.rs +index 88ff4353..55485d57 100644 +--- a/crates/hyperswitch_connectors/src/connectors/hyperwallet.rs ++++ b/crates/hyperswitch_connectors/src/connectors/hyperwallet.rs +@@ -150,6 +150,7 @@ impl ConnectorCommon for Hyperwallet { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/iatapay.rs b/crates/hyperswitch_connectors/src/connectors/iatapay.rs +index b22c8666..70dddc7c 100644 +--- a/crates/hyperswitch_connectors/src/connectors/iatapay.rs ++++ b/crates/hyperswitch_connectors/src/connectors/iatapay.rs +@@ -158,6 +158,7 @@ impl ConnectorCommon for Iatapay { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + } + } else { + let response: iatapay::IatapayErrorResponse = res +@@ -177,6 +178,7 @@ impl ConnectorCommon for Iatapay { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + } + }; + Ok(response_error_message) +@@ -297,6 +299,7 @@ impl ConnectorIntegration + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/iatapay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/iatapay/transformers.rs +index 6f327c22..2e59a22b 100644 +--- a/crates/hyperswitch_connectors/src/connectors/iatapay/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/iatapay/transformers.rs +@@ -346,6 +346,7 @@ fn get_iatpay_response( + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } else { + None +@@ -533,6 +534,7 @@ impl TryFrom> for RefundsRout + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } else { + Ok(RefundsResponseData { +@@ -572,6 +574,7 @@ impl TryFrom> for RefundsRouter + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } else { + Ok(RefundsResponseData { +diff --git a/crates/hyperswitch_connectors/src/connectors/inespay.rs b/crates/hyperswitch_connectors/src/connectors/inespay.rs +index 9629614f..9d655c16 100644 +--- a/crates/hyperswitch_connectors/src/connectors/inespay.rs ++++ b/crates/hyperswitch_connectors/src/connectors/inespay.rs +@@ -160,6 +160,7 @@ impl ConnectorCommon for Inespay { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/inespay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/inespay/transformers.rs +index 82152adf..c3083758 100644 +--- a/crates/hyperswitch_connectors/src/connectors/inespay/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/inespay/transformers.rs +@@ -145,6 +145,7 @@ impl TryFrom TryFrom> + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }), + ..item.data + }), +@@ -415,6 +418,7 @@ impl TryFrom> for Refunds + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }), + }; + Ok(Self { +diff --git a/crates/hyperswitch_connectors/src/connectors/itaubank.rs b/crates/hyperswitch_connectors/src/connectors/itaubank.rs +index 0b6dd440..b259a890 100644 +--- a/crates/hyperswitch_connectors/src/connectors/itaubank.rs ++++ b/crates/hyperswitch_connectors/src/connectors/itaubank.rs +@@ -182,6 +182,7 @@ impl ConnectorCommon for Itaubank { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +@@ -305,6 +306,7 @@ impl ConnectorIntegration + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/jpmorgan.rs b/crates/hyperswitch_connectors/src/connectors/jpmorgan.rs +index 7577154f..a9c26f6a 100644 +--- a/crates/hyperswitch_connectors/src/connectors/jpmorgan.rs ++++ b/crates/hyperswitch_connectors/src/connectors/jpmorgan.rs +@@ -171,6 +171,7 @@ impl ConnectorCommon for Jpmorgan { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/juspaythreedsserver.rs b/crates/hyperswitch_connectors/src/connectors/juspaythreedsserver.rs +index a5683ed7..314c892e 100644 +--- a/crates/hyperswitch_connectors/src/connectors/juspaythreedsserver.rs ++++ b/crates/hyperswitch_connectors/src/connectors/juspaythreedsserver.rs +@@ -190,6 +190,7 @@ impl ConnectorCommon for Juspaythreedsserver { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/katapult.rs b/crates/hyperswitch_connectors/src/connectors/katapult.rs +index 0513c895..37c18588 100644 +--- a/crates/hyperswitch_connectors/src/connectors/katapult.rs ++++ b/crates/hyperswitch_connectors/src/connectors/katapult.rs +@@ -153,6 +153,7 @@ impl ConnectorCommon for Katapult { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/klarna.rs b/crates/hyperswitch_connectors/src/connectors/klarna.rs +index 7b9bdda5..070382ce 100644 +--- a/crates/hyperswitch_connectors/src/connectors/klarna.rs ++++ b/crates/hyperswitch_connectors/src/connectors/klarna.rs +@@ -134,6 +134,7 @@ impl ConnectorCommon for Klarna { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/mifinity.rs b/crates/hyperswitch_connectors/src/connectors/mifinity.rs +index c19cbec1..00919688 100644 +--- a/crates/hyperswitch_connectors/src/connectors/mifinity.rs ++++ b/crates/hyperswitch_connectors/src/connectors/mifinity.rs +@@ -157,6 +157,7 @@ impl ConnectorCommon for Mifinity { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } else { + let response: Result< +@@ -195,6 +196,7 @@ impl ConnectorCommon for Mifinity { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + +diff --git a/crates/hyperswitch_connectors/src/connectors/mollie.rs b/crates/hyperswitch_connectors/src/connectors/mollie.rs +index fafb801c..4bc7b112 100644 +--- a/crates/hyperswitch_connectors/src/connectors/mollie.rs ++++ b/crates/hyperswitch_connectors/src/connectors/mollie.rs +@@ -138,6 +138,7 @@ impl ConnectorCommon for Mollie { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/moneris.rs b/crates/hyperswitch_connectors/src/connectors/moneris.rs +index fffd71a4..5c902281 100644 +--- a/crates/hyperswitch_connectors/src/connectors/moneris.rs ++++ b/crates/hyperswitch_connectors/src/connectors/moneris.rs +@@ -182,6 +182,7 @@ impl ConnectorCommon for Moneris { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +@@ -292,6 +293,7 @@ impl ConnectorIntegration + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/mpgs.rs b/crates/hyperswitch_connectors/src/connectors/mpgs.rs +index 50cc7a78..8f1cca83 100644 +--- a/crates/hyperswitch_connectors/src/connectors/mpgs.rs ++++ b/crates/hyperswitch_connectors/src/connectors/mpgs.rs +@@ -153,6 +153,7 @@ impl ConnectorCommon for Mpgs { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/multisafepay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/multisafepay/transformers.rs +index 0f1f7a74..f20c7a22 100644 +--- a/crates/hyperswitch_connectors/src/connectors/multisafepay/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/multisafepay/transformers.rs +@@ -1111,6 +1111,7 @@ pub fn populate_error_reason( + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + } + } + // REFUND : +@@ -1219,6 +1220,7 @@ impl TryFrom> + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }), + ..item.data + }) +diff --git a/crates/hyperswitch_connectors/src/connectors/netcetera.rs b/crates/hyperswitch_connectors/src/connectors/netcetera.rs +index 60977d9b..7a333a28 100644 +--- a/crates/hyperswitch_connectors/src/connectors/netcetera.rs ++++ b/crates/hyperswitch_connectors/src/connectors/netcetera.rs +@@ -146,6 +146,7 @@ impl ConnectorCommon for Netcetera { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/netcetera/transformers.rs b/crates/hyperswitch_connectors/src/connectors/netcetera/transformers.rs +index b6e85aea..7427cd8c 100644 +--- a/crates/hyperswitch_connectors/src/connectors/netcetera/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/netcetera/transformers.rs +@@ -113,6 +113,7 @@ impl + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }), + }; + Ok(Self { +@@ -206,6 +207,7 @@ impl + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }), + }; + Ok(Self { +diff --git a/crates/hyperswitch_connectors/src/connectors/nexinets.rs b/crates/hyperswitch_connectors/src/connectors/nexinets.rs +index 8733bede..64cecb7d 100644 +--- a/crates/hyperswitch_connectors/src/connectors/nexinets.rs ++++ b/crates/hyperswitch_connectors/src/connectors/nexinets.rs +@@ -172,6 +172,7 @@ impl ConnectorCommon for Nexinets { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/nexixpay.rs b/crates/hyperswitch_connectors/src/connectors/nexixpay.rs +index 39a91622..82702d09 100644 +--- a/crates/hyperswitch_connectors/src/connectors/nexixpay.rs ++++ b/crates/hyperswitch_connectors/src/connectors/nexixpay.rs +@@ -206,6 +206,7 @@ impl ConnectorCommon for Nexixpay { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs +index 6a98851e..5a6069b4 100644 +--- a/crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs +@@ -538,6 +538,7 @@ pub fn get_error_response( + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + } + } + +diff --git a/crates/hyperswitch_connectors/src/connectors/nmi.rs b/crates/hyperswitch_connectors/src/connectors/nmi.rs +index 50e5db86..8243fa3f 100644 +--- a/crates/hyperswitch_connectors/src/connectors/nmi.rs ++++ b/crates/hyperswitch_connectors/src/connectors/nmi.rs +@@ -130,6 +130,7 @@ impl ConnectorCommon for Nmi { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/nmi/transformers.rs b/crates/hyperswitch_connectors/src/connectors/nmi/transformers.rs +index 6cb43f0c..aafcb541 100644 +--- a/crates/hyperswitch_connectors/src/connectors/nmi/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/nmi/transformers.rs +@@ -240,6 +240,7 @@ impl + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }), + AttemptStatus::Failure, + ), +@@ -423,6 +424,7 @@ fn get_nmi_error_response(response: NmiCompleteResponse, http_code: u16) -> Erro + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + } + } + +@@ -993,6 +995,7 @@ fn get_standard_error_response(response: StandardResponse, http_code: u16) -> Er + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + } + } + +diff --git a/crates/hyperswitch_connectors/src/connectors/nomupay.rs b/crates/hyperswitch_connectors/src/connectors/nomupay.rs +index 4628a08d..69bacb8a 100644 +--- a/crates/hyperswitch_connectors/src/connectors/nomupay.rs ++++ b/crates/hyperswitch_connectors/src/connectors/nomupay.rs +@@ -292,6 +292,7 @@ impl ConnectorCommon for Nomupay { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }), + (None, None, Some(nomupay_inner_error), _, _) => { + match ( +@@ -308,6 +309,7 @@ impl ConnectorCommon for Nomupay { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }), + (_, Some(validation_errors)) => Ok(ErrorResponse { + status_code: res.status_code, +@@ -327,6 +329,7 @@ impl ConnectorCommon for Nomupay { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }), + (None, None) => Ok(ErrorResponse { + status_code: res.status_code, +@@ -338,6 +341,7 @@ impl ConnectorCommon for Nomupay { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }), + } + } +@@ -354,6 +358,7 @@ impl ConnectorCommon for Nomupay { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }), + _ => Ok(ErrorResponse { + status_code: res.status_code, +@@ -365,6 +370,7 @@ impl ConnectorCommon for Nomupay { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }), + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/noon.rs b/crates/hyperswitch_connectors/src/connectors/noon.rs +index 6eb1cabc..1db28cd2 100644 +--- a/crates/hyperswitch_connectors/src/connectors/noon.rs ++++ b/crates/hyperswitch_connectors/src/connectors/noon.rs +@@ -171,6 +171,7 @@ impl ConnectorCommon for Noon { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + Err(error_message) => { +diff --git a/crates/hyperswitch_connectors/src/connectors/noon/transformers.rs b/crates/hyperswitch_connectors/src/connectors/noon/transformers.rs +index 90898cf7..53edf822 100644 +--- a/crates/hyperswitch_connectors/src/connectors/noon/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/noon/transformers.rs +@@ -606,6 +606,7 @@ impl TryFrom { + let connector_response_reference_id = +@@ -839,6 +840,7 @@ impl TryFrom> for RefundsRout + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } else { + Ok(RefundsResponseData { +@@ -908,6 +910,7 @@ impl TryFrom> for RefundsRo + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } else { + Ok(RefundsResponseData { +diff --git a/crates/hyperswitch_connectors/src/connectors/nordea.rs b/crates/hyperswitch_connectors/src/connectors/nordea.rs +index fb0d9e0f..60f3fd40 100644 +--- a/crates/hyperswitch_connectors/src/connectors/nordea.rs ++++ b/crates/hyperswitch_connectors/src/connectors/nordea.rs +@@ -413,6 +413,7 @@ impl ConnectorCommon for Nordea { + network_decline_code: None, + network_advice_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/nordea/transformers.rs b/crates/hyperswitch_connectors/src/connectors/nordea/transformers.rs +index 6e781e7d..5ca8e110 100644 +--- a/crates/hyperswitch_connectors/src/connectors/nordea/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/nordea/transformers.rs +@@ -475,6 +475,7 @@ impl + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }), + ..item.data + }); +diff --git a/crates/hyperswitch_connectors/src/connectors/novalnet.rs b/crates/hyperswitch_connectors/src/connectors/novalnet.rs +index 1f7fb69f..453e31ad 100644 +--- a/crates/hyperswitch_connectors/src/connectors/novalnet.rs ++++ b/crates/hyperswitch_connectors/src/connectors/novalnet.rs +@@ -159,6 +159,7 @@ impl ConnectorCommon for Novalnet { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs b/crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs +index b894715b..33f207f8 100644 +--- a/crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs +@@ -610,6 +610,7 @@ pub fn get_error_response(result: ResultData, status_code: u16) -> ErrorResponse + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + } + } + +diff --git a/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs b/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs +index 3e811b7d..c20b97d7 100644 +--- a/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs +@@ -2121,6 +2121,7 @@ fn get_error_response( + network_advice_code: network_advice_code.clone(), + network_decline_code: network_decline_code.clone(), + network_error_message: network_error_message.clone(), ++ connector_metadata: None, + })) + } + +diff --git a/crates/hyperswitch_connectors/src/connectors/opayo.rs b/crates/hyperswitch_connectors/src/connectors/opayo.rs +index c83db172..b748af1e 100644 +--- a/crates/hyperswitch_connectors/src/connectors/opayo.rs ++++ b/crates/hyperswitch_connectors/src/connectors/opayo.rs +@@ -142,6 +142,7 @@ impl ConnectorCommon for Opayo { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/opennode.rs b/crates/hyperswitch_connectors/src/connectors/opennode.rs +index 8c4a23b8..17c46577 100644 +--- a/crates/hyperswitch_connectors/src/connectors/opennode.rs ++++ b/crates/hyperswitch_connectors/src/connectors/opennode.rs +@@ -156,6 +156,7 @@ impl ConnectorCommon for Opennode { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/paybox.rs b/crates/hyperswitch_connectors/src/connectors/paybox.rs +index 373c2eab..d626f7c0 100644 +--- a/crates/hyperswitch_connectors/src/connectors/paybox.rs ++++ b/crates/hyperswitch_connectors/src/connectors/paybox.rs +@@ -160,6 +160,7 @@ impl ConnectorCommon for Paybox { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/paybox/transformers.rs b/crates/hyperswitch_connectors/src/connectors/paybox/transformers.rs +index 206fd04b..01bee382 100644 +--- a/crates/hyperswitch_connectors/src/connectors/paybox/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/paybox/transformers.rs +@@ -683,6 +683,7 @@ impl TryFrom TryFrom TryFrom TryFrom> + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }), + ..item.data + }), +@@ -947,6 +952,7 @@ impl TryFrom> + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }), + ..item.data + }), +@@ -1019,6 +1025,7 @@ impl + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }), + ..item.data + }), +diff --git a/crates/hyperswitch_connectors/src/connectors/payeezy.rs b/crates/hyperswitch_connectors/src/connectors/payeezy.rs +index 7dbdaceb..0f7c5681 100644 +--- a/crates/hyperswitch_connectors/src/connectors/payeezy.rs ++++ b/crates/hyperswitch_connectors/src/connectors/payeezy.rs +@@ -149,6 +149,7 @@ impl ConnectorCommon for Payeezy { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/payload.rs b/crates/hyperswitch_connectors/src/connectors/payload.rs +index ce4086a5..663e0e3e 100644 +--- a/crates/hyperswitch_connectors/src/connectors/payload.rs ++++ b/crates/hyperswitch_connectors/src/connectors/payload.rs +@@ -168,6 +168,7 @@ impl ConnectorCommon for Payload { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/payload/transformers.rs b/crates/hyperswitch_connectors/src/connectors/payload/transformers.rs +index 9b4b969b..778aedb8 100644 +--- a/crates/hyperswitch_connectors/src/connectors/payload/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/payload/transformers.rs +@@ -259,6 +259,7 @@ where + network_decline_code: None, + network_advice_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } else { + Ok(PaymentsResponseData::TransactionResponse { +diff --git a/crates/hyperswitch_connectors/src/connectors/payme.rs b/crates/hyperswitch_connectors/src/connectors/payme.rs +index a55d7474..a5dbe2f6 100644 +--- a/crates/hyperswitch_connectors/src/connectors/payme.rs ++++ b/crates/hyperswitch_connectors/src/connectors/payme.rs +@@ -154,6 +154,7 @@ impl ConnectorCommon for Payme { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + Err(error_msg) => { +diff --git a/crates/hyperswitch_connectors/src/connectors/payme/transformers.rs b/crates/hyperswitch_connectors/src/connectors/payme/transformers.rs +index ccd97c2e..958c728c 100644 +--- a/crates/hyperswitch_connectors/src/connectors/payme/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/payme/transformers.rs +@@ -235,6 +235,7 @@ fn get_pay_sale_error_response( + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + } + } + +@@ -320,6 +321,7 @@ fn get_sale_query_error_response( + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + } + } + +@@ -1046,6 +1048,7 @@ impl TryFrom> + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } else { + Ok(RefundsResponseData { +@@ -1120,6 +1123,7 @@ impl TryFrom> for PaymentsCa + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } else { + // Since we are not receiving payme_sale_id, we are not populating the transaction response +@@ -1177,6 +1181,7 @@ impl TryFrom Ok(ErrorResponse { + status_code: res.status_code, +@@ -248,6 +249,7 @@ impl ConnectorCommon for Payone { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }), + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/paypal.rs b/crates/hyperswitch_connectors/src/connectors/paypal.rs +index 996ec05f..8831f499 100644 +--- a/crates/hyperswitch_connectors/src/connectors/paypal.rs ++++ b/crates/hyperswitch_connectors/src/connectors/paypal.rs +@@ -187,6 +187,7 @@ impl Paypal { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +@@ -362,6 +363,7 @@ impl ConnectorCommon for Paypal { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +@@ -503,6 +505,7 @@ impl ConnectorIntegration + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +@@ -1367,9 +1370,10 @@ impl ConnectorIntegration TryFrom TryFrom> + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }), + ..item.data + }) +@@ -400,6 +403,7 @@ impl TryFrom> + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }), + ..item.data + }) +diff --git a/crates/hyperswitch_connectors/src/connectors/paytm.rs b/crates/hyperswitch_connectors/src/connectors/paytm.rs +index adce5aa1..0de4995e 100644 +--- a/crates/hyperswitch_connectors/src/connectors/paytm.rs ++++ b/crates/hyperswitch_connectors/src/connectors/paytm.rs +@@ -145,6 +145,7 @@ impl ConnectorCommon for Paytm { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/payu.rs b/crates/hyperswitch_connectors/src/connectors/payu.rs +index 542619ab..c1bb0506 100644 +--- a/crates/hyperswitch_connectors/src/connectors/payu.rs ++++ b/crates/hyperswitch_connectors/src/connectors/payu.rs +@@ -143,6 +143,7 @@ impl ConnectorCommon for Payu { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +@@ -346,6 +347,7 @@ impl ConnectorIntegration + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/phonepe.rs b/crates/hyperswitch_connectors/src/connectors/phonepe.rs +index 5fdb515a..908fe3f3 100644 +--- a/crates/hyperswitch_connectors/src/connectors/phonepe.rs ++++ b/crates/hyperswitch_connectors/src/connectors/phonepe.rs +@@ -145,6 +145,7 @@ impl ConnectorCommon for Phonepe { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/placetopay.rs b/crates/hyperswitch_connectors/src/connectors/placetopay.rs +index c2c4b00e..0bdb7f2d 100644 +--- a/crates/hyperswitch_connectors/src/connectors/placetopay.rs ++++ b/crates/hyperswitch_connectors/src/connectors/placetopay.rs +@@ -138,6 +138,7 @@ impl ConnectorCommon for Placetopay { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/plaid.rs b/crates/hyperswitch_connectors/src/connectors/plaid.rs +index fcd83b38..f1da95fe 100644 +--- a/crates/hyperswitch_connectors/src/connectors/plaid.rs ++++ b/crates/hyperswitch_connectors/src/connectors/plaid.rs +@@ -152,6 +152,7 @@ impl ConnectorCommon for Plaid { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/plaid/transformers.rs b/crates/hyperswitch_connectors/src/connectors/plaid/transformers.rs +index 40ea4966..4c7c3288 100644 +--- a/crates/hyperswitch_connectors/src/connectors/plaid/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/plaid/transformers.rs +@@ -310,6 +310,7 @@ impl TryFrom TryFrom Opti + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + } + }) + } else if !ISO_SUCCESS_CODES.contains(&item.iso_response_code.as_str()) { +@@ -476,6 +477,7 @@ fn build_error_response(item: &PowertranzBaseResponse, status_code: u16) -> Opti + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } else { + None +diff --git a/crates/hyperswitch_connectors/src/connectors/prophetpay.rs b/crates/hyperswitch_connectors/src/connectors/prophetpay.rs +index 23c634b7..696d1976 100644 +--- a/crates/hyperswitch_connectors/src/connectors/prophetpay.rs ++++ b/crates/hyperswitch_connectors/src/connectors/prophetpay.rs +@@ -147,6 +147,7 @@ impl ConnectorCommon for Prophetpay { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/prophetpay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/prophetpay/transformers.rs +index 1e8c22e9..d30d6582 100644 +--- a/crates/hyperswitch_connectors/src/connectors/prophetpay/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/prophetpay/transformers.rs +@@ -428,6 +428,7 @@ impl + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }), + ..item.data + }) +@@ -479,6 +480,7 @@ impl TryFrom TryFrom> + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }), + ..item.data + }) +@@ -684,6 +688,7 @@ impl TryFrom> + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }), + ..item.data + }) +diff --git a/crates/hyperswitch_connectors/src/connectors/rapyd.rs b/crates/hyperswitch_connectors/src/connectors/rapyd.rs +index d65d9af8..0c4605f1 100644 +--- a/crates/hyperswitch_connectors/src/connectors/rapyd.rs ++++ b/crates/hyperswitch_connectors/src/connectors/rapyd.rs +@@ -148,6 +148,7 @@ impl ConnectorCommon for Rapyd { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + Err(error_msg) => { +diff --git a/crates/hyperswitch_connectors/src/connectors/rapyd/transformers.rs b/crates/hyperswitch_connectors/src/connectors/rapyd/transformers.rs +index bf8ac961..feb3c532 100644 +--- a/crates/hyperswitch_connectors/src/connectors/rapyd/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/rapyd/transformers.rs +@@ -473,6 +473,7 @@ impl TryFrom { +@@ -520,6 +521,7 @@ impl TryFrom Ok(ErrorResponse { +@@ -177,6 +178,7 @@ impl ConnectorCommon for Razorpay { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }), + razorpay::ErrorResponse::RazorpayStringError(error_string) => { + Ok(ErrorResponse { +@@ -189,6 +191,7 @@ impl ConnectorCommon for Razorpay { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/recurly.rs b/crates/hyperswitch_connectors/src/connectors/recurly.rs +index 2a19a34e..35b736b8 100644 +--- a/crates/hyperswitch_connectors/src/connectors/recurly.rs ++++ b/crates/hyperswitch_connectors/src/connectors/recurly.rs +@@ -203,6 +203,7 @@ impl ConnectorCommon for Recurly { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/redsys.rs b/crates/hyperswitch_connectors/src/connectors/redsys.rs +index 96af23ad..0c2e8dfa 100644 +--- a/crates/hyperswitch_connectors/src/connectors/redsys.rs ++++ b/crates/hyperswitch_connectors/src/connectors/redsys.rs +@@ -119,6 +119,7 @@ impl ConnectorCommon for Redsys { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/redsys/transformers.rs b/crates/hyperswitch_connectors/src/connectors/redsys/transformers.rs +index 07e2dc14..c8c23917 100644 +--- a/crates/hyperswitch_connectors/src/connectors/redsys/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/redsys/transformers.rs +@@ -635,6 +635,7 @@ impl + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }); + + Ok(Self { +@@ -1014,6 +1015,7 @@ impl TryFrom TryFrom TryFrom TryFrom TryFrom TryFrom> for RefundsRout + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } else { + Ok(RefundsResponseData { +@@ -1467,6 +1475,7 @@ impl TryFrom> for RefundsRout + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }), + }; + +@@ -1502,6 +1511,7 @@ fn get_payments_response( + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } else { + Ok(PaymentsResponseData::TransactionResponse { +@@ -1786,6 +1796,7 @@ impl TryFrom TryFrom> for RefundsRo + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + (Some(response), None) => { +@@ -1897,6 +1910,7 @@ impl TryFrom> for RefundsRo + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } else { + Ok(RefundsResponseData { +diff --git a/crates/hyperswitch_connectors/src/connectors/riskified.rs b/crates/hyperswitch_connectors/src/connectors/riskified.rs +index 269ac070..450ec312 100644 +--- a/crates/hyperswitch_connectors/src/connectors/riskified.rs ++++ b/crates/hyperswitch_connectors/src/connectors/riskified.rs +@@ -197,6 +197,7 @@ impl ConnectorCommon for Riskified { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/santander.rs b/crates/hyperswitch_connectors/src/connectors/santander.rs +index 5e048ae9..47816d3a 100644 +--- a/crates/hyperswitch_connectors/src/connectors/santander.rs ++++ b/crates/hyperswitch_connectors/src/connectors/santander.rs +@@ -150,6 +150,7 @@ impl ConnectorCommon for Santander { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/shift4.rs b/crates/hyperswitch_connectors/src/connectors/shift4.rs +index 8bc77d60..35611d73 100644 +--- a/crates/hyperswitch_connectors/src/connectors/shift4.rs ++++ b/crates/hyperswitch_connectors/src/connectors/shift4.rs +@@ -143,6 +143,7 @@ impl ConnectorCommon for Shift4 { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/sift.rs b/crates/hyperswitch_connectors/src/connectors/sift.rs +index 101cda9e..3a9f6218 100644 +--- a/crates/hyperswitch_connectors/src/connectors/sift.rs ++++ b/crates/hyperswitch_connectors/src/connectors/sift.rs +@@ -153,6 +153,7 @@ impl ConnectorCommon for Sift { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/signifyd.rs b/crates/hyperswitch_connectors/src/connectors/signifyd.rs +index ce744b8d..643d24cb 100644 +--- a/crates/hyperswitch_connectors/src/connectors/signifyd.rs ++++ b/crates/hyperswitch_connectors/src/connectors/signifyd.rs +@@ -157,6 +157,7 @@ impl ConnectorCommon for Signifyd { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/silverflow.rs b/crates/hyperswitch_connectors/src/connectors/silverflow.rs +index ac1db77b..b084475c 100644 +--- a/crates/hyperswitch_connectors/src/connectors/silverflow.rs ++++ b/crates/hyperswitch_connectors/src/connectors/silverflow.rs +@@ -250,6 +250,7 @@ impl ConnectorCommon for Silverflow { + network_decline_code: None, + network_advice_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/square.rs b/crates/hyperswitch_connectors/src/connectors/square.rs +index 6633533a..b0d9bcf1 100644 +--- a/crates/hyperswitch_connectors/src/connectors/square.rs ++++ b/crates/hyperswitch_connectors/src/connectors/square.rs +@@ -161,6 +161,7 @@ impl ConnectorCommon for Square { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/stax.rs b/crates/hyperswitch_connectors/src/connectors/stax.rs +index 3f305529..5e2b9d5a 100644 +--- a/crates/hyperswitch_connectors/src/connectors/stax.rs ++++ b/crates/hyperswitch_connectors/src/connectors/stax.rs +@@ -141,6 +141,7 @@ impl ConnectorCommon for Stax { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/stripe.rs b/crates/hyperswitch_connectors/src/connectors/stripe.rs +index ee9e3f86..fc27effe 100644 +--- a/crates/hyperswitch_connectors/src/connectors/stripe.rs ++++ b/crates/hyperswitch_connectors/src/connectors/stripe.rs +@@ -189,6 +189,7 @@ impl ConnectorCommon for Stripe { + network_advice_code: response.error.network_advice_code, + network_decline_code: response.error.network_decline_code, + network_error_message: response.error.decline_code.or(response.error.advice_code), ++ connector_metadata: None, + }) + } + } +@@ -391,6 +392,7 @@ impl ConnectorIntegration fo + network_advice_code: response.error.network_advice_code, + network_decline_code: response.error.network_decline_code, + network_error_message: response.error.decline_code.or(response.error.advice_code), ++ connector_metadata: None, + }) + } + } +@@ -856,6 +860,7 @@ impl ConnectorIntegration for Str + network_advice_code: response.error.network_advice_code, + network_decline_code: response.error.network_decline_code, + network_error_message: response.error.decline_code.or(response.error.advice_code), ++ connector_metadata: None, + }) + } + } +@@ -1029,6 +1034,7 @@ impl ConnectorIntegration for St + network_advice_code: response.error.network_advice_code, + network_decline_code: response.error.network_decline_code, + network_error_message: response.error.decline_code.or(response.error.advice_code), ++ connector_metadata: None, + }) + } + } +@@ -1508,6 +1516,7 @@ impl ConnectorIntegration for Stripe + network_advice_code: response.error.network_advice_code, + network_decline_code: response.error.network_decline_code, + network_error_message: response.error.decline_code.or(response.error.advice_code), ++ connector_metadata: None, + }) + } + } +@@ -1804,6 +1814,7 @@ impl ConnectorIntegration for Stripe { + network_advice_code: response.error.network_advice_code, + network_decline_code: response.error.network_decline_code, + network_error_message: response.error.decline_code.or(response.error.advice_code), ++ connector_metadata: None, + }) + } + } +@@ -1948,6 +1959,7 @@ impl ConnectorIntegration for + network_advice_code: response.error.network_advice_code, + network_decline_code: response.error.network_decline_code, + network_error_message: response.error.decline_code.or(response.error.advice_code), ++ connector_metadata: None, + }) + } + } +@@ -2048,6 +2060,7 @@ impl ConnectorIntegration> for RefundsRout + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } else { + Ok(RefundsResponseData { +@@ -3584,6 +3585,7 @@ impl TryFrom> for RefundsRouter + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } else { + Ok(RefundsResponseData { +@@ -3875,6 +3877,7 @@ impl TryFrom { +diff --git a/crates/hyperswitch_connectors/src/connectors/threedsecureio/transformers.rs b/crates/hyperswitch_connectors/src/connectors/threedsecureio/transformers.rs +index de34d423..691448e6 100644 +--- a/crates/hyperswitch_connectors/src/connectors/threedsecureio/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/threedsecureio/transformers.rs +@@ -122,6 +122,7 @@ impl + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + }; +@@ -204,6 +205,7 @@ impl + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }), + ThreedsecureioErrorResponseWrapper::ErrorString(error) => Err(ErrorResponse { + code: error.clone(), +@@ -215,6 +217,7 @@ impl + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }), + }, + }; +diff --git a/crates/hyperswitch_connectors/src/connectors/thunes.rs b/crates/hyperswitch_connectors/src/connectors/thunes.rs +index 4a48ed7e..d7149321 100644 +--- a/crates/hyperswitch_connectors/src/connectors/thunes.rs ++++ b/crates/hyperswitch_connectors/src/connectors/thunes.rs +@@ -147,6 +147,7 @@ impl ConnectorCommon for Thunes { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/tokenio.rs b/crates/hyperswitch_connectors/src/connectors/tokenio.rs +index 6f849b74..186378f4 100644 +--- a/crates/hyperswitch_connectors/src/connectors/tokenio.rs ++++ b/crates/hyperswitch_connectors/src/connectors/tokenio.rs +@@ -317,6 +317,7 @@ impl ConnectorCommon for Tokenio { + network_decline_code: None, + network_advice_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/tokenio/transformers.rs b/crates/hyperswitch_connectors/src/connectors/tokenio/transformers.rs +index ccacc4f2..7ca761d9 100644 +--- a/crates/hyperswitch_connectors/src/connectors/tokenio/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/tokenio/transformers.rs +@@ -448,6 +448,7 @@ impl TryFrom TryFrom { +@@ -347,6 +348,7 @@ impl ConnectorIntegration + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/trustpay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/trustpay/transformers.rs +index 4b48a229..d75fabe1 100644 +--- a/crates/hyperswitch_connectors/src/connectors/trustpay/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/trustpay/transformers.rs +@@ -877,6 +877,7 @@ fn handle_cards_response( + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } else { + None +@@ -950,6 +951,7 @@ fn handle_bank_redirects_error_response( + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }); + let payment_response_data = PaymentsResponseData::TransactionResponse { + resource_id: ResponseId::NoResponseId, +@@ -1005,6 +1007,7 @@ fn handle_bank_redirects_sync_response( + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } else { + None +@@ -1062,6 +1065,7 @@ pub fn handle_webhook_response( + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } else { + None +@@ -1174,6 +1178,7 @@ impl TryFrom + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + }; +diff --git a/crates/hyperswitch_connectors/src/connectors/vgs.rs b/crates/hyperswitch_connectors/src/connectors/vgs.rs +index 4386314e..68751d6e 100644 +--- a/crates/hyperswitch_connectors/src/connectors/vgs.rs ++++ b/crates/hyperswitch_connectors/src/connectors/vgs.rs +@@ -144,6 +144,7 @@ impl ConnectorCommon for Vgs { + network_decline_code: None, + network_advice_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/volt.rs b/crates/hyperswitch_connectors/src/connectors/volt.rs +index a8c5a529..b9655334 100644 +--- a/crates/hyperswitch_connectors/src/connectors/volt.rs ++++ b/crates/hyperswitch_connectors/src/connectors/volt.rs +@@ -174,6 +174,7 @@ impl ConnectorCommon for Volt { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +@@ -281,6 +282,7 @@ impl ConnectorIntegration + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/volt/transformers.rs b/crates/hyperswitch_connectors/src/connectors/volt/transformers.rs +index d4275f05..df81991c 100644 +--- a/crates/hyperswitch_connectors/src/connectors/volt/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/volt/transformers.rs +@@ -357,6 +357,7 @@ impl TryFrom TryFrom { +@@ -245,6 +246,7 @@ impl ConnectorCommon for Wellsfargo { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + Ok(transformers::WellsfargoErrorResponse::NotAvailableError(response)) => { +@@ -272,6 +274,7 @@ impl ConnectorCommon for Wellsfargo { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + Err(error_msg) => { +@@ -483,6 +486,7 @@ impl ConnectorIntegration fo + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +@@ -900,6 +906,7 @@ impl ConnectorIntegration for We + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/wellsfargo/transformers.rs b/crates/hyperswitch_connectors/src/connectors/wellsfargo/transformers.rs +index 5f48a367..54be5601 100644 +--- a/crates/hyperswitch_connectors/src/connectors/wellsfargo/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/wellsfargo/transformers.rs +@@ -2436,6 +2436,7 @@ pub fn get_error_response( + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + } + } + pub fn get_error_reason( +diff --git a/crates/hyperswitch_connectors/src/connectors/wellsfargopayout.rs b/crates/hyperswitch_connectors/src/connectors/wellsfargopayout.rs +index d76bf386..c69d73ad 100644 +--- a/crates/hyperswitch_connectors/src/connectors/wellsfargopayout.rs ++++ b/crates/hyperswitch_connectors/src/connectors/wellsfargopayout.rs +@@ -151,6 +151,7 @@ impl ConnectorCommon for Wellsfargopayout { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/wise.rs b/crates/hyperswitch_connectors/src/connectors/wise.rs +index 01f30682..5d28f131 100644 +--- a/crates/hyperswitch_connectors/src/connectors/wise.rs ++++ b/crates/hyperswitch_connectors/src/connectors/wise.rs +@@ -147,6 +147,7 @@ impl ConnectorCommon for Wise { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } else { + Ok(ErrorResponse { +@@ -159,6 +160,7 @@ impl ConnectorCommon for Wise { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +@@ -172,6 +174,7 @@ impl ConnectorCommon for Wise { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }), + } + } +@@ -325,6 +328,7 @@ impl ConnectorIntegration for Wise { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/worldpay.rs b/crates/hyperswitch_connectors/src/connectors/worldpay.rs +index fcb58283..b5d3dacd 100644 +--- a/crates/hyperswitch_connectors/src/connectors/worldpay.rs ++++ b/crates/hyperswitch_connectors/src/connectors/worldpay.rs +@@ -164,6 +164,7 @@ impl ConnectorCommon for Worldpay { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +@@ -478,6 +479,7 @@ impl ConnectorIntegration for Wor + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + +diff --git a/crates/hyperswitch_connectors/src/connectors/worldpay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/worldpay/transformers.rs +index d840d527..8035efa4 100644 +--- a/crates/hyperswitch_connectors/src/connectors/worldpay/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/worldpay/transformers.rs +@@ -801,6 +801,7 @@ impl + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }), + (_, Some((code, message, advice_code))) => Err(ErrorResponse { + code: code.clone(), +@@ -814,6 +815,7 @@ impl + // You can use raw response codes to inform your retry logic. A rawCode is only returned if specifically requested. + network_decline_code: Some(code), + network_error_message: Some(message), ++ connector_metadata: None, + }), + }; + Ok(Self { +diff --git a/crates/hyperswitch_connectors/src/connectors/worldpayvantiv.rs b/crates/hyperswitch_connectors/src/connectors/worldpayvantiv.rs +index 99811813..796dc700 100644 +--- a/crates/hyperswitch_connectors/src/connectors/worldpayvantiv.rs ++++ b/crates/hyperswitch_connectors/src/connectors/worldpayvantiv.rs +@@ -172,6 +172,7 @@ impl ConnectorCommon for Worldpayvantiv { + network_decline_code: None, + network_advice_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + Err(error_msg) => { +@@ -1504,6 +1505,7 @@ fn handle_vantiv_json_error_response( + network_decline_code: None, + network_advice_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + Err(error_msg) => { +@@ -1544,6 +1546,7 @@ fn handle_vantiv_dispute_error_response( + network_decline_code: None, + network_advice_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + Err(error_msg) => { +diff --git a/crates/hyperswitch_connectors/src/connectors/worldpayvantiv/transformers.rs b/crates/hyperswitch_connectors/src/connectors/worldpayvantiv/transformers.rs +index f1415ac8..2894ad68 100644 +--- a/crates/hyperswitch_connectors/src/connectors/worldpayvantiv/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/worldpayvantiv/transformers.rs +@@ -551,6 +551,7 @@ impl TryFrom TryFrom TryFrom + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }), + ..item.data + }) +@@ -1626,6 +1632,7 @@ impl + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }), + ..item.data + }), +@@ -1671,6 +1678,7 @@ impl TryFrom> for RefundsR + network_advice_code: None, + network_decline_code, + network_error_message, ++ connector_metadata: None, + }), + ..item.data + }) +@@ -1712,6 +1720,7 @@ impl TryFrom> for RefundsR + network_advice_code: None, + network_decline_code, + network_error_message, ++ connector_metadata: None, + }), + ..item.data + }) +@@ -1842,6 +1851,7 @@ impl + network_advice_code: None, + network_decline_code, + network_error_message, ++ connector_metadata: None, + }), + ..item.data + }) +@@ -1909,6 +1919,7 @@ impl + network_advice_code: None, + network_decline_code, + network_error_message, ++ connector_metadata: None, + }), + ..item.data + }) +@@ -1961,6 +1972,7 @@ impl + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }), + ..item.data + })}, +@@ -2020,6 +2032,7 @@ impl + network_advice_code: None, + network_decline_code, + network_error_message, ++ connector_metadata: None, + }), + ..item.data + }) +@@ -2075,6 +2088,7 @@ impl + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }), + ..item.data + }), +@@ -2124,6 +2138,7 @@ impl TryFrom> for RefundsRo + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }), + ..item.data + }) +@@ -4454,6 +4469,7 @@ impl + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + }; + +@@ -4495,6 +4511,7 @@ impl + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }), + ..item.data.clone() + }) +diff --git a/crates/hyperswitch_connectors/src/connectors/worldpayxml.rs b/crates/hyperswitch_connectors/src/connectors/worldpayxml.rs +index ef5dc46e..158625ab 100644 +--- a/crates/hyperswitch_connectors/src/connectors/worldpayxml.rs ++++ b/crates/hyperswitch_connectors/src/connectors/worldpayxml.rs +@@ -172,6 +172,7 @@ impl ConnectorCommon for Worldpayxml { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + Err(error_msg) => { +diff --git a/crates/hyperswitch_connectors/src/connectors/worldpayxml/transformers.rs b/crates/hyperswitch_connectors/src/connectors/worldpayxml/transformers.rs +index 0e02cc59..345d7e39 100644 +--- a/crates/hyperswitch_connectors/src/connectors/worldpayxml/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/worldpayxml/transformers.rs +@@ -548,6 +548,7 @@ impl TryFrom> for RefundsRout + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }), + ..item.data + }) +@@ -798,6 +799,7 @@ impl TryFrom TryFrom TryFrom TryFrom> for RefundsRouter + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } else { + Ok(RefundsResponseData { +@@ -1116,6 +1122,7 @@ fn process_payment_response( + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + })) + } else { + Ok(PaymentsResponseData::TransactionResponse { +diff --git a/crates/hyperswitch_connectors/src/connectors/xendit.rs b/crates/hyperswitch_connectors/src/connectors/xendit.rs +index 57c5978b..bf318f1a 100644 +--- a/crates/hyperswitch_connectors/src/connectors/xendit.rs ++++ b/crates/hyperswitch_connectors/src/connectors/xendit.rs +@@ -163,6 +163,7 @@ impl ConnectorCommon for Xendit { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/xendit/transformers.rs b/crates/hyperswitch_connectors/src/connectors/xendit/transformers.rs +index ea10e96d..e05175c5 100644 +--- a/crates/hyperswitch_connectors/src/connectors/xendit/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/xendit/transformers.rs +@@ -350,6 +350,7 @@ impl + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } else { + let charges = match item.data.request.split_payments.as_ref() { +@@ -468,6 +469,7 @@ impl + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } else { + Ok(PaymentsResponseData::TransactionResponse { +@@ -604,6 +606,7 @@ impl TryFrom> for PaymentsSyncRou + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } else { + Ok(PaymentsResponseData::TransactionResponse { +diff --git a/crates/hyperswitch_connectors/src/connectors/zen.rs b/crates/hyperswitch_connectors/src/connectors/zen.rs +index acb626b8..62bb0f5e 100644 +--- a/crates/hyperswitch_connectors/src/connectors/zen.rs ++++ b/crates/hyperswitch_connectors/src/connectors/zen.rs +@@ -151,6 +151,7 @@ impl ConnectorCommon for Zen { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs b/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs +index 48aa2a51..100237ab 100644 +--- a/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs +@@ -952,6 +952,7 @@ fn get_zen_response( + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } else { + None +@@ -1101,6 +1102,7 @@ fn get_zen_refund_response( + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } else { + None +diff --git a/crates/hyperswitch_connectors/src/connectors/zsl.rs b/crates/hyperswitch_connectors/src/connectors/zsl.rs +index 47b25cca..3ab30024 100644 +--- a/crates/hyperswitch_connectors/src/connectors/zsl.rs ++++ b/crates/hyperswitch_connectors/src/connectors/zsl.rs +@@ -126,6 +126,7 @@ impl ConnectorCommon for Zsl { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/zsl/transformers.rs b/crates/hyperswitch_connectors/src/connectors/zsl/transformers.rs +index cf4c4527..d4dab880 100644 +--- a/crates/hyperswitch_connectors/src/connectors/zsl/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/zsl/transformers.rs +@@ -358,6 +358,7 @@ impl TryFrom TryFrom TryFrom for router_data::ErrorResponse { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + } + } + } +diff --git a/crates/hyperswitch_domain_models/src/router_data.rs b/crates/hyperswitch_domain_models/src/router_data.rs +index f572ebc0..6e3d7827 100644 +--- a/crates/hyperswitch_domain_models/src/router_data.rs ++++ b/crates/hyperswitch_domain_models/src/router_data.rs +@@ -521,6 +521,7 @@ pub struct ErrorResponse { + pub network_decline_code: Option, + pub network_advice_code: Option, + pub network_error_message: Option, ++ pub connector_metadata: Option>, + } + + impl Default for ErrorResponse { +@@ -535,6 +536,7 @@ impl Default for ErrorResponse { + network_decline_code: None, + network_advice_code: None, + network_error_message: None, ++ connector_metadata: None, + } + } + } +@@ -551,6 +553,7 @@ impl ErrorResponse { + network_decline_code: None, + network_advice_code: None, + network_error_message: None, ++ connector_metadata: None, + } + } + } +@@ -742,6 +745,7 @@ impl + network_decline_code, + network_advice_code, + network_error_message, ++ connector_metadata, + } = error_response.clone(); + + let attempt_status = match error_response.attempt_status { +@@ -956,6 +960,7 @@ impl + network_advice_code, + network_decline_code, + network_error_message, ++ connector_metadata: _, + } = error_response.clone(); + let attempt_status = attempt_status.unwrap_or(self.status); + +@@ -1186,6 +1191,7 @@ impl + network_advice_code, + network_decline_code, + network_error_message, ++ connector_metadata: _, + } = error_response.clone(); + + let attempt_status = match error_response.attempt_status { +@@ -1455,6 +1461,7 @@ impl + network_decline_code, + network_advice_code, + network_error_message, ++ connector_metadata, + } = error_response.clone(); + + let attempt_status = match error_response.attempt_status { +@@ -1681,6 +1688,7 @@ impl + network_advice_code, + network_decline_code, + network_error_message, ++ connector_metadata: _, + } = error_response.clone(); + let attempt_status = attempt_status.unwrap_or(self.status); + +diff --git a/crates/hyperswitch_interfaces/src/api.rs b/crates/hyperswitch_interfaces/src/api.rs +index 6efc23c3..c4d427a8 100644 +--- a/crates/hyperswitch_interfaces/src/api.rs ++++ b/crates/hyperswitch_interfaces/src/api.rs +@@ -277,6 +277,7 @@ pub trait ConnectorIntegration: + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + +@@ -368,6 +369,7 @@ pub trait ConnectorCommon { + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/crates/hyperswitch_interfaces/src/connector_integration_v2.rs b/crates/hyperswitch_interfaces/src/connector_integration_v2.rs +index 999770b6..aa4bc72f 100644 +--- a/crates/hyperswitch_interfaces/src/connector_integration_v2.rs ++++ b/crates/hyperswitch_interfaces/src/connector_integration_v2.rs +@@ -213,6 +213,7 @@ pub trait ConnectorIntegrationV2: + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + +diff --git a/crates/payment_methods/src/configs/payment_connector_required_fields.rs b/crates/payment_methods/src/configs/payment_connector_required_fields.rs +index ea4d9869..5ce306c5 100644 +--- a/crates/payment_methods/src/configs/payment_connector_required_fields.rs ++++ b/crates/payment_methods/src/configs/payment_connector_required_fields.rs +@@ -184,6 +184,8 @@ enum RequiredField { + UpiCollectVpaId, + AchBankDebitAccountNumber, + AchBankDebitRoutingNumber, ++ AchBankDebitBankType(Vec), ++ AchBankDebitBankAccountHolderName, + SepaBankDebitIban, + BacsBankDebitAccountNumber, + BacsBankDebitSortCode, +@@ -712,6 +714,30 @@ impl RequiredField { + value: None, + }, + ), ++ Self::AchBankDebitBankType(bank_type) => ( ++ "payment_method_data.bank_debit.ach_bank_debit.bank_type".to_string(), ++ RequiredFieldInfo { ++ required_field: "payment_method_data.bank_debit.ach_bank_debit.bank_type" ++ .to_string(), ++ display_name: "bank_type".to_string(), ++ field_type: FieldType::UserBankType { ++ options: bank_type.iter().map(|bt| bt.to_string()).collect(), ++ }, ++ value: None, ++ }, ++ ), ++ Self::AchBankDebitBankAccountHolderName => ( ++ "payment_method_data.bank_debit.ach_bank_debit.bank_account_holder_name" ++ .to_string(), ++ RequiredFieldInfo { ++ required_field: ++ "payment_method_data.bank_debit.ach_bank_debit.bank_account_holder_name" ++ .to_string(), ++ display_name: "bank_account_holder_name".to_string(), ++ field_type: FieldType::UserBankAccountHolderName, ++ value: None, ++ }, ++ ), + Self::SepaBankDebitIban => ( + "payment_method_data.bank_debit.sepa_bank_debit.iban".to_string(), + RequiredFieldInfo { +@@ -3101,6 +3127,30 @@ fn get_bank_debit_required_fields() -> HashMap { + dlocal::transformers::DlocalAuthType::try_from(self.auth_type)?; + Ok(()) + } +- // api_enums::Connector::Dwolla => { +- // dwolla::transformers::DwollaAuthType::try_from(self.auth_type)?; +- // Ok(()) +- // } ++ api_enums::Connector::Dwolla => { ++ dwolla::transformers::DwollaAuthType::try_from(self.auth_type)?; ++ Ok(()) ++ } + api_enums::Connector::Ebanx => { + ebanx::transformers::EbanxAuthType::try_from(self.auth_type)?; + Ok(()) +diff --git a/crates/router/src/core/payments/access_token.rs b/crates/router/src/core/payments/access_token.rs +index cf49d65b..5512b1b2 100644 +--- a/crates/router/src/core/payments/access_token.rs ++++ b/crates/router/src/core/payments/access_token.rs +@@ -243,6 +243,7 @@ pub async fn refresh_connector_auth( + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }; + + Ok(Err(error_response)) +@@ -334,6 +335,7 @@ pub async fn execute_authentication_token< + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }; + Err(error_response) + } else { +diff --git a/crates/router/src/core/payments/tokenization.rs b/crates/router/src/core/payments/tokenization.rs +index d6578ad3..759db4ef 100644 +--- a/crates/router/src/core/payments/tokenization.rs ++++ b/crates/router/src/core/payments/tokenization.rs +@@ -1220,6 +1220,25 @@ pub async fn save_network_token_in_locker( + } + } + ++pub fn handle_tokenization_response( ++ resp: &mut types::RouterData, ++) { ++ let response = resp.response.clone(); ++ if let Err(err) = response { ++ if let Some(secret_metadata) = &err.connector_metadata { ++ let metadata = secret_metadata.clone().expose(); ++ if let Some(token) = metadata ++ .get("payment_method_token") ++ .and_then(|t| t.as_str()) ++ { ++ resp.response = Ok(types::PaymentsResponseData::TokenizationResponse { ++ token: token.to_string(), ++ }); ++ } ++ } ++ } ++} ++ + pub fn create_payment_method_metadata( + metadata: Option<&pii::SecretSerdeValue>, + connector_token: Option<(String, String)>, +@@ -1276,7 +1295,7 @@ pub async fn add_payment_method_token( + .request + .set_session_token(pm_token_router_data.session_token.clone()); + +- let resp = services::execute_connector_processing_step( ++ let mut resp = services::execute_connector_processing_step( + state, + connector_integration, + &pm_token_router_data, +@@ -1287,6 +1306,9 @@ pub async fn add_payment_method_token( + .await + .to_payment_failed_response()?; + ++ // checks for metadata in the ErrorResponse, if present bypasses it and constructs an Ok response ++ handle_tokenization_response(&mut resp); ++ + metrics::CONNECTOR_PAYMENT_METHOD_TOKENIZATION.add( + 1, + router_env::metric_attributes!( +diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs +index a1be3e85..348a364c 100644 +--- a/crates/router/src/core/payments/transformers.rs ++++ b/crates/router/src/core/payments/transformers.rs +@@ -1702,6 +1702,7 @@ pub async fn construct_payment_router_data_for_update_metadata<'a>( + network_decline_code: None, + network_advice_code: None, + network_error_message: None, ++ connector_metadata: None, + }); + + let additional_data = PaymentAdditionalData { +diff --git a/crates/router/src/core/payouts/access_token.rs b/crates/router/src/core/payouts/access_token.rs +index a675b5f4..2486b1b1 100644 +--- a/crates/router/src/core/payouts/access_token.rs ++++ b/crates/router/src/core/payouts/access_token.rs +@@ -176,6 +176,7 @@ pub async fn refresh_connector_auth( + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }; + + Ok(Err(error_response)) +diff --git a/crates/router/src/core/unified_connector_service/transformers.rs b/crates/router/src/core/unified_connector_service/transformers.rs +index 6f50bc4a..9162b9e1 100644 +--- a/crates/router/src/core/unified_connector_service/transformers.rs ++++ b/crates/router/src/core/unified_connector_service/transformers.rs +@@ -573,6 +573,7 @@ impl ForeignTryFrom + network_decline_code: None, + network_advice_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } else { + Ok(PaymentsResponseData::TransactionResponse { +@@ -634,6 +635,7 @@ impl ForeignTryFrom + network_decline_code: None, + network_advice_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } else { + Ok(PaymentsResponseData::TransactionResponse { +@@ -696,6 +698,7 @@ impl ForeignTryFrom + network_decline_code: None, + network_advice_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } else { + Ok(PaymentsResponseData::TransactionResponse { +@@ -787,6 +790,7 @@ impl ForeignTryFrom + network_decline_code: None, + network_advice_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } else { + Ok(PaymentsResponseData::TransactionResponse { +diff --git a/crates/router/src/services/api.rs b/crates/router/src/services/api.rs +index 461fe03b..6b25eb45 100644 +--- a/crates/router/src/services/api.rs ++++ b/crates/router/src/services/api.rs +@@ -183,6 +183,7 @@ where + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } else { + None +@@ -386,6 +387,7 @@ where + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }; + router_data.response = Err(error_response); + router_data.connector_http_status_code = Some(504); +@@ -454,7 +456,6 @@ async fn handle_response( + logger::info!(?response); + let status_code = response.status().as_u16(); + let headers = Some(response.headers().to_owned()); +- + match status_code { + 200..=202 | 302 | 204 => { + // If needed add log line +diff --git a/crates/router/src/types/api/connector_mapping.rs b/crates/router/src/types/api/connector_mapping.rs +index 8a238d1e..384a430d 100644 +--- a/crates/router/src/types/api/connector_mapping.rs ++++ b/crates/router/src/types/api/connector_mapping.rs +@@ -237,9 +237,9 @@ impl ConnectorData { + enums::Connector::DummyBillingConnector => Ok(ConnectorEnum::Old(Box::new( + connector::DummyConnector::<8>::new(), + ))), +- // enums::Connector::Dwolla => { +- // Ok(ConnectorEnum::Old(Box::new(connector::Dwolla::new()))) +- // } ++ enums::Connector::Dwolla => { ++ Ok(ConnectorEnum::Old(Box::new(connector::Dwolla::new()))) ++ } + enums::Connector::Ebanx => { + Ok(ConnectorEnum::Old(Box::new(connector::Ebanx::new()))) + } +diff --git a/crates/router/src/types/connector_transformers.rs b/crates/router/src/types/connector_transformers.rs +index 4cf4bad8..cf29d042 100644 +--- a/crates/router/src/types/connector_transformers.rs ++++ b/crates/router/src/types/connector_transformers.rs +@@ -50,7 +50,7 @@ impl ForeignTryFrom for common_enums::RoutableConnectors { + api_enums::Connector::Deutschebank => Self::Deutschebank, + api_enums::Connector::Digitalvirgo => Self::Digitalvirgo, + api_enums::Connector::Dlocal => Self::Dlocal, +- // api_enums::Connector::Dwolla => Self::Dwolla, ++ api_enums::Connector::Dwolla => Self::Dwolla, + api_enums::Connector::Ebanx => Self::Ebanx, + api_enums::Connector::Elavon => Self::Elavon, + api_enums::Connector::Facilitapay => Self::Facilitapay, +diff --git a/crates/router/src/utils.rs b/crates/router/src/utils.rs +index df9653b6..e2acbc4d 100644 +--- a/crates/router/src/utils.rs ++++ b/crates/router/src/utils.rs +@@ -676,6 +676,7 @@ pub fn handle_json_response_deserialization_failure( + network_advice_code: None, + network_decline_code: None, + network_error_message: None, ++ connector_metadata: None, + }) + } + } +diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml +index a2f38e7d..8dc043b5 100644 +--- a/loadtest/config/development.toml ++++ b/loadtest/config/development.toml +@@ -588,6 +588,9 @@ google_pay = { currency = "CHF,DKK,EUR,GBP,NOK,PLN,SEK,USD,AUD,NZD,CAD" } + apple_pay = { currency = "EUR,GBP,ISK,USD,AUD,CAD,BRL,CLP,COP,CRC,CZK,DKK,EGP,GEL,GHS,GTQ,HNL,HKD,HUF,ILS,INR,JPY,KZT,KRW,KWD,MAD,MXN,MYR,NOK,NZD,PEN,PLN,PYG,QAR,RON,SAR,SEK,SGD,THB,TWD,UAH,AED,VND,ZAR" } + paypal = { currency = "AUD,BRL,CAD,CHF,CNY,CZK,DKK,EUR,GBP,HKD,HUF,ILS,JPY,MXN,MYR,NOK,NZD,PHP,PLN,SEK,SGD,THB,TWD,USD" } + ++[pm_filters.dwolla] ++ach = { country = "US", currency = "USD" } ++ + [pm_filters.forte] + credit = { country = "US, CA", currency = "CAD,USD" } + debit = { country = "US, CA", currency = "CAD,USD" } +@@ -638,9 +641,10 @@ braintree = { long_lived_token = false, payment_method = "card" } + gocardless = { long_lived_token = true, payment_method = "bank_debit" } + billwerk = { long_lived_token = false, payment_method = "card" } + globalpay = { long_lived_token = false, payment_method = "card", flow = "mandates" } ++dwolla = { long_lived_token = true, payment_method = "bank_debit" } + + [connector_customer] +-connector_list = "authorizedotnet,facilitapay,gocardless,hyperswitch_vault,stax,stripe" ++connector_list = "authorizedotnet,dwolla,facilitapay,gocardless,hyperswitch_vault,stax,stripe" + payout_connector_list = "nomupay,wise" + + [dummy_connector] + +----- END CHUNK ----- \ No newline at end of file diff --git a/raw/c5/c5174fd6ed720340fcffe8715503eb4e5fcfc774.txt b/raw/c5/c5174fd6ed720340fcffe8715503eb4e5fcfc774.txt new file mode 100644 index 0000000000000000000000000000000000000000..adccc5556ff81cf06a17986879d3cf3be9c623bb --- /dev/null +++ b/raw/c5/c5174fd6ed720340fcffe8715503eb4e5fcfc774.txt @@ -0,0 +1,333 @@ +ROUTE: juspay/hyperswitch@c5174fd6ed720340fcffe8715503eb4e5fcfc774 +REPO: https://github.com/juspay/hyperswitch +COMMIT: c5174fd6ed720340fcffe8715503eb4e5fcfc774 +AUTHOR: Sakil Mostak <73734619+Sakilmostak@users.noreply.github.com> +DATE: 2025-08-19T14:40:34 + +=== ISSUE_AND_PR === +[PR #8991] fix(connector): [Wise] change amount conversion unit +URL: https://github.com/juspay/hyperswitch/pull/8991 +BODY: +## Type of Change + + +- [x] Bugfix +- [ ] New feature +- [ ] Enhancement +- [ ] Refactoring +- [ ] Dependency updates +- [ ] Documentation +- [ ] CI/CD + +## Description + +change amount conversion from MInorUnit to FloatMajorUnit + +### Additional Changes + +- [ ] This PR modifies the API contract +- [ ] This PR modifies the database schema +- [ ] This PR modifies application configuration/environment variables + + + + +## Motivation and Context + + + +## How did you test it? + +Create an MCA through Wise: +Create a payout using below body: +``` +{ + "amount": 500, + "currency": "USD", + "customer_id": "{{customer_id}}", + "email": "payout_customer@example.com", + "name": "John Doe", + "phone": "999999999", + "phone_country_code": "+65", + "description": "Its my first payout request", + "payout_type": "bank", + "payout_method_data": { + "bank": { + "bank_account_number": "40000000000", + "bank_routing_number": "064000020" + } + }, + "billing": { + "address": { + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "city": "San Fransico", + "state": "NY", + "zip": "94122", + "country": "US", + "first_name": "John", + "last_name": "Doe" + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + } + }, + "recurring": false, + "metadata": { + "ref": "123" + }, + "confirm": true, + "auto_fulfill": true +} +``` +Following should be the response: +``` +{ + "payout_id": "payout_4w5t7SPgQZX2qf8Lojdk", + "merchant_id": "merchant_1755607920", + "merchant_order_reference_id": null, + "amount": 500, + "currency": "USD", + "connector": "wise", + "payout_type": "bank", + "payout_method_data": { + "bank": { + "bank_account_number": "*******0000", + "bank_routing_number": "064***020", + "bank_name": null, + "bank_country_code": null, + "bank_city": null + } + }, + "billing": { + "address": { + "city": "San Fransico", + "country": "US", + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "zip": "94122", + "state": "NY", + "first_name": "John", + "last_name": "Doe", + "origin_zip": null + }, + "phone": { + "number": "8056594427", + "country_code": "+91" + }, + "email": null + }, + "auto_fulfill": true, + "customer_id": "cus_r4hlpxACcjdVr64ypkwQ", + "customer": { + "id": "cus_r4hlpxACcjdVr64ypkwQ", + "name": "John Doe", + "email": "payout_customer@example.com", + "phone": "999999999", + "phone_country_code": "+65" + }, + "client_secret": "payout_payout_4w5t7SPgQZX2qf8Lojdk_secret_bPjBpTiePuIx4Lwedq7t", + "return_url": null, + "business_country": null, + "business_label": null, + "description": "Its my first payout request", + "entity_type": "Individual", + "recurring": false, + "metadata": { + "ref": "123" + }, + "merchant_connector_id": "mca_vqTEvjUSP4aJ2SLVik7n", + "status": "initiated", + "error_message": null, + "error_code": null, + "profile_id": "pro_4NfB43WH4HspmYGnsXL1", + "created": "2025-08-19T12:52:08.109Z", + "connector_transaction_id": "55350011", + "priority": null, + "payout_link": null, + "email": "payout_customer@example.com", + "name": "John Doe", + "phone": "999999999", + "phone_country_code": "+65", + "unified_code": null, + "unified_message": null, + "payout_method_id": null +} +``` +Check in the dashboard whether the amount matches the payment amount + +## Checklist + + +- [x] I formatted the code `cargo +nightly fmt --all` +- [x] I addressed lints thrown by `cargo clippy` +- [x] I reviewed the submitted code +- [ ] I added unit tests for my changes where possible +COMMENTS: +- semanticdiff-com[bot]: Review changes with  SemanticDiff +
+Changed Files +
+ +| File | Status | +| :--- | :--- | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8991/changes#crates/hyperswitch_connectors/src/connectors/wise.rs)  [crates/hyperswitch\_connectors/src/connectors/wise\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8991/changes#crates/hyperswitch_connectors/src/connectors/wise.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8991/changes#crates/hyperswitch_connectors/src/connectors/wise.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8991/changes#crates/hyperswitch_connectors/src/connectors/wise/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/wise/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8991/changes#crates/hyperswitch_connectors/src/connectors/wise/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8991/changes#crates/hyperswitch_connectors/src/connectors/wise/transformers.rs)  0% smaller | + +
+ +=== COMMIT === +SUBJECT: fix(connector): [Wise] change amount conversion unit (#8991) + +=== FILES === +Summary: 2 files changed, +34 -12 +- crates/hyperswitch_connectors/src/connectors/wise.rs (+5 -5) +- crates/hyperswitch_connectors/src/connectors/wise/transformers.rs (+29 -7) + +=== PATCH === +diff --git a/crates/hyperswitch_connectors/src/connectors/wise.rs b/crates/hyperswitch_connectors/src/connectors/wise.rs +index 7280ad0a..01f30682 100644 +--- a/crates/hyperswitch_connectors/src/connectors/wise.rs ++++ b/crates/hyperswitch_connectors/src/connectors/wise.rs +@@ -4,7 +4,7 @@ use api_models::webhooks::IncomingWebhookEvent; + #[cfg(feature = "payouts")] + use common_utils::request::{Method, RequestBuilder, RequestContent}; + #[cfg(feature = "payouts")] +-use common_utils::types::{AmountConvertor, MinorUnit, MinorUnitForConnector}; ++use common_utils::types::{AmountConvertor, FloatMajorUnit, FloatMajorUnitForConnector}; + use common_utils::{errors::CustomResult, ext_traits::ByteSliceExt, request::Request}; + #[cfg(not(feature = "payouts"))] + use error_stack::report; +@@ -60,14 +60,14 @@ use crate::{types::ResponseRouterData, utils::convert_amount}; + #[derive(Clone)] + pub struct Wise { + #[cfg(feature = "payouts")] +- amount_converter: &'static (dyn AmountConvertor + Sync), ++ amount_converter: &'static (dyn AmountConvertor + Sync), + } + + impl Wise { + pub fn new() -> &'static Self { + &Self { + #[cfg(feature = "payouts")] +- amount_converter: &MinorUnitForConnector, ++ amount_converter: &FloatMajorUnitForConnector, + } + } + } +@@ -133,7 +133,7 @@ impl ConnectorCommon for Wise { + event_builder.map(|i| i.set_response_body(&response)); + router_env::logger::info!(connector_response=?response); + +- let default_status = response.status.unwrap_or_default().to_string(); ++ let default_status = response.status.unwrap_or_default().get_status(); + match response.errors { + Some(errs) => { + if let Some(e) = errs.first() { +@@ -308,7 +308,7 @@ impl ConnectorIntegration for Wise { + event_builder.map(|i| i.set_error_response_body(&response)); + router_env::logger::info!(connector_response=?response); + +- let def_res = response.status.unwrap_or_default().to_string(); ++ let def_res = response.status.unwrap_or_default().get_status(); + let errors = response.errors.unwrap_or_default(); + let (code, message) = if let Some(e) = errors.first() { + (e.code.clone(), e.message.clone()) +diff --git a/crates/hyperswitch_connectors/src/connectors/wise/transformers.rs b/crates/hyperswitch_connectors/src/connectors/wise/transformers.rs +index 1e0c383d..a9655976 100644 +--- a/crates/hyperswitch_connectors/src/connectors/wise/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/wise/transformers.rs +@@ -8,7 +8,7 @@ use common_enums::PayoutEntityType; + use common_enums::{CountryAlpha2, PayoutStatus, PayoutType}; + #[cfg(feature = "payouts")] + use common_utils::pii::Email; +-use common_utils::types::MinorUnit; ++use common_utils::types::FloatMajorUnit; + use hyperswitch_domain_models::router_data::ConnectorAuthType; + #[cfg(feature = "payouts")] + use hyperswitch_domain_models::types::{PayoutsResponseData, PayoutsRouterData}; +@@ -27,12 +27,12 @@ type Error = error_stack::Report; + + #[derive(Debug, Serialize)] + pub struct WiseRouterData { +- pub amount: MinorUnit, ++ pub amount: FloatMajorUnit, + pub router_data: T, + } + +-impl From<(MinorUnit, T)> for WiseRouterData { +- fn from((amount, router_data): (MinorUnit, T)) -> Self { ++impl From<(FloatMajorUnit, T)> for WiseRouterData { ++ fn from((amount, router_data): (FloatMajorUnit, T)) -> Self { + Self { + amount, + router_data, +@@ -64,13 +64,35 @@ impl TryFrom<&ConnectorAuthType> for WiseAuthType { + pub struct ErrorResponse { + pub timestamp: Option, + pub errors: Option>, +- pub status: Option, ++ pub status: Option, + pub error: Option, + pub error_description: Option, + pub message: Option, + pub path: Option, + } + ++#[derive(Debug, Deserialize, Serialize)] ++#[serde(untagged)] ++pub enum WiseHttpStatus { ++ String(String), ++ Number(u16), ++} ++ ++impl Default for WiseHttpStatus { ++ fn default() -> Self { ++ Self::String("".to_string()) ++ } ++} ++ ++impl WiseHttpStatus { ++ pub fn get_status(&self) -> String { ++ match self { ++ Self::String(val) => val.clone(), ++ Self::Number(val) => val.to_string(), ++ } ++ } ++} ++ + #[derive(Debug, Deserialize, Serialize)] + pub struct SubError { + pub code: String, +@@ -179,8 +201,8 @@ pub struct WiseRecipientCreateResponse { + pub struct WisePayoutQuoteRequest { + source_currency: String, + target_currency: String, +- source_amount: Option, +- target_amount: Option, ++ source_amount: Option, ++ target_amount: Option, + pay_out: WisePayOutOption, + } + +----- END CHUNK ----- \ No newline at end of file diff --git a/raw/c9/c90625a4ea163e03895276a04ec3a23d4117413d.txt b/raw/c9/c90625a4ea163e03895276a04ec3a23d4117413d.txt new file mode 100644 index 0000000000000000000000000000000000000000..175e5309da289684331211ae55328c2d5f370d2f --- /dev/null +++ b/raw/c9/c90625a4ea163e03895276a04ec3a23d4117413d.txt @@ -0,0 +1,55 @@ +ROUTE: juspay/hyperswitch@c90625a4ea163e03895276a04ec3a23d4117413d +REPO: https://github.com/juspay/hyperswitch +COMMIT: c90625a4ea163e03895276a04ec3a23d4117413d +AUTHOR: github-actions <41898282+github-actions[bot]@users.noreply.github.com> +DATE: 2025-08-22T00:30:41 + +=== COMMIT === +SUBJECT: chore(version): 2025.08.22.0 + +=== FILES === +Summary: 1 files changed, +28 -0 +- CHANGELOG.md (+28 -0) + +=== PATCH === +diff --git a/CHANGELOG.md b/CHANGELOG.md +index a68e34f1..02297e40 100644 +--- a/CHANGELOG.md ++++ b/CHANGELOG.md +@@ -4,6 +4,34 @@ All notable changes to HyperSwitch will be documented here. + + - - - + ++## 2025.08.22.0 ++ ++### Features ++ ++- **connector:** ++ - [barclaycard] Implement 3DS flow for cards ([#8936](https://github.com/juspay/hyperswitch/pull/8936)) ([`19db2b5`](https://github.com/juspay/hyperswitch/commit/19db2b5cb8eb8abac1a7a6a57a68422c10e2a9b4)) ++ - Add integration status to feature matrix ([#8351](https://github.com/juspay/hyperswitch/pull/8351)) ([`6d984d4`](https://github.com/juspay/hyperswitch/commit/6d984d4859c349da8ab44914ee0ad37c94ef6e0c)) ++- **payment-link:** Update traditional chinese paymentlink exp msg ([#9007](https://github.com/juspay/hyperswitch/pull/9007)) ([`a819b46`](https://github.com/juspay/hyperswitch/commit/a819b4639b1e4279b117f4693cb0716b08e5e2e9)) ++- **payments:** Add PaymentListFilterConstraints and payments_list_by_filter endpoint for v2 ([#8794](https://github.com/juspay/hyperswitch/pull/8794)) ([`47ae990`](https://github.com/juspay/hyperswitch/commit/47ae9908e1b3adc6d889e13742959e466e878c79)) ++- **revenue:** Add support for hard-decline switch for revenue-recovery service ([#8879](https://github.com/juspay/hyperswitch/pull/8879)) ([`84a3492`](https://github.com/juspay/hyperswitch/commit/84a3492550118f4ad2a48beb50e87625605b6a82)) ++ ++### Bug Fixes ++ ++- **connector:** [STRIPE] Populate Error Message in Incremental Authorization Flow ([#9006](https://github.com/juspay/hyperswitch/pull/9006)) ([`8d398c6`](https://github.com/juspay/hyperswitch/commit/8d398c623d21f667a28224f78f0851394dd57477)) ++ ++### Refactors ++ ++- **connector:** [AdyenPlatform] update incoming webhooks for payouts ([#9002](https://github.com/juspay/hyperswitch/pull/9002)) ([`0269edf`](https://github.com/juspay/hyperswitch/commit/0269edf45b34dc7b9a8ab24596aa1d1ec9f6b475)) ++- **core:** Propagate merchant_reference_id for PaymentsAuthorizeData ([#9013](https://github.com/juspay/hyperswitch/pull/9013)) ([`49cd122`](https://github.com/juspay/hyperswitch/commit/49cd1225abb852bf4c024d39ce777caa98c58892)) ++ ++### Miscellaneous Tasks ++ ++- Include missing drop null constraint queries in v2_compatible_migrations ([#8940](https://github.com/juspay/hyperswitch/pull/8940)) ([`ebfaba8`](https://github.com/juspay/hyperswitch/commit/ebfaba872ad77bdfc50755ce830a6a8de5a231ce)) ++ ++**Full Changelog:** [`2025.08.21.0...2025.08.22.0`](https://github.com/juspay/hyperswitch/compare/2025.08.21.0...2025.08.22.0) ++ ++- - - ++ + ## 2025.08.21.0 + + ### Features + +----- END CHUNK ----- \ No newline at end of file diff --git a/raw/cb/cb34ec51e0f2b4ba071602f5fe974429de542b80.txt b/raw/cb/cb34ec51e0f2b4ba071602f5fe974429de542b80.txt new file mode 100644 index 0000000000000000000000000000000000000000..2c2cb0dbf71023c30327d8eb63fa61e5e54d30c1 --- /dev/null +++ b/raw/cb/cb34ec51e0f2b4ba071602f5fe974429de542b80.txt @@ -0,0 +1,2272 @@ +ROUTE: juspay/hyperswitch@cb34ec51e0f2b4ba071602f5fe974429de542b80 +REPO: https://github.com/juspay/hyperswitch +COMMIT: cb34ec51e0f2b4ba071602f5fe974429de542b80 +AUTHOR: awasthi21 <107559116+awasthi21@users.noreply.github.com> +DATE: 2025-08-22T16:30:03 + +=== ISSUE_AND_PR === +[PR #8701] feat(connector): [BHN] Add BHN GiftCard Flow( Alpha) +URL: https://github.com/juspay/hyperswitch/pull/8701 +BODY: +## Type of Change + + +- [ ] Bugfix +- [x] New feature +- [ ] Enhancement +- [ ] Refactoring +- [ ] Dependency updates +- [ ] Documentation +- [ ] CI/CD + +## Description + +Alpha Integ Added Gift Card Payments Flow + + +### Additional Changes + +- [ ] This PR modifies the API contract +- [ ] This PR modifies the database schema +- [x] This PR modifies application configuration/environment variables + + + + +## Motivation and Context + + + +## How did you test it? + + +Alpha Connector : For GIftCards We don't have Cypress +## Checklist + + +- [x] I formatted the code `cargo +nightly fmt --all` +- [x] I addressed lints thrown by `cargo clippy` +- [x] I reviewed the submitted code +- [ ] I added unit tests for my changes where possible +COMMENTS: +- semanticdiff-com[bot]: Review changes with  SemanticDiff +
+Changed Files +
+ +| File | Status | +| :--- | :--- | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/hyperswitch_connectors/src/connectors/stripe/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/stripe/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/hyperswitch_connectors/src/connectors/stripe/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/hyperswitch_connectors/src/connectors/stripe/transformers.rs)  92% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/hyperswitch_connectors/src/connectors/shift4/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/shift4/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/hyperswitch_connectors/src/connectors/shift4/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/hyperswitch_connectors/src/connectors/shift4/transformers.rs)  89% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/hyperswitch_connectors/src/connectors/zen/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/zen/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/hyperswitch_connectors/src/connectors/zen/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/hyperswitch_connectors/src/connectors/zen/transformers.rs)  89% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/hyperswitch_connectors/src/connectors/paypal/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/paypal/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/hyperswitch_connectors/src/connectors/paypal/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/hyperswitch_connectors/src/connectors/paypal/transformers.rs)  85% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/adyen/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs)  62% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/router/src/types/transformers.rs)  [crates/router/src/types/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/router/src/types/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/router/src/types/transformers.rs)  38% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/hyperswitch_connectors/src/connectors/blackhawknetwork.rs)  [crates/hyperswitch\_connectors/src/connectors/blackhawknetwork\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/hyperswitch_connectors/src/connectors/blackhawknetwork.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/hyperswitch_connectors/src/connectors/blackhawknetwork.rs)  36% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/hyperswitch_connectors/src/connectors/klarna.rs)  [crates/hyperswitch\_connectors/src/connectors/klarna\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/hyperswitch_connectors/src/connectors/klarna.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/hyperswitch_connectors/src/connectors/klarna.rs)  36% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/hyperswitch_connectors/src/connectors/adyen.rs)  [crates/hyperswitch\_connectors/src/connectors/adyen\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/hyperswitch_connectors/src/connectors/adyen.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/hyperswitch_connectors/src/connectors/adyen.rs)  36% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/hyperswitch_connectors/src/connectors/blackhawknetwork/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/blackhawknetwork/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/hyperswitch_connectors/src/connectors/blackhawknetwork/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/hyperswitch_connectors/src/connectors/blackhawknetwork/transformers.rs)  23% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/openapi/src/openapi.rs)  [crates/openapi/src/openapi\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/openapi/src/openapi.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/openapi/src/openapi.rs)  16% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/openapi/src/openapi_v2.rs)  [crates/openapi/src/openapi\_v2\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/openapi/src/openapi_v2.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/openapi/src/openapi_v2.rs)  16% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/common_enums/src/connector_enums.rs)  [crates/common\_enums/src/connector\_enums\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/common_enums/src/connector_enums.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/common_enums/src/connector_enums.rs)  8% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/hyperswitch_connectors/src/default_implementations.rs)  [crates/hyperswitch\_connectors/src/default\_implementations\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/hyperswitch_connectors/src/default_implementations.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/hyperswitch_connectors/src/default_implementations.rs)  1% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#api-reference/v1/openapi_spec_v1.json)  [api\-reference/v1/openapi\_spec\_v1\.json](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#api-reference/v1/openapi_spec_v1.json) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#api-reference/v1/openapi_spec_v1.json)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#api-reference/v2/openapi_spec_v2.json)  [api\-reference/v2/openapi\_spec\_v2\.json](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#api-reference/v2/openapi_spec_v2.json) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#api-reference/v2/openapi_spec_v2.json)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/api_models/src/payments.rs)  [crates/api\_models/src/payments\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/api_models/src/payments.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/api_models/src/payments.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/api_models/src/payments/additional_info.rs)  [crates/api\_models/src/payments/additional\_info\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/api_models/src/payments/additional_info.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/api_models/src/payments/additional_info.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/common_enums/src/enums.rs)  [crates/common\_enums/src/enums\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/common_enums/src/enums.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/common_enums/src/enums.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/common_enums/src/transformers.rs)  [crates/common\_enums/src/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/common_enums/src/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/common_enums/src/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/connector_configs/src/connector.rs)  [crates/connector\_configs/src/connector\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/connector_configs/src/connector.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/connector_configs/src/connector.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/connector_configs/toml/development.toml)  [crates/connector\_configs/toml/development\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/connector_configs/toml/development.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/connector_configs/toml/production.toml)  [crates/connector\_configs/toml/production\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/connector_configs/toml/production.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/connector_configs/toml/sandbox.toml)  [crates/connector\_configs/toml/sandbox\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/connector_configs/toml/sandbox.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/euclid/src/frontend/dir/enums.rs)  [crates/euclid/src/frontend/dir/enums\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/euclid/src/frontend/dir/enums.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/euclid/src/frontend/dir/enums.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/euclid/src/frontend/dir/lowering.rs)  [crates/euclid/src/frontend/dir/lowering\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/euclid/src/frontend/dir/lowering.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/euclid/src/frontend/dir/lowering.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/euclid/src/frontend/dir/transformers.rs)  [crates/euclid/src/frontend/dir/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/euclid/src/frontend/dir/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/euclid/src/frontend/dir/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/hyperswitch_connectors/src/utils.rs)  [crates/hyperswitch\_connectors/src/utils\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/hyperswitch_connectors/src/utils.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/hyperswitch_connectors/src/utils.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/hyperswitch_domain_models/src/payment_method_data.rs)  [crates/hyperswitch\_domain\_models/src/payment\_method\_data\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/hyperswitch_domain_models/src/payment_method_data.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/hyperswitch_domain_models/src/payment_method_data.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/kgraph_utils/src/mca.rs)  [crates/kgraph\_utils/src/mca\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/kgraph_utils/src/mca.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/kgraph_utils/src/mca.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/kgraph_utils/src/transformers.rs)  [crates/kgraph\_utils/src/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/kgraph_utils/src/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/kgraph_utils/src/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/router/src/connector/utils.rs)  [crates/router/src/connector/utils\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/router/src/connector/utils.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/router/src/connector/utils.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/router/src/core/connector_validation.rs)  [crates/router/src/core/connector\_validation\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/router/src/core/connector_validation.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/router/src/core/connector_validation.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/router/src/types/api/connector_mapping.rs)  [crates/router/src/types/api/connector\_mapping\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/router/src/types/api/connector_mapping.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/router/src/types/api/connector_mapping.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/router/src/types/api/feature_matrix.rs)  [crates/router/src/types/api/feature\_matrix\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/router/src/types/api/feature_matrix.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/router/src/types/api/feature_matrix.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/router/src/types/connector_transformers.rs)  [crates/router/src/types/connector\_transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/router/src/types/connector_transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8701/changes#crates/router/src/types/connector_transformers.rs)  0% smaller | + +
+- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/blackhawknetwork.rs:473]: lets not update status in get_error_response +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/blackhawknetwork.rs:527]: Please add feature matrix changes. +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/blackhawknetwork/transformers.rs:175]: Check if we are getting this value in seconds or minutes? +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/blackhawknetwork/transformers.rs:228]: Please make this enum +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/blackhawknetwork/transformers.rs:376]: Mark these as pending for status new +- deepanshu-iiitu [crates/connector_configs/toml/development.toml:6622]: Please add dashboard configs for all environments +- awasthi21 [crates/hyperswitch_connectors/src/connectors/blackhawknetwork/transformers.rs:175]: Its in seconds + + +=== COMMIT === +SUBJECT: feat(connector): [BHN] Add BHN GiftCard Flow( Alpha) (#8701) +BODY: +Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> + +=== FILES === +Summary: 36 files changed, +793 -444 +- api-reference/v1/openapi_spec_v1.json (+52 -0) +- api-reference/v2/openapi_spec_v2.json (+52 -0) +- crates/api_models/src/payments.rs (+18 -0) +- crates/api_models/src/payments/additional_info.rs (+1 -0) +- crates/common_enums/src/connector_enums.rs (+5 -0) +- crates/common_enums/src/enums.rs (+2 -0) +- crates/common_enums/src/transformers.rs (+1 -0) +- crates/connector_configs/src/connector.rs (+1 -0) +- crates/connector_configs/toml/development.toml (+8 -4) +- crates/connector_configs/toml/production.toml (+8 -3) +- crates/connector_configs/toml/sandbox.toml (+8 -3) +- crates/euclid/src/frontend/dir/enums.rs (+1 -0) +- crates/euclid/src/frontend/dir/lowering.rs (+1 -0) +- crates/euclid/src/frontend/dir/transformers.rs (+3 -0) +- crates/hyperswitch_connectors/src/connectors/adyen.rs (+1 -0) +- crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs (+10 -4) +- crates/hyperswitch_connectors/src/connectors/blackhawknetwork.rs (+266 -307) +- crates/hyperswitch_connectors/src/connectors/blackhawknetwork/transformers.rs (+277 -95) +- crates/hyperswitch_connectors/src/connectors/klarna.rs (+4 -0) +- crates/hyperswitch_connectors/src/connectors/paypal/transformers.rs (+7 -6) +- crates/hyperswitch_connectors/src/connectors/shift4/transformers.rs (+6 -6) +- crates/hyperswitch_connectors/src/connectors/stripe/transformers.rs (+7 -6) +- crates/hyperswitch_connectors/src/connectors/zen/transformers.rs (+6 -6) +- crates/hyperswitch_connectors/src/default_implementations.rs (+0 -1) +- crates/hyperswitch_connectors/src/utils.rs (+2 -0) +- crates/hyperswitch_domain_models/src/payment_method_data.rs (+24 -0) +- crates/kgraph_utils/src/mca.rs (+1 -0) +- crates/kgraph_utils/src/transformers.rs (+3 -0) +- crates/openapi/src/openapi.rs (+1 -0) +- crates/openapi/src/openapi_v2.rs (+1 -0) +- crates/router/src/connector/utils.rs (+2 -0) +- crates/router/src/core/connector_validation.rs (+4 -0) +- crates/router/src/types/api/connector_mapping.rs (+3 -0) +- crates/router/src/types/api/feature_matrix.rs (+3 -0) +- crates/router/src/types/connector_transformers.rs (+1 -0) +- crates/router/src/types/transformers.rs (+3 -3) + +=== PATCH === +diff --git a/api-reference/v1/openapi_spec_v1.json b/api-reference/v1/openapi_spec_v1.json +index 3f54ca3a..1097811d 100644 +--- a/api-reference/v1/openapi_spec_v1.json ++++ b/api-reference/v1/openapi_spec_v1.json +@@ -8593,6 +8593,33 @@ + "unresolved" + ] + }, ++ "BHNGiftCardDetails": { ++ "type": "object", ++ "required": [ ++ "account_number", ++ "pin", ++ "cvv2", ++ "expiration_date" ++ ], ++ "properties": { ++ "account_number": { ++ "type": "string", ++ "description": "The gift card or account number" ++ }, ++ "pin": { ++ "type": "string", ++ "description": "The security PIN for gift cards requiring it" ++ }, ++ "cvv2": { ++ "type": "string", ++ "description": "The CVV2 code for Open Loop/VPLN products" ++ }, ++ "expiration_date": { ++ "type": "string", ++ "description": "The expiration date in MMYYYY format for Open Loop/VPLN products" ++ } ++ } ++ }, + "BacsBankDebitAdditionalData": { + "type": "object", + "required": [ +@@ -11814,6 +11841,7 @@ + "billwerk", + "bitpay", + "bluesnap", ++ "blackhawknetwork", + "bluecode", + "boku", + "braintree", +@@ -15738,6 +15766,17 @@ + "type": "object" + } + } ++ }, ++ { ++ "type": "object", ++ "required": [ ++ "bhn_card_network" ++ ], ++ "properties": { ++ "bhn_card_network": { ++ "type": "object" ++ } ++ } + } + ] + }, +@@ -15764,6 +15803,17 @@ + "type": "object" + } + } ++ }, ++ { ++ "type": "object", ++ "required": [ ++ "bhn_card_network" ++ ], ++ "properties": { ++ "bhn_card_network": { ++ "$ref": "#/components/schemas/BHNGiftCardDetails" ++ } ++ } + } + ] + }, +@@ -22006,6 +22056,7 @@ + "bni_va", + "breadpay", + "bri_va", ++ "bhn_card_network", + "card_redirect", + "cimb_va", + "classic", +@@ -29796,6 +29847,7 @@ + "billwerk", + "bitpay", + "bambora", ++ "blackhawknetwork", + "bamboraapac", + "bluesnap", + "bluecode", +diff --git a/api-reference/v2/openapi_spec_v2.json b/api-reference/v2/openapi_spec_v2.json +index d212afa8..5bf81377 100644 +--- a/api-reference/v2/openapi_spec_v2.json ++++ b/api-reference/v2/openapi_spec_v2.json +@@ -5054,6 +5054,33 @@ + "unresolved" + ] + }, ++ "BHNGiftCardDetails": { ++ "type": "object", ++ "required": [ ++ "account_number", ++ "pin", ++ "cvv2", ++ "expiration_date" ++ ], ++ "properties": { ++ "account_number": { ++ "type": "string", ++ "description": "The gift card or account number" ++ }, ++ "pin": { ++ "type": "string", ++ "description": "The security PIN for gift cards requiring it" ++ }, ++ "cvv2": { ++ "type": "string", ++ "description": "The CVV2 code for Open Loop/VPLN products" ++ }, ++ "expiration_date": { ++ "type": "string", ++ "description": "The expiration date in MMYYYY format for Open Loop/VPLN products" ++ } ++ } ++ }, + "BacsBankDebitAdditionalData": { + "type": "object", + "required": [ +@@ -8358,6 +8385,7 @@ + "billwerk", + "bitpay", + "bluesnap", ++ "blackhawknetwork", + "bluecode", + "boku", + "braintree", +@@ -11884,6 +11912,17 @@ + "type": "object" + } + } ++ }, ++ { ++ "type": "object", ++ "required": [ ++ "bhn_card_network" ++ ], ++ "properties": { ++ "bhn_card_network": { ++ "type": "object" ++ } ++ } + } + ] + }, +@@ -11910,6 +11949,17 @@ + "type": "object" + } + } ++ }, ++ { ++ "type": "object", ++ "required": [ ++ "bhn_card_network" ++ ], ++ "properties": { ++ "bhn_card_network": { ++ "$ref": "#/components/schemas/BHNGiftCardDetails" ++ } ++ } + } + ] + }, +@@ -18263,6 +18313,7 @@ + "bni_va", + "breadpay", + "bri_va", ++ "bhn_card_network", + "card_redirect", + "cimb_va", + "classic", +@@ -23450,6 +23501,7 @@ + "billwerk", + "bitpay", + "bambora", ++ "blackhawknetwork", + "bamboraapac", + "bluesnap", + "bluecode", +diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs +index 61ee4998..5660819c 100644 +--- a/crates/api_models/src/payments.rs ++++ b/crates/api_models/src/payments.rs +@@ -3024,6 +3024,7 @@ impl GetPaymentMethodType for GiftCardData { + match self { + Self::Givex(_) => api_enums::PaymentMethodType::Givex, + Self::PaySafeCard {} => api_enums::PaymentMethodType::PaySafeCard, ++ Self::BhnCardNetwork(_) => api_enums::PaymentMethodType::BhnCardNetwork, + } + } + } +@@ -3033,6 +3034,23 @@ impl GetPaymentMethodType for GiftCardData { + pub enum GiftCardData { + Givex(GiftCardDetails), + PaySafeCard {}, ++ BhnCardNetwork(BHNGiftCardDetails), ++} ++#[derive(serde::Deserialize, serde::Serialize, Debug, Clone, ToSchema, Eq, PartialEq)] ++#[serde(rename_all = "snake_case")] ++pub struct BHNGiftCardDetails { ++ /// The gift card or account number ++ #[schema(value_type = String)] ++ pub account_number: Secret, ++ /// The security PIN for gift cards requiring it ++ #[schema(value_type = String)] ++ pub pin: Option>, ++ /// The CVV2 code for Open Loop/VPLN products ++ #[schema(value_type = String)] ++ pub cvv2: Option>, ++ /// The expiration date in MMYYYY format for Open Loop/VPLN products ++ #[schema(value_type = String)] ++ pub expiration_date: Option, + } + + #[derive(serde::Deserialize, serde::Serialize, Debug, Clone, ToSchema, Eq, PartialEq)] +diff --git a/crates/api_models/src/payments/additional_info.rs b/crates/api_models/src/payments/additional_info.rs +index de7493ca..d580a288 100644 +--- a/crates/api_models/src/payments/additional_info.rs ++++ b/crates/api_models/src/payments/additional_info.rs +@@ -200,6 +200,7 @@ pub struct LocalBankTransferAdditionalData { + pub enum GiftCardAdditionalData { + Givex(Box), + PaySafeCard {}, ++ BhnCardNetwork {}, + } + + #[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)] +diff --git a/crates/common_enums/src/connector_enums.rs b/crates/common_enums/src/connector_enums.rs +index cb0e4462..9d73bc6b 100644 +--- a/crates/common_enums/src/connector_enums.rs ++++ b/crates/common_enums/src/connector_enums.rs +@@ -70,6 +70,7 @@ pub enum RoutableConnectors { + Billwerk, + Bitpay, + Bambora, ++ Blackhawknetwork, + Bamboraapac, + Bluesnap, + Bluecode, +@@ -239,6 +240,7 @@ pub enum Connector { + Billwerk, + Bitpay, + Bluesnap, ++ Blackhawknetwork, + Bluecode, + Boku, + Braintree, +@@ -436,6 +438,7 @@ impl Connector { + | Self::Billwerk + | Self::Bitpay + | Self::Bluesnap ++ | Self::Blackhawknetwork + | Self::Bluecode + | Self::Boku + | Self::Braintree +@@ -608,6 +611,7 @@ impl From for Connector { + RoutableConnectors::Bambora => Self::Bambora, + RoutableConnectors::Bamboraapac => Self::Bamboraapac, + RoutableConnectors::Bluesnap => Self::Bluesnap, ++ RoutableConnectors::Blackhawknetwork => Self::Blackhawknetwork, + RoutableConnectors::Bluecode => Self::Bluecode, + RoutableConnectors::Boku => Self::Boku, + RoutableConnectors::Braintree => Self::Braintree, +@@ -738,6 +742,7 @@ impl TryFrom for RoutableConnectors { + Connector::Bambora => Ok(Self::Bambora), + Connector::Bamboraapac => Ok(Self::Bamboraapac), + Connector::Bluesnap => Ok(Self::Bluesnap), ++ Connector::Blackhawknetwork => Ok(Self::Blackhawknetwork), + Connector::Bluecode => Ok(Self::Bluecode), + Connector::Boku => Ok(Self::Boku), + Connector::Braintree => Ok(Self::Braintree), +diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs +index 22091eca..07916214 100644 +--- a/crates/common_enums/src/enums.rs ++++ b/crates/common_enums/src/enums.rs +@@ -1966,6 +1966,7 @@ pub enum PaymentMethodType { + BniVa, + Breadpay, + BriVa, ++ BhnCardNetwork, + #[cfg(feature = "v2")] + Card, + CardRedirect, +@@ -2089,6 +2090,7 @@ impl PaymentMethodType { + Self::BniVa => "BNI Virtual Account", + Self::Breadpay => "Breadpay", + Self::BriVa => "BRI Virtual Account", ++ Self::BhnCardNetwork => "BHN Card Network", + Self::CardRedirect => "Card Redirect", + Self::CimbVa => "CIMB Virtual Account", + Self::ClassicReward => "Classic Reward", +diff --git a/crates/common_enums/src/transformers.rs b/crates/common_enums/src/transformers.rs +index f897c8c2..a2039e62 100644 +--- a/crates/common_enums/src/transformers.rs ++++ b/crates/common_enums/src/transformers.rs +@@ -1892,6 +1892,7 @@ impl From for PaymentMethod { + PaymentMethodType::RedCompra => Self::Voucher, + PaymentMethodType::RedPagos => Self::Voucher, + PaymentMethodType::Cashapp => Self::Wallet, ++ PaymentMethodType::BhnCardNetwork => Self::GiftCard, + PaymentMethodType::Givex => Self::GiftCard, + PaymentMethodType::Oxxo => Self::Voucher, + PaymentMethodType::OpenBankingUk => Self::BankRedirect, +diff --git a/crates/connector_configs/src/connector.rs b/crates/connector_configs/src/connector.rs +index 63fb9640..7a77a241 100644 +--- a/crates/connector_configs/src/connector.rs ++++ b/crates/connector_configs/src/connector.rs +@@ -409,6 +409,7 @@ impl ConnectorConfig { + Connector::Bitpay => Ok(connector_data.bitpay), + Connector::Bluesnap => Ok(connector_data.bluesnap), + Connector::Bluecode => Ok(connector_data.bluecode), ++ Connector::Blackhawknetwork => Ok(connector_data.blackhawknetwork), + Connector::Boku => Ok(connector_data.boku), + Connector::Braintree => Ok(connector_data.braintree), + Connector::Breadpay => Ok(connector_data.breadpay), +diff --git a/crates/connector_configs/toml/development.toml b/crates/connector_configs/toml/development.toml +index 160a29aa..5904ee6d 100644 +--- a/crates/connector_configs/toml/development.toml ++++ b/crates/connector_configs/toml/development.toml +@@ -6571,6 +6571,14 @@ placeholder="Enter the merchant name" + required=true + type="Text" + ++[blackhawknetwork] ++[[blackhawknetwork.gift_card]] ++ payment_method_type = "bhn_card_network" ++[blackhawknetwork.connector_auth.SignatureKey] ++api_key="Client Id" ++api_secret="Client Secret" ++key1="Product Line Id" ++ + [payload] + [[payload.credit]] + payment_method_type = "AmericanExpress" +@@ -6616,10 +6624,6 @@ merchant_secret="Source verification key" + [affirm.connector_auth.HeaderKey] + api_key = "API Key" + +-[blackhawknetwork] +-[blackhawknetwork.connector_auth.HeaderKey] +-api_key = "API Key" +- + [trustpayments] + [trustpayments.connector_auth.HeaderKey] + api_key = "API Key" +diff --git a/crates/connector_configs/toml/production.toml b/crates/connector_configs/toml/production.toml +index 47aff66d..c3d6fe5c 100644 +--- a/crates/connector_configs/toml/production.toml ++++ b/crates/connector_configs/toml/production.toml +@@ -5225,6 +5225,14 @@ placeholder = "Enter the merchant name" + required = true + type = "Text" + ++[blackhawknetwork] ++[[blackhawknetwork.gift_card]] ++ payment_method_type = "bhn_card_network" ++[blackhawknetwork.connector_auth.SignatureKey] ++api_key="Client Id" ++api_secret="Client Secret" ++key1="Product Line Id" ++ + [payload] + [[payload.credit]] + payment_method_type = "AmericanExpress" +@@ -5274,9 +5282,6 @@ api_key = "API Key" + [trustpayments.connector_auth.HeaderKey] + api_key = "API Key" + +-[blackhawknetwork] +-[blackhawknetwork.connector_auth.HeaderKey] +-api_key = "API Key" + + [flexiti] + [flexiti.connector_auth.BodyKey] +diff --git a/crates/connector_configs/toml/sandbox.toml b/crates/connector_configs/toml/sandbox.toml +index d1ea6ba6..77cbac84 100644 +--- a/crates/connector_configs/toml/sandbox.toml ++++ b/crates/connector_configs/toml/sandbox.toml +@@ -6554,6 +6554,14 @@ placeholder = "Enter the merchant name" + required = true + type = "Text" + ++[blackhawknetwork] ++[[blackhawknetwork.gift_card]] ++ payment_method_type = "bhn_card_network" ++[blackhawknetwork.connector_auth.SignatureKey] ++api_key="Client Id" ++api_secret="Client Secret" ++key1="Product Line Id" ++ + [payload] + [[payload.credit]] + payment_method_type = "AmericanExpress" +@@ -6603,9 +6611,6 @@ api_key = "API Key" + [trustpayments.connector_auth.HeaderKey] + api_key = "API Key" + +-[blackhawknetwork] +-[blackhawknetwork.connector_auth.HeaderKey] +-api_key = "API Key" + + [breadpay] + [breadpay.connector_auth.BodyKey] +diff --git a/crates/euclid/src/frontend/dir/enums.rs b/crates/euclid/src/frontend/dir/enums.rs +index 0cc056a9..5eeeeb67 100644 +--- a/crates/euclid/src/frontend/dir/enums.rs ++++ b/crates/euclid/src/frontend/dir/enums.rs +@@ -247,6 +247,7 @@ pub enum BankTransferType { + pub enum GiftCardType { + PaySafeCard, + Givex, ++ BhnCardNetwork, + } + + #[derive( +diff --git a/crates/euclid/src/frontend/dir/lowering.rs b/crates/euclid/src/frontend/dir/lowering.rs +index b2853fbd..113a2868 100644 +--- a/crates/euclid/src/frontend/dir/lowering.rs ++++ b/crates/euclid/src/frontend/dir/lowering.rs +@@ -142,6 +142,7 @@ impl From for global_enums::PaymentMethodType { + match value { + enums::GiftCardType::PaySafeCard => Self::PaySafeCard, + enums::GiftCardType::Givex => Self::Givex, ++ enums::GiftCardType::BhnCardNetwork => Self::BhnCardNetwork, + } + } + } +diff --git a/crates/euclid/src/frontend/dir/transformers.rs b/crates/euclid/src/frontend/dir/transformers.rs +index 0f0e8b96..28e49885 100644 +--- a/crates/euclid/src/frontend/dir/transformers.rs ++++ b/crates/euclid/src/frontend/dir/transformers.rs +@@ -204,6 +204,9 @@ impl IntoDirValue for (global_enums::PaymentMethodType, global_enums::PaymentMet + global_enums::PaymentMethodType::IndonesianBankTransfer => { + Ok(dirval!(BankTransferType = IndonesianBankTransfer)) + } ++ global_enums::PaymentMethodType::BhnCardNetwork => { ++ Ok(dirval!(GiftCardType = BhnCardNetwork)) ++ } + } + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/adyen.rs b/crates/hyperswitch_connectors/src/connectors/adyen.rs +index fffef7fd..47f2eefe 100644 +--- a/crates/hyperswitch_connectors/src/connectors/adyen.rs ++++ b/crates/hyperswitch_connectors/src/connectors/adyen.rs +@@ -311,6 +311,7 @@ impl ConnectorValidation for Adyen { + | PaymentMethodType::CardRedirect + | PaymentMethodType::DirectCarrierBilling + | PaymentMethodType::Fps ++ | PaymentMethodType::BhnCardNetwork + | PaymentMethodType::DuitNow + | PaymentMethodType::Interac + | PaymentMethodType::Multibanco +diff --git a/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs b/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs +index 63c1b0d8..76a13085 100644 +--- a/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs +@@ -1780,10 +1780,12 @@ impl TryFrom<&PaymentsPreProcessingRouterData> for AdyenBalanceRequest<'_> { + balance_pm, + ))) + } +- GiftCardData::PaySafeCard {} => Err(errors::ConnectorError::FlowNotSupported { +- flow: "Balance".to_string(), +- connector: "adyen".to_string(), +- }), ++ GiftCardData::PaySafeCard {} | GiftCardData::BhnCardNetwork(_) => { ++ Err(errors::ConnectorError::FlowNotSupported { ++ flow: "Balance".to_string(), ++ connector: "adyen".to_string(), ++ }) ++ } + }, + _ => Err(errors::ConnectorError::FlowNotSupported { + flow: "Balance".to_string(), +@@ -2130,6 +2132,10 @@ impl TryFrom<&GiftCardData> for AdyenPaymentMethod<'_> { + }; + Ok(AdyenPaymentMethod::AdyenGiftCard(Box::new(gift_card_pm))) + } ++ GiftCardData::BhnCardNetwork(_) => Err(errors::ConnectorError::NotImplemented( ++ utils::get_unimplemented_payment_method_error_message("Adyen"), ++ ) ++ .into()), + } + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/blackhawknetwork.rs b/crates/hyperswitch_connectors/src/connectors/blackhawknetwork.rs +index 60ebf16f..a6c12d16 100644 +--- a/crates/hyperswitch_connectors/src/connectors/blackhawknetwork.rs ++++ b/crates/hyperswitch_connectors/src/connectors/blackhawknetwork.rs +@@ -1,13 +1,12 @@ + pub mod transformers; +- + use std::sync::LazyLock; + +-use common_enums::enums; ++use common_enums::{enums, enums::PaymentMethodType}; + use common_utils::{ + errors::CustomResult, + ext_traits::BytesExt, + request::{Method, Request, RequestBuilder, RequestContent}, +- types::{AmountConvertor, StringMinorUnit, StringMinorUnitForConnector}, ++ types::{AmountConvertor, StringMajorUnit, StringMajorUnitForConnector}, + }; + use error_stack::{report, ResultExt}; + use hyperswitch_domain_models::{ +@@ -15,20 +14,24 @@ use hyperswitch_domain_models::{ + router_data::{AccessToken, ConnectorAuthType, ErrorResponse, RouterData}, + router_flow_types::{ + access_token_auth::AccessTokenAuth, +- payments::{Authorize, Capture, PSync, PaymentMethodToken, Session, SetupMandate, Void}, ++ payments::{ ++ Authorize, Capture, PSync, PaymentMethodToken, PreProcessing, Session, SetupMandate, ++ Void, ++ }, + refunds::{Execute, RSync}, + }, + router_request_types::{ + AccessTokenRequestData, PaymentMethodTokenizationData, PaymentsAuthorizeData, +- PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData, +- RefundsData, SetupMandateRequestData, ++ PaymentsCancelData, PaymentsCaptureData, PaymentsPreProcessingData, PaymentsSessionData, ++ PaymentsSyncData, RefundsData, SetupMandateRequestData, + }, + router_response_types::{ +- ConnectorInfo, PaymentsResponseData, RefundsResponseData, SupportedPaymentMethods, ++ ConnectorInfo, PaymentMethodDetails, PaymentsResponseData, RefundsResponseData, ++ SupportedPaymentMethods, SupportedPaymentMethodsExt, + }, + types::{ +- PaymentsAuthorizeRouterData, PaymentsCaptureRouterData, PaymentsSyncRouterData, +- RefundSyncRouterData, RefundsRouterData, ++ PaymentsAuthorizeRouterData, PaymentsCaptureRouterData, PaymentsPreProcessingRouterData, ++ PaymentsSyncRouterData, RefreshTokenRouterData, RefundSyncRouterData, RefundsRouterData, + }, + }; + use hyperswitch_interfaces::{ +@@ -37,25 +40,26 @@ use hyperswitch_interfaces::{ + ConnectorValidation, + }, + configs::Connectors, ++ consts::NO_ERROR_MESSAGE, + errors, + events::connector_api_logs::ConnectorEvent, + types::{self, Response}, + webhooks, + }; +-use masking::{ExposeInterface, Mask}; ++use masking::Maskable; + use transformers as blackhawknetwork; + + use crate::{constants::headers, types::ResponseRouterData, utils}; + + #[derive(Clone)] + pub struct Blackhawknetwork { +- amount_converter: &'static (dyn AmountConvertor + Sync), ++ amount_converter: &'static (dyn AmountConvertor + Sync), + } + + impl Blackhawknetwork { + pub fn new() -> &'static Self { + &Self { +- amount_converter: &StringMinorUnitForConnector, ++ amount_converter: &StringMajorUnitForConnector, + } + } + } +@@ -72,6 +76,92 @@ impl api::Refund for Blackhawknetwork {} + impl api::RefundExecute for Blackhawknetwork {} + impl api::RefundSync for Blackhawknetwork {} + impl api::PaymentToken for Blackhawknetwork {} ++impl api::PaymentsPreProcessing for Blackhawknetwork {} ++ ++impl ConnectorIntegration ++ for Blackhawknetwork ++{ ++ fn get_headers( ++ &self, ++ _req: &RefreshTokenRouterData, ++ _connectors: &Connectors, ++ ) -> CustomResult)>, errors::ConnectorError> { ++ Ok(vec![( ++ headers::CONTENT_TYPE.to_string(), ++ "application/x-www-form-urlencoded".to_string().into(), ++ )]) ++ } ++ ++ fn get_content_type(&self) -> &'static str { ++ "application/x-www-form-urlencoded" ++ } ++ ++ fn get_url( ++ &self, ++ _req: &RefreshTokenRouterData, ++ connectors: &Connectors, ++ ) -> CustomResult { ++ Ok(format!( ++ "{}/realms/dev-experience/protocol/openid-connect/token", ++ self.base_url(connectors) ++ )) ++ } ++ ++ fn get_request_body( ++ &self, ++ req: &RefreshTokenRouterData, ++ _connectors: &Connectors, ++ ) -> CustomResult { ++ let auth = blackhawknetwork::BlackhawknetworkAuthType::try_from(&req.connector_auth_type)?; ++ let connector_req = blackhawknetwork::BlackhawknetworkAccessTokenRequest { ++ grant_type: "client_credentials".to_string(), ++ client_id: auth.client_id.clone(), ++ client_secret: auth.client_secret.clone(), ++ scope: "openid".to_string(), ++ }; ++ Ok(RequestContent::FormUrlEncoded(Box::new(connector_req))) ++ } ++ ++ fn build_request( ++ &self, ++ req: &RefreshTokenRouterData, ++ connectors: &Connectors, ++ ) -> CustomResult, errors::ConnectorError> { ++ let request = RequestBuilder::new() ++ .method(Method::Post) ++ .url(&types::RefreshTokenType::get_url(self, req, connectors)?) ++ .attach_default_headers() ++ .headers(types::RefreshTokenType::get_headers(self, req, connectors)?) ++ .set_body(types::RefreshTokenType::get_request_body( ++ self, req, connectors, ++ )?) ++ .build(); ++ Ok(Some(request)) ++ } ++ ++ fn handle_response( ++ &self, ++ data: &RefreshTokenRouterData, ++ event_builder: Option<&mut ConnectorEvent>, ++ res: Response, ++ ) -> CustomResult { ++ let response: blackhawknetwork::BlackhawknetworkTokenResponse = res ++ .response ++ .parse_struct("BlackhawknetworkTokenResponse") ++ .or_else(|_| res.response.parse_struct("BlackhawknetworkErrorResponse")) ++ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; ++ ++ event_builder.map(|i| i.set_response_body(&response)); ++ router_env::logger::info!(connector_response=?response); ++ ++ RouterData::try_from(ResponseRouterData { ++ response, ++ data: data.clone(), ++ http_code: res.status_code, ++ }) ++ .change_context(errors::ConnectorError::ResponseHandlingFailed) ++ } ++} + + impl ConnectorIntegration + for Blackhawknetwork +@@ -87,7 +177,7 @@ where + &self, + req: &RouterData, + _connectors: &Connectors, +- ) -> CustomResult)>, errors::ConnectorError> { ++ ) -> CustomResult)>, errors::ConnectorError> { + let mut header = vec![( + headers::CONTENT_TYPE.to_string(), + self.get_content_type().to_string().into(), +@@ -104,10 +194,7 @@ impl ConnectorCommon for Blackhawknetwork { + } + + fn get_currency_unit(&self) -> api::CurrencyUnit { +- api::CurrencyUnit::Minor +- // TODO! Check connector documentation, on which unit they are processing the currency. +- // If the connector accepts amount in lower unit ( i.e cents for USD) then return api::CurrencyUnit::Minor, +- // if connector accepts amount in base unit (i.e dollars for USD) then return api::CurrencyUnit::Base ++ api::CurrencyUnit::Base + } + + fn common_get_content_type(&self) -> &'static str { +@@ -120,14 +207,9 @@ impl ConnectorCommon for Blackhawknetwork { + + fn get_auth_header( + &self, +- auth_type: &ConnectorAuthType, +- ) -> CustomResult)>, errors::ConnectorError> { +- let auth = blackhawknetwork::BlackhawknetworkAuthType::try_from(auth_type) +- .change_context(errors::ConnectorError::FailedToObtainAuthType)?; +- Ok(vec![( +- headers::AUTHORIZATION.to_string(), +- auth.api_key.expose().into_masked(), +- )]) ++ _auth_type: &ConnectorAuthType, ++ ) -> CustomResult)>, errors::ConnectorError> { ++ Ok(vec![]) + } + + fn build_error_response( +@@ -145,9 +227,12 @@ impl ConnectorCommon for Blackhawknetwork { + + Ok(ErrorResponse { + status_code: res.status_code, +- code: response.code, +- message: response.message, +- reason: response.reason, ++ code: response.error, ++ message: response ++ .error_description ++ .clone() ++ .unwrap_or(NO_ERROR_MESSAGE.to_owned()), ++ reason: response.error_description, + attempt_status: None, + connector_transaction_id: None, + network_advice_code: None, +@@ -161,7 +246,7 @@ impl ConnectorCommon for Blackhawknetwork { + impl ConnectorValidation for Blackhawknetwork { + fn validate_mandate_payment( + &self, +- _pm_type: Option, ++ _pm_type: Option, + pm_data: PaymentMethodData, + ) -> CustomResult<(), errors::ConnectorError> { + match pm_data { +@@ -187,38 +272,112 @@ impl ConnectorValidation for Blackhawknetwork { + impl ConnectorIntegration for Blackhawknetwork { + //TODO: implement sessions flow + } +- +-impl ConnectorIntegration ++impl ConnectorIntegration + for Blackhawknetwork + { ++ fn get_headers( ++ &self, ++ req: &PaymentsPreProcessingRouterData, ++ _connectors: &Connectors, ++ ) -> CustomResult)>, errors::ConnectorError> { ++ let mut headers = vec![( ++ headers::CONTENT_TYPE.to_string(), ++ "application/x-www-form-urlencoded".to_string().into(), ++ )]; ++ let mut auth_header = self.get_auth_header(&req.connector_auth_type)?; ++ headers.append(&mut auth_header); ++ Ok(headers) ++ } ++ ++ fn get_url( ++ &self, ++ req: &PaymentsPreProcessingRouterData, ++ connectors: &Connectors, ++ ) -> CustomResult { ++ let base_url = self.base_url(connectors); ++ let connector_req = blackhawknetwork::BlackhawknetworkVerifyAccountRequest::try_from(req)?; ++ let query = serde_urlencoded::to_string(&connector_req) ++ .change_context(errors::ConnectorError::RequestEncodingFailed)?; ++ Ok(format!( ++ "{base_url}/accountProcessing/v1/verifyAccount?{query}" ++ )) ++ } ++ ++ fn build_request( ++ &self, ++ req: &PaymentsPreProcessingRouterData, ++ connectors: &Connectors, ++ ) -> CustomResult, errors::ConnectorError> { ++ Ok(Some( ++ RequestBuilder::new() ++ .method(Method::Get) ++ .url(&types::PaymentsPreProcessingType::get_url( ++ self, req, connectors, ++ )?) ++ .attach_default_headers() ++ .headers(types::PaymentsPreProcessingType::get_headers( ++ self, req, connectors, ++ )?) ++ .build(), ++ )) ++ } ++ ++ fn handle_response( ++ &self, ++ data: &PaymentsPreProcessingRouterData, ++ event_builder: Option<&mut ConnectorEvent>, ++ res: Response, ++ ) -> CustomResult { ++ let response: blackhawknetwork::BlackhawknetworkVerifyAccountResponse = res ++ .response ++ .parse_struct("BlackhawknetworkVerifyAccountResponse") ++ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; ++ event_builder.map(|i| i.set_response_body(&response)); ++ router_env::logger::info!(connector_response=?response); ++ ++ RouterData::try_from(ResponseRouterData { ++ response, ++ data: data.clone(), ++ http_code: res.status_code, ++ }) ++ .change_context(errors::ConnectorError::ResponseHandlingFailed) ++ } + } + + impl ConnectorIntegration + for Blackhawknetwork + { + } +- + impl ConnectorIntegration + for Blackhawknetwork + { + fn get_headers( + &self, + req: &PaymentsAuthorizeRouterData, +- connectors: &Connectors, +- ) -> CustomResult)>, errors::ConnectorError> { +- self.build_headers(req, connectors) ++ _connectors: &Connectors, ++ ) -> CustomResult)>, errors::ConnectorError> { ++ let mut headers = vec![( ++ headers::CONTENT_TYPE.to_string(), ++ "application/json".to_string().into(), ++ )]; ++ let mut auth_header = self.get_auth_header(&req.connector_auth_type)?; ++ headers.append(&mut auth_header); ++ Ok(headers) + } + + fn get_content_type(&self) -> &'static str { +- self.common_get_content_type() ++ "application/json" + } + + fn get_url( + &self, + _req: &PaymentsAuthorizeRouterData, +- _connectors: &Connectors, ++ connectors: &Connectors, + ) -> CustomResult { +- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into()) ++ Ok(format!( ++ "{}/accountProcessing/v1/redeem", ++ self.base_url(connectors) ++ )) + } + + fn get_request_body( +@@ -231,7 +390,6 @@ impl ConnectorIntegration, + res: Response, + ) -> CustomResult { +- let response: blackhawknetwork::BlackhawknetworkPaymentsResponse = res ++ let response: blackhawknetwork::BlackhawknetworkRedeemResponse = res + .response +- .parse_struct("Blackhawknetwork PaymentsAuthorizeResponse") ++ .parse_struct("BlackhawknetworkRedeemResponse") ++ .or_else(|_| res.response.parse_struct("BlackhawknetworkErrorResponse")) + .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; ++ + event_builder.map(|i| i.set_response_body(&response)); + router_env::logger::info!(connector_response=?response); ++ + RouterData::try_from(ResponseRouterData { + response, + data: data.clone(), +@@ -285,303 +446,85 @@ impl ConnectorIntegration, + ) -> CustomResult { +- self.build_error_response(res, event_builder) +- } +-} +- +-impl ConnectorIntegration for Blackhawknetwork { +- fn get_headers( +- &self, +- req: &PaymentsSyncRouterData, +- connectors: &Connectors, +- ) -> CustomResult)>, errors::ConnectorError> { +- self.build_headers(req, connectors) +- } +- +- fn get_content_type(&self) -> &'static str { +- self.common_get_content_type() +- } +- +- fn get_url( +- &self, +- _req: &PaymentsSyncRouterData, +- _connectors: &Connectors, +- ) -> CustomResult { +- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into()) +- } +- +- fn build_request( +- &self, +- req: &PaymentsSyncRouterData, +- connectors: &Connectors, +- ) -> CustomResult, errors::ConnectorError> { +- Ok(Some( +- RequestBuilder::new() +- .method(Method::Get) +- .url(&types::PaymentsSyncType::get_url(self, req, connectors)?) +- .attach_default_headers() +- .headers(types::PaymentsSyncType::get_headers(self, req, connectors)?) +- .build(), +- )) +- } +- +- fn handle_response( +- &self, +- data: &PaymentsSyncRouterData, +- event_builder: Option<&mut ConnectorEvent>, +- res: Response, +- ) -> CustomResult { +- let response: blackhawknetwork::BlackhawknetworkPaymentsResponse = res ++ let response: blackhawknetwork::BlackhawknetworkErrorResponse = res + .response +- .parse_struct("blackhawknetwork PaymentsSyncResponse") ++ .parse_struct("BlackhawknetworkErrorResponse") + .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; + event_builder.map(|i| i.set_response_body(&response)); + router_env::logger::info!(connector_response=?response); +- RouterData::try_from(ResponseRouterData { +- response, +- data: data.clone(), +- http_code: res.status_code, +- }) +- } + +- fn get_error_response( +- &self, +- res: Response, +- event_builder: Option<&mut ConnectorEvent>, +- ) -> CustomResult { +- self.build_error_response(res, event_builder) ++ Ok(ErrorResponse { ++ status_code: res.status_code, ++ code: response.error, ++ message: response ++ .error_description ++ .unwrap_or(NO_ERROR_MESSAGE.to_owned()), ++ reason: Some("Verify redemption details or contact BHN support".to_string()), ++ attempt_status: None, ++ connector_transaction_id: None, ++ network_advice_code: None, ++ network_decline_code: None, ++ network_error_message: None, ++ connector_metadata: None, ++ }) + } + } + +-impl ConnectorIntegration for Blackhawknetwork { +- fn get_headers( +- &self, +- req: &PaymentsCaptureRouterData, +- connectors: &Connectors, +- ) -> CustomResult)>, errors::ConnectorError> { +- self.build_headers(req, connectors) +- } +- +- fn get_content_type(&self) -> &'static str { +- self.common_get_content_type() +- } +- +- fn get_url( ++impl ConnectorIntegration for Blackhawknetwork { ++ fn build_request( + &self, +- _req: &PaymentsCaptureRouterData, ++ _req: &PaymentsSyncRouterData, + _connectors: &Connectors, +- ) -> CustomResult { +- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into()) ++ ) -> CustomResult, errors::ConnectorError> { ++ Err(errors::ConnectorError::FlowNotSupported { ++ flow: "Payments Sync".to_string(), ++ connector: "BlackHawkNetwork".to_string(), ++ } ++ .into()) + } ++} + +- fn get_request_body( ++impl ConnectorIntegration for Blackhawknetwork { ++ fn build_request( + &self, + _req: &PaymentsCaptureRouterData, + _connectors: &Connectors, +- ) -> CustomResult { +- Err(errors::ConnectorError::NotImplemented("get_request_body method".to_string()).into()) +- } +- +- fn build_request( +- &self, +- req: &PaymentsCaptureRouterData, +- connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { +- Ok(Some( +- RequestBuilder::new() +- .method(Method::Post) +- .url(&types::PaymentsCaptureType::get_url(self, req, connectors)?) +- .attach_default_headers() +- .headers(types::PaymentsCaptureType::get_headers( +- self, req, connectors, +- )?) +- .set_body(types::PaymentsCaptureType::get_request_body( +- self, req, connectors, +- )?) +- .build(), +- )) +- } +- +- fn handle_response( +- &self, +- data: &PaymentsCaptureRouterData, +- event_builder: Option<&mut ConnectorEvent>, +- res: Response, +- ) -> CustomResult { +- let response: blackhawknetwork::BlackhawknetworkPaymentsResponse = res +- .response +- .parse_struct("Blackhawknetwork PaymentsCaptureResponse") +- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; +- event_builder.map(|i| i.set_response_body(&response)); +- router_env::logger::info!(connector_response=?response); +- RouterData::try_from(ResponseRouterData { +- response, +- data: data.clone(), +- http_code: res.status_code, +- }) +- } +- +- fn get_error_response( +- &self, +- res: Response, +- event_builder: Option<&mut ConnectorEvent>, +- ) -> CustomResult { +- self.build_error_response(res, event_builder) ++ Err(errors::ConnectorError::FlowNotSupported { ++ flow: "Capture".to_string(), ++ connector: "BlackHawkNetwork".to_string(), ++ } ++ .into()) + } + } + + impl ConnectorIntegration for Blackhawknetwork {} + + impl ConnectorIntegration for Blackhawknetwork { +- fn get_headers( +- &self, +- req: &RefundsRouterData, +- connectors: &Connectors, +- ) -> CustomResult)>, errors::ConnectorError> { +- self.build_headers(req, connectors) +- } +- +- fn get_content_type(&self) -> &'static str { +- self.common_get_content_type() +- } +- +- fn get_url( ++ fn build_request( + &self, + _req: &RefundsRouterData, + _connectors: &Connectors, +- ) -> CustomResult { +- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into()) +- } +- +- fn get_request_body( +- &self, +- req: &RefundsRouterData, +- _connectors: &Connectors, +- ) -> CustomResult { +- let refund_amount = utils::convert_amount( +- self.amount_converter, +- req.request.minor_refund_amount, +- req.request.currency, +- )?; +- +- let connector_router_data = +- blackhawknetwork::BlackhawknetworkRouterData::from((refund_amount, req)); +- let connector_req = +- blackhawknetwork::BlackhawknetworkRefundRequest::try_from(&connector_router_data)?; +- Ok(RequestContent::Json(Box::new(connector_req))) +- } +- +- fn build_request( +- &self, +- req: &RefundsRouterData, +- connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { +- let request = RequestBuilder::new() +- .method(Method::Post) +- .url(&types::RefundExecuteType::get_url(self, req, connectors)?) +- .attach_default_headers() +- .headers(types::RefundExecuteType::get_headers( +- self, req, connectors, +- )?) +- .set_body(types::RefundExecuteType::get_request_body( +- self, req, connectors, +- )?) +- .build(); +- Ok(Some(request)) +- } +- +- fn handle_response( +- &self, +- data: &RefundsRouterData, +- event_builder: Option<&mut ConnectorEvent>, +- res: Response, +- ) -> CustomResult, errors::ConnectorError> { +- let response: blackhawknetwork::RefundResponse = res +- .response +- .parse_struct("blackhawknetwork RefundResponse") +- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; +- event_builder.map(|i| i.set_response_body(&response)); +- router_env::logger::info!(connector_response=?response); +- RouterData::try_from(ResponseRouterData { +- response, +- data: data.clone(), +- http_code: res.status_code, +- }) +- } +- +- fn get_error_response( +- &self, +- res: Response, +- event_builder: Option<&mut ConnectorEvent>, +- ) -> CustomResult { +- self.build_error_response(res, event_builder) ++ Err(errors::ConnectorError::FlowNotSupported { ++ flow: "Refunds".to_string(), ++ connector: "BlackHawkNetwork".to_string(), ++ } ++ .into()) + } + } + + impl ConnectorIntegration for Blackhawknetwork { +- fn get_headers( +- &self, +- req: &RefundSyncRouterData, +- connectors: &Connectors, +- ) -> CustomResult)>, errors::ConnectorError> { +- self.build_headers(req, connectors) +- } +- +- fn get_content_type(&self) -> &'static str { +- self.common_get_content_type() +- } +- +- fn get_url( ++ fn build_request( + &self, + _req: &RefundSyncRouterData, + _connectors: &Connectors, +- ) -> CustomResult { +- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into()) +- } +- +- fn build_request( +- &self, +- req: &RefundSyncRouterData, +- connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { +- Ok(Some( +- RequestBuilder::new() +- .method(Method::Get) +- .url(&types::RefundSyncType::get_url(self, req, connectors)?) +- .attach_default_headers() +- .headers(types::RefundSyncType::get_headers(self, req, connectors)?) +- .set_body(types::RefundSyncType::get_request_body( +- self, req, connectors, +- )?) +- .build(), +- )) +- } +- +- fn handle_response( +- &self, +- data: &RefundSyncRouterData, +- event_builder: Option<&mut ConnectorEvent>, +- res: Response, +- ) -> CustomResult { +- let response: blackhawknetwork::RefundResponse = res +- .response +- .parse_struct("blackhawknetwork RefundSyncResponse") +- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; +- event_builder.map(|i| i.set_response_body(&response)); +- router_env::logger::info!(connector_response=?response); +- RouterData::try_from(ResponseRouterData { +- response, +- data: data.clone(), +- http_code: res.status_code, +- }) +- } +- +- fn get_error_response( +- &self, +- res: Response, +- event_builder: Option<&mut ConnectorEvent>, +- ) -> CustomResult { +- self.build_error_response(res, event_builder) ++ Err(errors::ConnectorError::FlowNotSupported { ++ flow: "Refunds Sync".to_string(), ++ connector: "BlackHawkNetwork".to_string(), ++ } ++ .into()) + } + } + +@@ -609,9 +552,6 @@ impl webhooks::IncomingWebhook for Blackhawknetwork { + } + } + +-static BLACKHAWKNETWORK_SUPPORTED_PAYMENT_METHODS: LazyLock = +- LazyLock::new(SupportedPaymentMethods::new); +- + static BLACKHAWKNETWORK_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + display_name: "Blackhawknetwork", + description: "Blackhawknetwork connector", +@@ -621,6 +561,25 @@ static BLACKHAWKNETWORK_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { + + static BLACKHAWKNETWORK_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 0] = []; + ++static BLACKHAWKNETWORK_SUPPORTED_PAYMENT_METHODS: LazyLock = ++ LazyLock::new(|| { ++ let supported_capture_methods = vec![enums::CaptureMethod::Automatic]; ++ let mut supported_payment_methods = SupportedPaymentMethods::new(); ++ ++ supported_payment_methods.add( ++ enums::PaymentMethod::GiftCard, ++ PaymentMethodType::BhnCardNetwork, ++ PaymentMethodDetails { ++ mandates: enums::FeatureStatus::NotSupported, ++ refunds: enums::FeatureStatus::NotSupported, ++ supported_capture_methods: supported_capture_methods.clone(), ++ specific_features: None, ++ }, ++ ); ++ ++ supported_payment_methods ++ }); ++ + impl ConnectorSpecifications for Blackhawknetwork { + fn get_connector_about(&self) -> Option<&'static ConnectorInfo> { + Some(&BLACKHAWKNETWORK_CONNECTOR_INFO) +diff --git a/crates/hyperswitch_connectors/src/connectors/blackhawknetwork/transformers.rs b/crates/hyperswitch_connectors/src/connectors/blackhawknetwork/transformers.rs +index e56a1f02..4df04a53 100644 +--- a/crates/hyperswitch_connectors/src/connectors/blackhawknetwork/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/blackhawknetwork/transformers.rs +@@ -1,28 +1,29 @@ +-use common_enums::enums; +-use common_utils::types::StringMinorUnit; ++use common_enums::{enums, Currency}; ++use common_utils::types::{MinorUnit, StringMajorUnit}; ++use error_stack::ResultExt; + use hyperswitch_domain_models::{ +- payment_method_data::PaymentMethodData, +- router_data::{ConnectorAuthType, RouterData}, ++ payment_method_data::{GiftCardData, PaymentMethodData}, ++ router_data::{ ++ AccessToken, ConnectorAuthType, ErrorResponse, PaymentMethodBalance, RouterData, ++ }, + router_flow_types::refunds::{Execute, RSync}, +- router_request_types::ResponseId, +- router_response_types::{PaymentsResponseData, RefundsResponseData}, +- types::{PaymentsAuthorizeRouterData, RefundsRouterData}, ++ router_request_types::{PaymentsPreProcessingData, ResponseId}, ++ router_response_types::{PaymentsResponseData, PreprocessingResponseId, RefundsResponseData}, ++ types::{PaymentsAuthorizeRouterData, PaymentsPreProcessingRouterData, RefundsRouterData}, + }; +-use hyperswitch_interfaces::errors; ++use hyperswitch_interfaces::{consts::NO_ERROR_MESSAGE, errors}; + use masking::Secret; + use serde::{Deserialize, Serialize}; + + use crate::types::{RefundsResponseRouterData, ResponseRouterData}; + +-//TODO: Fill the struct with respective fields + pub struct BlackhawknetworkRouterData { +- pub amount: StringMinorUnit, // The type of amount that a connector accepts, for example, String, i64, f64, etc. ++ pub amount: StringMajorUnit, + pub router_data: T, + } + +-impl From<(StringMinorUnit, T)> for BlackhawknetworkRouterData { +- fn from((amount, item): (StringMinorUnit, T)) -> Self { +- //Todo : use utils to convert the amount to the type of amount that a connector accepts ++impl From<(StringMajorUnit, T)> for BlackhawknetworkRouterData { ++ fn from((amount, item): (StringMajorUnit, T)) -> Self { + Self { + amount, + router_data: item, +@@ -30,114 +31,262 @@ impl From<(StringMinorUnit, T)> for BlackhawknetworkRouterData { + } + } + +-//TODO: Fill the struct with respective fields +-#[derive(Default, Debug, Serialize, PartialEq)] +-pub struct BlackhawknetworkPaymentsRequest { +- amount: StringMinorUnit, +- card: BlackhawknetworkCard, ++#[derive(Debug, Clone)] ++pub struct BlackhawknetworkAuthType { ++ pub(super) client_id: Secret, ++ pub(super) client_secret: Secret, ++ pub(super) product_line_id: Secret, + } + +-#[derive(Default, Debug, Serialize, Eq, PartialEq)] +-pub struct BlackhawknetworkCard { +- number: cards::CardNumber, +- expiry_month: Secret, +- expiry_year: Secret, +- cvc: Secret, +- complete: bool, ++impl TryFrom<&ConnectorAuthType> for BlackhawknetworkAuthType { ++ type Error = error_stack::Report; ++ ++ fn try_from(auth_type: &ConnectorAuthType) -> Result { ++ match auth_type { ++ ConnectorAuthType::SignatureKey { ++ api_key, ++ key1, ++ api_secret, ++ } => Ok(Self { ++ client_id: api_key.clone(), ++ client_secret: api_secret.clone(), ++ product_line_id: key1.clone(), ++ }), ++ _ => Err(errors::ConnectorError::FailedToObtainAuthType) ++ .attach_printable("Unsupported authentication type for Blackhawk Network"), ++ } ++ } + } + +-impl TryFrom<&BlackhawknetworkRouterData<&PaymentsAuthorizeRouterData>> +- for BlackhawknetworkPaymentsRequest ++#[derive(Debug, Serialize, Deserialize)] ++pub struct BlackhawknetworkAccessTokenRequest { ++ pub grant_type: String, ++ pub client_id: Secret, ++ pub client_secret: Secret, ++ pub scope: String, ++} ++impl TryFrom> ++ for RouterData + { + type Error = error_stack::Report; + fn try_from( +- item: &BlackhawknetworkRouterData<&PaymentsAuthorizeRouterData>, ++ item: ResponseRouterData, + ) -> Result { +- match item.router_data.request.payment_method_data.clone() { +- PaymentMethodData::Card(_) => Err(errors::ConnectorError::NotImplemented( +- "Card payment method not implemented".to_string(), +- ) +- .into()), +- _ => Err(errors::ConnectorError::NotImplemented("Payment method".to_string()).into()), +- } ++ Ok(Self { ++ response: Ok(AccessToken { ++ token: item.response.access_token, ++ expires: item.response.expires_in, ++ }), ++ ..item.data ++ }) + } + } + +-//TODO: Fill the struct with respective fields +-// Auth Struct +-pub struct BlackhawknetworkAuthType { +- pub(super) api_key: Secret, ++#[derive(Debug, Serialize, Deserialize)] ++#[serde(rename_all = "camelCase")] ++pub struct BlackhawknetworkVerifyAccountRequest { ++ pub account_number: Secret, ++ pub product_line_id: Secret, ++ pub account_type: AccountType, ++ #[serde(skip_serializing_if = "Option::is_none")] ++ pub pin: Option>, ++ #[serde(skip_serializing_if = "Option::is_none")] ++ pub cvv2: Option>, ++ #[serde(skip_serializing_if = "Option::is_none")] ++ pub expiration_date: Option>, + } ++impl TryFrom<&PaymentsPreProcessingRouterData> for BlackhawknetworkVerifyAccountRequest { ++ type Error = error_stack::Report; ++ fn try_from(item: &PaymentsPreProcessingRouterData) -> Result { ++ let auth = BlackhawknetworkAuthType::try_from(&item.connector_auth_type) ++ .change_context(errors::ConnectorError::FailedToObtainAuthType)?; + +-impl TryFrom<&ConnectorAuthType> for BlackhawknetworkAuthType { ++ let gift_card_data = match &item.request.payment_method_data { ++ Some(PaymentMethodData::GiftCard(gc)) => match gc.as_ref() { ++ GiftCardData::BhnCardNetwork(data) => data, ++ _ => { ++ return Err(errors::ConnectorError::FlowNotSupported { ++ flow: "Balance".to_string(), ++ connector: "BlackHawkNetwork".to_string(), ++ } ++ .into()) ++ } ++ }, ++ _ => { ++ return Err(errors::ConnectorError::FlowNotSupported { ++ flow: "Balance".to_string(), ++ connector: "BlackHawkNetwork".to_string(), ++ } ++ .into()) ++ } ++ }; ++ ++ Ok(Self { ++ account_number: gift_card_data.account_number.clone(), ++ product_line_id: auth.product_line_id, ++ account_type: AccountType::GiftCard, ++ pin: gift_card_data.pin.clone(), ++ cvv2: gift_card_data.cvv2.clone(), ++ expiration_date: gift_card_data.expiration_date.clone().map(Secret::new), ++ }) ++ } ++} ++ ++impl ++ TryFrom< ++ ResponseRouterData< ++ F, ++ BlackhawknetworkVerifyAccountResponse, ++ PaymentsPreProcessingData, ++ PaymentsResponseData, ++ >, ++ > for RouterData ++{ + type Error = error_stack::Report; +- fn try_from(auth_type: &ConnectorAuthType) -> Result { +- match auth_type { +- ConnectorAuthType::HeaderKey { api_key } => Ok(Self { +- api_key: api_key.to_owned(), ++ fn try_from( ++ item: ResponseRouterData< ++ F, ++ BlackhawknetworkVerifyAccountResponse, ++ PaymentsPreProcessingData, ++ PaymentsResponseData, ++ >, ++ ) -> Result { ++ Ok(Self { ++ response: Ok(PaymentsResponseData::PreProcessingResponse { ++ pre_processing_id: PreprocessingResponseId::PreProcessingId( ++ item.response.account.entity_id, ++ ), ++ connector_metadata: None, ++ session_token: None, ++ connector_response_reference_id: None, + }), +- _ => Err(errors::ConnectorError::FailedToObtainAuthType.into()), +- } ++ payment_method_balance: Some(PaymentMethodBalance { ++ currency: item.response.account.currency, ++ amount: item.response.account.balance, ++ }), ++ ..item.data ++ }) + } + } +-// PaymentsResponse +-//TODO: Append the remaining status flags +-#[derive(Debug, Clone, Copy, Default, Serialize, Deserialize, PartialEq)] +-#[serde(rename_all = "lowercase")] +-pub enum BlackhawknetworkPaymentStatus { +- Succeeded, +- Failed, +- #[default] +- Processing, ++ ++#[derive(Debug, Serialize, Deserialize)] ++pub struct BlackhawknetworkTokenResponse { ++ pub access_token: Secret, ++ pub expires_in: i64, ++} ++#[derive(Serialize, Debug)] ++pub struct BlackhawknetworkPaymentsRequest { ++ pub account_id: String, ++ pub amount: StringMajorUnit, ++ pub currency: Currency, + } + +-impl From for common_enums::AttemptStatus { +- fn from(item: BlackhawknetworkPaymentStatus) -> Self { +- match item { +- BlackhawknetworkPaymentStatus::Succeeded => Self::Charged, +- BlackhawknetworkPaymentStatus::Failed => Self::Failure, +- BlackhawknetworkPaymentStatus::Processing => Self::Authorizing, ++impl TryFrom<&BlackhawknetworkRouterData<&PaymentsAuthorizeRouterData>> ++ for BlackhawknetworkPaymentsRequest ++{ ++ type Error = error_stack::Report; ++ ++ fn try_from( ++ item: &BlackhawknetworkRouterData<&PaymentsAuthorizeRouterData>, ++ ) -> Result { ++ match &item.router_data.request.payment_method_data { ++ PaymentMethodData::GiftCard(_gift_card) => { ++ let account_id = item ++ .router_data ++ .preprocessing_id ++ .to_owned() ++ .ok_or_else(|| { ++ errors::ConnectorError::MissingConnectorRelatedTransactionID { ++ id: "entity_id".to_string(), ++ } ++ })?; ++ ++ Ok(Self { ++ account_id, ++ amount: item.amount.clone(), ++ currency: item.router_data.request.currency, ++ }) ++ } ++ _ => Err(error_stack::Report::new( ++ errors::ConnectorError::NotImplemented("Non-gift card payment method".to_string()), ++ )), + } + } + } ++#[derive(Debug, Deserialize, Serialize)] ++#[serde(untagged)] ++pub enum BlackhawknetworkRedeemResponse { ++ Success(BlackhawknetworkPaymentsResponse), ++ Error(BlackhawknetworkErrorResponse), ++} + +-//TODO: Fill the struct with respective fields +-#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)] ++#[derive(Debug, Deserialize, Clone, Serialize)] ++#[serde(rename_all = "camelCase")] + pub struct BlackhawknetworkPaymentsResponse { +- status: BlackhawknetworkPaymentStatus, +- id: String, ++ pub id: String, ++ #[serde(rename = "transactionStatus")] ++ pub status: BlackhawknetworkAttemptStatus, ++} ++#[derive(Debug, Clone, Serialize, Deserialize)] ++#[serde(rename_all = "UPPERCASE")] ++pub enum BlackhawknetworkAttemptStatus { ++ Approved, ++ Declined, ++ Pending, + } + +-impl TryFrom> ++impl TryFrom> + for RouterData + { + type Error = error_stack::Report; ++ + fn try_from( +- item: ResponseRouterData, ++ item: ResponseRouterData, + ) -> Result { +- Ok(Self { +- status: common_enums::AttemptStatus::from(item.response.status), +- response: Ok(PaymentsResponseData::TransactionResponse { +- resource_id: ResponseId::ConnectorTransactionId(item.response.id), +- redirection_data: Box::new(None), +- mandate_reference: Box::new(None), +- connector_metadata: None, +- network_txn_id: None, +- connector_response_reference_id: None, +- incremental_authorization_allowed: None, +- charges: None, ++ match item.response { ++ BlackhawknetworkRedeemResponse::Success(response) => Ok(Self { ++ status: match response.status { ++ BlackhawknetworkAttemptStatus::Approved => enums::AttemptStatus::Charged, ++ BlackhawknetworkAttemptStatus::Declined => enums::AttemptStatus::Failure, ++ BlackhawknetworkAttemptStatus::Pending => enums::AttemptStatus::Pending, ++ }, ++ response: Ok(PaymentsResponseData::TransactionResponse { ++ resource_id: ResponseId::ConnectorTransactionId(response.id), ++ redirection_data: Box::new(None), ++ mandate_reference: Box::new(None), ++ connector_metadata: None, ++ network_txn_id: None, ++ connector_response_reference_id: None, ++ incremental_authorization_allowed: None, ++ charges: None, ++ }), ++ ..item.data + }), +- ..item.data +- }) ++ BlackhawknetworkRedeemResponse::Error(error_response) => Ok(Self { ++ response: Err(ErrorResponse { ++ status_code: item.http_code, ++ code: error_response.error.clone(), ++ message: error_response ++ .error_description ++ .clone() ++ .unwrap_or(NO_ERROR_MESSAGE.to_string()), ++ reason: error_response.error_description, ++ attempt_status: None, ++ connector_transaction_id: None, ++ network_advice_code: None, ++ network_decline_code: None, ++ network_error_message: None, ++ connector_metadata: None, ++ }), ++ ..item.data ++ }), ++ } + } + } + +-//TODO: Fill the struct with respective fields +-// REFUND : +-// Type definition for RefundRequest + #[derive(Default, Debug, Serialize)] + pub struct BlackhawknetworkRefundRequest { +- pub amount: StringMinorUnit, ++ pub amount: StringMajorUnit, + } + + impl TryFrom<&BlackhawknetworkRouterData<&RefundsRouterData>> +@@ -153,8 +302,6 @@ impl TryFrom<&BlackhawknetworkRouterData<&RefundsRouterData>> + } + } + +-// Type definition for Refund Response +- + #[allow(dead_code)] + #[derive(Debug, Copy, Serialize, Default, Deserialize, Clone)] + pub enum RefundStatus { +@@ -212,14 +359,49 @@ impl TryFrom> for RefundsRouter + } + } + +-//TODO: Fill the struct with respective fields +-#[derive(Default, Debug, Serialize, Deserialize, PartialEq)] ++#[derive(Debug, Serialize, Deserialize, Clone, Copy)] ++#[serde(rename_all = "SCREAMING_SNAKE_CASE")] ++pub enum AccountType { ++ CreditCard, ++ GiftCard, ++ LoyaltyCard, ++ PhoneCard, ++} ++ ++#[derive(Debug, Deserialize, Serialize, Clone)] ++#[serde(rename_all = "SCREAMING_SNAKE_CASE")] ++pub enum AccountStatus { ++ New, ++ Activated, ++ Closed, ++} ++ ++impl From for common_enums::AttemptStatus { ++ fn from(item: AccountStatus) -> Self { ++ match item { ++ AccountStatus::New | AccountStatus::Activated => Self::Pending, ++ AccountStatus::Closed => Self::Failure, ++ } ++ } ++} ++ ++#[derive(Debug, Deserialize, Serialize, Clone)] ++#[serde(rename_all = "camelCase")] ++pub struct AccountInformation { ++ pub entity_id: String, ++ pub balance: MinorUnit, ++ pub currency: Currency, ++ pub status: AccountStatus, ++} ++ ++#[derive(Debug, Deserialize, Serialize, Clone)] ++pub struct BlackhawknetworkVerifyAccountResponse { ++ account: AccountInformation, ++} ++ ++#[derive(Debug, Deserialize, Clone, Serialize)] ++#[serde(rename_all = "camelCase")] + pub struct BlackhawknetworkErrorResponse { +- pub status_code: u16, +- pub code: String, +- pub message: String, +- pub reason: Option, +- pub network_advice_code: Option, +- pub network_decline_code: Option, +- pub network_error_message: Option, ++ pub error: String, ++ pub error_description: Option, + } +diff --git a/crates/hyperswitch_connectors/src/connectors/klarna.rs b/crates/hyperswitch_connectors/src/connectors/klarna.rs +index b106576b..6b053b07 100644 +--- a/crates/hyperswitch_connectors/src/connectors/klarna.rs ++++ b/crates/hyperswitch_connectors/src/connectors/klarna.rs +@@ -552,6 +552,7 @@ impl ConnectorIntegration> for PaypalPayments + | enums::PaymentMethodType::Becs + | enums::PaymentMethodType::Benefit + | enums::PaymentMethodType::Bizum ++ | enums::PaymentMethodType::BhnCardNetwork + | enums::PaymentMethodType::Blik + | enums::PaymentMethodType::Boleto + | enums::PaymentMethodType::BcaBankTransfer +@@ -1410,12 +1411,12 @@ impl TryFrom<&GiftCardData> for PaypalPaymentsRequest { + type Error = error_stack::Report; + fn try_from(value: &GiftCardData) -> Result { + match value { +- GiftCardData::Givex(_) | GiftCardData::PaySafeCard {} => { +- Err(errors::ConnectorError::NotImplemented( +- utils::get_unimplemented_payment_method_error_message("Paypal"), +- ) +- .into()) +- } ++ GiftCardData::Givex(_) ++ | GiftCardData::PaySafeCard {} ++ | GiftCardData::BhnCardNetwork(_) => Err(errors::ConnectorError::NotImplemented( ++ utils::get_unimplemented_payment_method_error_message("Paypal"), ++ ) ++ .into()), + } + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/shift4/transformers.rs b/crates/hyperswitch_connectors/src/connectors/shift4/transformers.rs +index e4c7b708..159ea3ab 100644 +--- a/crates/hyperswitch_connectors/src/connectors/shift4/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/shift4/transformers.rs +@@ -529,12 +529,12 @@ impl TryFrom<&GiftCardData> for Shift4PaymentMethod { + type Error = Error; + fn try_from(gift_card_data: &GiftCardData) -> Result { + match gift_card_data { +- GiftCardData::Givex(_) | GiftCardData::PaySafeCard {} => { +- Err(errors::ConnectorError::NotImplemented( +- utils::get_unimplemented_payment_method_error_message("Shift4"), +- ) +- .into()) +- } ++ GiftCardData::Givex(_) ++ | GiftCardData::PaySafeCard {} ++ | GiftCardData::BhnCardNetwork(_) => Err(errors::ConnectorError::NotImplemented( ++ utils::get_unimplemented_payment_method_error_message("Shift4"), ++ ) ++ .into()), + } + } + } +diff --git a/crates/hyperswitch_connectors/src/connectors/stripe/transformers.rs b/crates/hyperswitch_connectors/src/connectors/stripe/transformers.rs +index 0e1f87b8..8feddc5c 100644 +--- a/crates/hyperswitch_connectors/src/connectors/stripe/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/stripe/transformers.rs +@@ -794,6 +794,7 @@ impl TryFrom for StripePaymentMethodType { + | enums::PaymentMethodType::Multibanco + | enums::PaymentMethodType::OnlineBankingFpx + | enums::PaymentMethodType::Paypal ++ | enums::PaymentMethodType::BhnCardNetwork + | enums::PaymentMethodType::Pix + | enums::PaymentMethodType::UpiCollect + | enums::PaymentMethodType::UpiIntent +@@ -1416,12 +1417,12 @@ fn create_stripe_payment_method( + .into()), + + PaymentMethodData::GiftCard(giftcard_data) => match giftcard_data.deref() { +- GiftCardData::Givex(_) | GiftCardData::PaySafeCard {} => Err( +- ConnectorError::NotImplemented(get_unimplemented_payment_method_error_message( +- "stripe", +- )) +- .into(), +- ), ++ GiftCardData::Givex(_) ++ | GiftCardData::PaySafeCard {} ++ | GiftCardData::BhnCardNetwork(_) => Err(ConnectorError::NotImplemented( ++ get_unimplemented_payment_method_error_message("stripe"), ++ ) ++ .into()), + }, + PaymentMethodData::CardRedirect(cardredirect_data) => match cardredirect_data { + CardRedirectData::Knet {} +diff --git a/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs b/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs +index 100237ab..3d94da66 100644 +--- a/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs +@@ -810,12 +810,12 @@ impl TryFrom<&GiftCardData> for ZenPaymentsRequest { + type Error = error_stack::Report; + fn try_from(value: &GiftCardData) -> Result { + match value { +- GiftCardData::PaySafeCard {} | GiftCardData::Givex(_) => { +- Err(errors::ConnectorError::NotImplemented( +- utils::get_unimplemented_payment_method_error_message("Zen"), +- ) +- .into()) +- } ++ GiftCardData::PaySafeCard {} ++ | GiftCardData::Givex(_) ++ | GiftCardData::BhnCardNetwork(_) => Err(errors::ConnectorError::NotImplemented( ++ utils::get_unimplemented_payment_method_error_message("Zen"), ++ ) ++ .into()), + } + } + } +diff --git a/crates/hyperswitch_connectors/src/default_implementations.rs b/crates/hyperswitch_connectors/src/default_implementations.rs +index 7d746072..64c30a93 100644 +--- a/crates/hyperswitch_connectors/src/default_implementations.rs ++++ b/crates/hyperswitch_connectors/src/default_implementations.rs +@@ -1669,7 +1669,6 @@ default_imp_for_pre_processing_steps!( + connectors::Bankofamerica, + connectors::Billwerk, + connectors::Bitpay, +- connectors::Blackhawknetwork, + connectors::Bluecode, + connectors::Bluesnap, + connectors::Braintree, +diff --git a/crates/hyperswitch_connectors/src/utils.rs b/crates/hyperswitch_connectors/src/utils.rs +index 1500da76..aefb4f53 100644 +--- a/crates/hyperswitch_connectors/src/utils.rs ++++ b/crates/hyperswitch_connectors/src/utils.rs +@@ -5539,6 +5539,7 @@ pub enum PaymentMethodDataType { + PermataBankTransfer, + BcaBankTransfer, + BniVaBankTransfer, ++ BhnCardNetwork, + BriVaBankTransfer, + CimbVaBankTransfer, + DanamonVaBankTransfer, +@@ -5775,6 +5776,7 @@ impl From for PaymentMethodDataType { + PaymentMethodData::GiftCard(gift_card_data) => match *gift_card_data { + payment_method_data::GiftCardData::Givex(_) => Self::Givex, + payment_method_data::GiftCardData::PaySafeCard {} => Self::PaySafeCar, ++ payment_method_data::GiftCardData::BhnCardNetwork(_) => Self::BhnCardNetwork, + }, + PaymentMethodData::CardToken(_) => Self::CardToken, + PaymentMethodData::OpenBanking(data) => match data { +diff --git a/crates/hyperswitch_domain_models/src/payment_method_data.rs b/crates/hyperswitch_domain_models/src/payment_method_data.rs +index 139889da..37812cf6 100644 +--- a/crates/hyperswitch_domain_models/src/payment_method_data.rs ++++ b/crates/hyperswitch_domain_models/src/payment_method_data.rs +@@ -672,6 +672,7 @@ pub struct JCSVoucherData {} + pub enum GiftCardData { + Givex(GiftCardDetails), + PaySafeCard {}, ++ BhnCardNetwork(BHNGiftCardDetails), + } + + #[derive(serde::Deserialize, serde::Serialize, Debug, Clone, Eq, PartialEq)] +@@ -683,6 +684,19 @@ pub struct GiftCardDetails { + pub cvc: Secret, + } + ++#[derive(serde::Deserialize, serde::Serialize, Debug, Clone, Eq, PartialEq)] ++#[serde(rename_all = "snake_case")] ++pub struct BHNGiftCardDetails { ++ /// The gift card or account number ++ pub account_number: Secret, ++ /// The security PIN for gift cards requiring it ++ pub pin: Option>, ++ /// The CVV2 code for Open Loop/VPLN products ++ pub cvv2: Option>, ++ /// The expiration date in MMYYYY format for Open Loop/VPLN products ++ pub expiration_date: Option, ++} ++ + #[derive(Eq, PartialEq, Debug, serde::Deserialize, serde::Serialize, Clone, Default)] + #[serde(rename_all = "snake_case")] + pub struct CardToken { +@@ -1545,6 +1559,14 @@ impl From for GiftCardData { + cvc: details.cvc, + }), + api_models::payments::GiftCardData::PaySafeCard {} => Self::PaySafeCard {}, ++ api_models::payments::GiftCardData::BhnCardNetwork(details) => { ++ Self::BhnCardNetwork(BHNGiftCardDetails { ++ account_number: details.account_number, ++ pin: details.pin, ++ cvv2: details.cvv2, ++ expiration_date: details.expiration_date, ++ }) ++ } + } + } + } +@@ -1568,6 +1590,7 @@ impl From for payment_additional_types::GiftCardAdditionalData { + }, + )), + GiftCardData::PaySafeCard {} => Self::PaySafeCard {}, ++ GiftCardData::BhnCardNetwork(_) => Self::BhnCardNetwork {}, + } + } + } +@@ -2138,6 +2161,7 @@ impl GetPaymentMethodType for GiftCardData { + match self { + Self::Givex(_) => api_enums::PaymentMethodType::Givex, + Self::PaySafeCard {} => api_enums::PaymentMethodType::PaySafeCard, ++ Self::BhnCardNetwork(_) => api_enums::PaymentMethodType::BhnCardNetwork, + } + } + } +diff --git a/crates/kgraph_utils/src/mca.rs b/crates/kgraph_utils/src/mca.rs +index 387fec7a..b33fdde3 100644 +--- a/crates/kgraph_utils/src/mca.rs ++++ b/crates/kgraph_utils/src/mca.rs +@@ -152,6 +152,7 @@ fn get_dir_value_payment_method( + api_enums::PaymentMethodType::Seicomart => Ok(dirval!(VoucherType = Seicomart)), + api_enums::PaymentMethodType::PayEasy => Ok(dirval!(VoucherType = PayEasy)), + api_enums::PaymentMethodType::Givex => Ok(dirval!(GiftCardType = Givex)), ++ api_enums::PaymentMethodType::BhnCardNetwork => Ok(dirval!(GiftCardType = BhnCardNetwork)), + api_enums::PaymentMethodType::Benefit => Ok(dirval!(CardRedirectType = Benefit)), + api_enums::PaymentMethodType::Knet => Ok(dirval!(CardRedirectType = Knet)), + api_enums::PaymentMethodType::OpenBankingUk => { +diff --git a/crates/kgraph_utils/src/transformers.rs b/crates/kgraph_utils/src/transformers.rs +index fb41de20..66bf4879 100644 +--- a/crates/kgraph_utils/src/transformers.rs ++++ b/crates/kgraph_utils/src/transformers.rs +@@ -294,6 +294,9 @@ impl IntoDirValue for (api_enums::PaymentMethodType, api_enums::PaymentMethod) { + api_enums::PaymentMethodType::Seicomart => Ok(dirval!(VoucherType = Seicomart)), + api_enums::PaymentMethodType::PayEasy => Ok(dirval!(VoucherType = PayEasy)), + api_enums::PaymentMethodType::Givex => Ok(dirval!(GiftCardType = Givex)), ++ api_enums::PaymentMethodType::BhnCardNetwork => { ++ Ok(dirval!(GiftCardType = BhnCardNetwork)) ++ } + api_enums::PaymentMethodType::Benefit => Ok(dirval!(CardRedirectType = Benefit)), + api_enums::PaymentMethodType::Knet => Ok(dirval!(CardRedirectType = Knet)), + api_enums::PaymentMethodType::OpenBankingUk => { +diff --git a/crates/openapi/src/openapi.rs b/crates/openapi/src/openapi.rs +index 16ce1cf8..b5486ac7 100644 +--- a/crates/openapi/src/openapi.rs ++++ b/crates/openapi/src/openapi.rs +@@ -633,6 +633,7 @@ Never share your secret api keys. Keep them guarded and secure. + api_models::payments::CustomerDetails, + api_models::payments::GiftCardData, + api_models::payments::GiftCardDetails, ++ api_models::payments::BHNGiftCardDetails, + api_models::payments::MobilePaymentData, + api_models::payments::MobilePaymentResponse, + api_models::payments::Address, +diff --git a/crates/openapi/src/openapi_v2.rs b/crates/openapi/src/openapi_v2.rs +index 2751055a..1c52daa6 100644 +--- a/crates/openapi/src/openapi_v2.rs ++++ b/crates/openapi/src/openapi_v2.rs +@@ -608,6 +608,7 @@ Never share your secret api keys. Keep them guarded and secure. + api_models::payments::CustomerDetails, + api_models::payments::GiftCardData, + api_models::payments::GiftCardDetails, ++ api_models::payments::BHNGiftCardDetails, + api_models::payments::MobilePaymentData, + api_models::payments::MobilePaymentResponse, + api_models::payments::Address, +diff --git a/crates/router/src/connector/utils.rs b/crates/router/src/connector/utils.rs +index efad0c8e..bead5577 100644 +--- a/crates/router/src/connector/utils.rs ++++ b/crates/router/src/connector/utils.rs +@@ -2586,6 +2586,7 @@ pub enum PaymentMethodDataType { + Seicomart, + PayEasy, + Givex, ++ BhnCardNetwork, + PaySafeCar, + CardToken, + LocalBankTransfer, +@@ -2800,6 +2801,7 @@ impl From for PaymentMethodDataType { + domain::payments::PaymentMethodData::GiftCard(gift_card_data) => { + match *gift_card_data { + domain::payments::GiftCardData::Givex(_) => Self::Givex, ++ domain::payments::GiftCardData::BhnCardNetwork(_)=>Self::BhnCardNetwork, + domain::payments::GiftCardData::PaySafeCard {} => Self::PaySafeCar, + } + } +diff --git a/crates/router/src/core/connector_validation.rs b/crates/router/src/core/connector_validation.rs +index cb918890..a0665a4f 100644 +--- a/crates/router/src/core/connector_validation.rs ++++ b/crates/router/src/core/connector_validation.rs +@@ -129,6 +129,10 @@ impl ConnectorAuthTypeAndMetadataValidation<'_> { + bluesnap::transformers::BluesnapAuthType::try_from(self.auth_type)?; + Ok(()) + } ++ api_enums::Connector::Blackhawknetwork => { ++ blackhawknetwork::transformers::BlackhawknetworkAuthType::try_from(self.auth_type)?; ++ Ok(()) ++ } + api_enums::Connector::Bluecode => { + bluecode::transformers::BluecodeAuthType::try_from(self.auth_type)?; + bluecode::transformers::BluecodeMetadataObject::try_from(self.connector_meta_data)?; +diff --git a/crates/router/src/types/api/connector_mapping.rs b/crates/router/src/types/api/connector_mapping.rs +index 29f14f79..18868042 100644 +--- a/crates/router/src/types/api/connector_mapping.rs ++++ b/crates/router/src/types/api/connector_mapping.rs +@@ -144,6 +144,9 @@ impl ConnectorData { + enums::Connector::Bitpay => { + Ok(ConnectorEnum::Old(Box::new(connector::Bitpay::new()))) + } ++ enums::Connector::Blackhawknetwork => Ok(ConnectorEnum::Old(Box::new( ++ connector::Blackhawknetwork::new(), ++ ))), + enums::Connector::Bluesnap => { + Ok(ConnectorEnum::Old(Box::new(connector::Bluesnap::new()))) + } +diff --git a/crates/router/src/types/api/feature_matrix.rs b/crates/router/src/types/api/feature_matrix.rs +index d7307e7a..8d5ff7d4 100644 +--- a/crates/router/src/types/api/feature_matrix.rs ++++ b/crates/router/src/types/api/feature_matrix.rs +@@ -58,6 +58,9 @@ impl FeatureMatrixConnectorData { + enums::Connector::Bitpay => { + Ok(ConnectorEnum::Old(Box::new(connector::Bitpay::new()))) + } ++ enums::Connector::Blackhawknetwork => Ok(ConnectorEnum::Old(Box::new( ++ connector::Blackhawknetwork::new(), ++ ))), + enums::Connector::Bluesnap => { + Ok(ConnectorEnum::Old(Box::new(connector::Bluesnap::new()))) + } +diff --git a/crates/router/src/types/connector_transformers.rs b/crates/router/src/types/connector_transformers.rs +index cf29d042..9d7c568c 100644 +--- a/crates/router/src/types/connector_transformers.rs ++++ b/crates/router/src/types/connector_transformers.rs +@@ -22,6 +22,7 @@ impl ForeignTryFrom for common_enums::RoutableConnectors { + api_enums::Connector::Billwerk => Self::Billwerk, + api_enums::Connector::Bitpay => Self::Bitpay, + api_enums::Connector::Bluesnap => Self::Bluesnap, ++ api_enums::Connector::Blackhawknetwork => Self::Blackhawknetwork, + api_enums::Connector::Bluecode => Self::Bluecode, + api_enums::Connector::Boku => Self::Boku, + api_enums::Connector::Braintree => Self::Braintree, +diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs +index 8109df07..cc7fd65a 100644 +--- a/crates/router/src/types/transformers.rs ++++ b/crates/router/src/types/transformers.rs +@@ -368,9 +368,9 @@ impl ForeignFrom for api_enums::PaymentMethod { + | api_enums::PaymentMethodType::SepaBankTransfer + | api_enums::PaymentMethodType::IndonesianBankTransfer + | api_enums::PaymentMethodType::Pix => Self::BankTransfer, +- api_enums::PaymentMethodType::Givex | api_enums::PaymentMethodType::PaySafeCard => { +- Self::GiftCard +- } ++ api_enums::PaymentMethodType::Givex ++ | api_enums::PaymentMethodType::PaySafeCard ++ | api_enums::PaymentMethodType::BhnCardNetwork => Self::GiftCard, + api_enums::PaymentMethodType::Benefit + | api_enums::PaymentMethodType::Knet + | api_enums::PaymentMethodType::MomoAtm + +----- END CHUNK ----- \ No newline at end of file diff --git a/raw/cc/cc44831c51893805d76afc284107597a9dcd9963.txt b/raw/cc/cc44831c51893805d76afc284107597a9dcd9963.txt new file mode 100644 index 0000000000000000000000000000000000000000..82edcbe39facbcc9d911ff5b3beea7222e31dd6b --- /dev/null +++ b/raw/cc/cc44831c51893805d76afc284107597a9dcd9963.txt @@ -0,0 +1,225 @@ +ROUTE: juspay/hyperswitch@cc44831c51893805d76afc284107597a9dcd9963 +REPO: https://github.com/juspay/hyperswitch +COMMIT: cc44831c51893805d76afc284107597a9dcd9963 +AUTHOR: Hrithikesh <61539176+hrithikesh026@users.noreply.github.com> +DATE: 2025-08-22T13:08:58 + +=== ISSUE_AND_PR === +[PR #9019] fix(redis): add support for fetching multiple keys for redis cluster +URL: https://github.com/juspay/hyperswitch/pull/9019 +BODY: +## Type of Change + + +- [x] Bugfix +- [ ] New feature +- [ ] Enhancement +- [ ] Refactoring +- [ ] Dependency updates +- [ ] Documentation +- [ ] CI/CD + +## Description + +added support for fetching multiple keys for redis cluster. + +Earlier, we were using `mget` to fetch multiple keys. While this works fine for standalone redis, it would fail for redis cluster(it won't work if redis keys are stored in multiple hash slots). + + +So, introduced a new redis interface function to use `mget` for standalone redis and parallel `get` calls for cluster redis. + +### Additional Changes + +- [ ] This PR modifies the API contract +- [ ] This PR modifies the database schema +- [ ] This PR modifies application configuration/environment variables + + + + +## Motivation and Context + + + +## How did you test it? + +test cases same as this PR: https://github.com/juspay/hyperswitch/pull/8887 + +Tested in an internal environment with redis cluster setup enabled. + +## Checklist + + +- [x] I formatted the code `cargo +nightly fmt --all` +- [x] I addressed lints thrown by `cargo clippy` +- [x] I reviewed the submitted code +- [ ] I added unit tests for my changes where possible +COMMENTS: +- semanticdiff-com[bot]: Review changes with  SemanticDiff +
+Changed Files +
+ +| File | Status | +| :--- | :--- | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9019/changes#crates/redis_interface/src/commands.rs)  [crates/redis\_interface/src/commands\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9019/changes#crates/redis_interface/src/commands.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9019/changes#crates/redis_interface/src/commands.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9019/changes#crates/redis_interface/src/lib.rs)  [crates/redis\_interface/src/lib\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9019/changes#crates/redis_interface/src/lib.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9019/changes#crates/redis_interface/src/lib.rs)  0% smaller | + +
+- akshay-97 [crates/redis_interface/src/commands.rs:235]: are we expecting many keys in input, we could check fred pipeline so keys belonging to same shard can be pipelined +- hrithikesh026 [crates/redis_interface/src/commands.rs:235]: For now, We are fetching only 2 keys. Will explore fred pipeline option. + +=== COMMIT === +SUBJECT: fix(redis): add support for fetching multiple keys for redis cluster (#9019) + +=== FILES === +Summary: 2 files changed, +66 -11 +- crates/redis_interface/src/commands.rs (+64 -11) +- crates/redis_interface/src/lib.rs (+2 -0) + +=== PATCH === +diff --git a/crates/redis_interface/src/commands.rs b/crates/redis_interface/src/commands.rs +index 68d27ba5..b0bf47e9 100644 +--- a/crates/redis_interface/src/commands.rs ++++ b/crates/redis_interface/src/commands.rs +@@ -199,7 +199,7 @@ impl super::RedisConnectionPool { + } + + #[instrument(level = "DEBUG", skip(self))] +- pub async fn get_multiple_keys( ++ async fn get_multiple_keys_with_mget( + &self, + keys: &[RedisKey], + ) -> CustomResult>, errors::RedisError> +@@ -212,13 +212,69 @@ impl super::RedisConnectionPool { + + let tenant_aware_keys: Vec = + keys.iter().map(|key| key.tenant_aware_key(self)).collect(); ++ self.pool ++ .mget(tenant_aware_keys) ++ .await ++ .change_context(errors::RedisError::GetFailed) ++ } + +- match self +- .pool +- .mget(tenant_aware_keys.clone()) ++ #[instrument(level = "DEBUG", skip(self))] ++ async fn get_multiple_keys_with_parallel_get( ++ &self, ++ keys: &[RedisKey], ++ ) -> CustomResult>, errors::RedisError> ++ where ++ V: FromRedis + Unpin + Send + 'static, ++ { ++ if keys.is_empty() { ++ return Ok(Vec::new()); ++ } ++ let tenant_aware_keys: Vec = ++ keys.iter().map(|key| key.tenant_aware_key(self)).collect(); ++ ++ let futures = tenant_aware_keys ++ .iter() ++ .map(|redis_key| self.pool.get::, _>(redis_key)); ++ ++ let results = futures::future::try_join_all(futures) + .await + .change_context(errors::RedisError::GetFailed) +- { ++ .attach_printable("Failed to get keys in cluster mode")?; ++ ++ Ok(results) ++ } ++ ++ /// Helper method to encapsulate the logic for choosing between cluster and non-cluster modes ++ #[instrument(level = "DEBUG", skip(self))] ++ async fn get_keys_by_mode( ++ &self, ++ keys: &[RedisKey], ++ ) -> CustomResult>, errors::RedisError> ++ where ++ V: FromRedis + Unpin + Send + 'static, ++ { ++ if self.config.cluster_enabled { ++ // Use individual GET commands for cluster mode to avoid CROSSSLOT errors ++ self.get_multiple_keys_with_parallel_get(keys).await ++ } else { ++ // Use MGET for non-cluster mode for better performance ++ self.get_multiple_keys_with_mget(keys).await ++ } ++ } ++ ++ #[instrument(level = "DEBUG", skip(self))] ++ pub async fn get_multiple_keys( ++ &self, ++ keys: &[RedisKey], ++ ) -> CustomResult>, errors::RedisError> ++ where ++ V: FromRedis + Unpin + Send + 'static, ++ { ++ if keys.is_empty() { ++ return Ok(Vec::new()); ++ } ++ ++ match self.get_keys_by_mode(keys).await { + Ok(values) => Ok(values), + Err(_err) => { + #[cfg(not(feature = "multitenancy_fallback"))] +@@ -228,15 +284,12 @@ impl super::RedisConnectionPool { + + #[cfg(feature = "multitenancy_fallback")] + { +- let tenant_unaware_keys: Vec = keys ++ let tenant_unaware_keys: Vec = keys + .iter() +- .map(|key| key.tenant_unaware_key(self)) ++ .map(|key| key.tenant_unaware_key(self).into()) + .collect(); + +- self.pool +- .mget(tenant_unaware_keys) +- .await +- .change_context(errors::RedisError::GetFailed) ++ self.get_keys_by_mode(&tenant_unaware_keys).await + } + } + } +diff --git a/crates/redis_interface/src/lib.rs b/crates/redis_interface/src/lib.rs +index 09518637..1a6c191c 100644 +--- a/crates/redis_interface/src/lib.rs ++++ b/crates/redis_interface/src/lib.rs +@@ -237,6 +237,7 @@ pub struct RedisConfig { + default_ttl: u32, + default_stream_read_count: u64, + default_hash_ttl: u32, ++ cluster_enabled: bool, + } + + impl From<&RedisSettings> for RedisConfig { +@@ -245,6 +246,7 @@ impl From<&RedisSettings> for RedisConfig { + default_ttl: config.default_ttl, + default_stream_read_count: config.stream_read_count, + default_hash_ttl: config.default_hash_ttl, ++ cluster_enabled: config.cluster_enabled, + } + } + } + +----- END CHUNK ----- \ No newline at end of file diff --git a/raw/cc/ccccdf280fd00a55a8262384a8a8e9b0655cd7d5.txt b/raw/cc/ccccdf280fd00a55a8262384a8a8e9b0655cd7d5.txt new file mode 100644 index 0000000000000000000000000000000000000000..31f5bfc83384702fd3be12198d4746700b333fe3 --- /dev/null +++ b/raw/cc/ccccdf280fd00a55a8262384a8a8e9b0655cd7d5.txt @@ -0,0 +1,44 @@ +ROUTE: juspay/hyperswitch@ccccdf280fd00a55a8262384a8a8e9b0655cd7d5 +REPO: https://github.com/juspay/hyperswitch +COMMIT: ccccdf280fd00a55a8262384a8a8e9b0655cd7d5 +AUTHOR: github-actions <41898282+github-actions[bot]@users.noreply.github.com> +DATE: 2025-08-21T00:29:46 + +=== COMMIT === +SUBJECT: chore(version): 2025.08.21.0 + +=== FILES === +Summary: 1 files changed, +17 -0 +- CHANGELOG.md (+17 -0) + +=== PATCH === +diff --git a/CHANGELOG.md b/CHANGELOG.md +index 61fe48a5..a68e34f1 100644 +--- a/CHANGELOG.md ++++ b/CHANGELOG.md +@@ -4,6 +4,23 @@ All notable changes to HyperSwitch will be documented here. + + - - - + ++## 2025.08.21.0 ++ ++### Features ++ ++- **connector:** ++ - [DWOLLA] Connector integration ([#8586](https://github.com/juspay/hyperswitch/pull/8586)) ([`c09c936`](https://github.com/juspay/hyperswitch/commit/c09c936643170c595303293601d41c4207e12068)) ++ - [CELERO] Integrate Card Payments (Alpha) ([#8574](https://github.com/juspay/hyperswitch/pull/8574)) ([`e1fc141`](https://github.com/juspay/hyperswitch/commit/e1fc14135cc3527cfb5afeccd4934bad8386c7b1)) ++- **payment-methods:** [Proxy] add saved card flow for proxy payments ([#8964](https://github.com/juspay/hyperswitch/pull/8964)) ([`73dfa5e`](https://github.com/juspay/hyperswitch/commit/73dfa5e4fa3da2772648678e5ce0dbee4d1a63b5)) ++ ++### Bug Fixes ++ ++- **authentication:** Changed required value for juspayThreedsserver config ([#8890](https://github.com/juspay/hyperswitch/pull/8890)) ([`a56d78a`](https://github.com/juspay/hyperswitch/commit/a56d78a46a3ee80cdb2b48f9abfd2cd7b297e328)) ++ ++**Full Changelog:** [`2025.08.20.0...2025.08.21.0`](https://github.com/juspay/hyperswitch/compare/2025.08.20.0...2025.08.21.0) ++ ++- - - ++ + ## 2025.08.20.0 + + ### Features + +----- END CHUNK ----- \ No newline at end of file diff --git a/raw/ce/ce0159b6d098dba1e00622d18b0f1b29f2151b9f.txt b/raw/ce/ce0159b6d098dba1e00622d18b0f1b29f2151b9f.txt new file mode 100644 index 0000000000000000000000000000000000000000..53b6ae281c242ebaeb72ccd1113407e61dc387cc --- /dev/null +++ b/raw/ce/ce0159b6d098dba1e00622d18b0f1b29f2151b9f.txt @@ -0,0 +1,2351 @@ +ROUTE: juspay/hyperswitch@ce0159b6d098dba1e00622d18b0f1b29f2151b9f +REPO: https://github.com/juspay/hyperswitch +COMMIT: ce0159b6d098dba1e00622d18b0f1b29f2151b9f +AUTHOR: Swangi Kumari <85639103+swangi-kumari@users.noreply.github.com> +DATE: 2025-08-26T06:48:51 + +=== ISSUE_AND_PR === +[PR #9011] feat(connector): [Paysafe] add connector template code +URL: https://github.com/juspay/hyperswitch/pull/9011 +BODY: +## Type of Change + + +- [ ] Bugfix +- [x] New feature +- [ ] Enhancement +- [ ] Refactoring +- [ ] Dependency updates +- [ ] Documentation +- [ ] CI/CD + +## Description +Add connector template code for Paysafe + +### Additional Changes + +- [ ] This PR modifies the API contract +- [ ] This PR modifies the database schema +- [ ] This PR modifies application configuration/environment variables + + + + +## Motivation and Context + + + +## How did you test it? +No test required as it is template PR + + +## Checklist + + +- [x] I formatted the code `cargo +nightly fmt --all` +- [x] I addressed lints thrown by `cargo clippy` +- [x] I reviewed the submitted code +- [ ] I added unit tests for my changes where possible +COMMENTS: +- semanticdiff-com[bot]: Review changes with  SemanticDiff +
+Changed Files +
+ +| File | Status | +| :--- | :--- | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9011/changes#crates/router/src/connector.rs)  [crates/router/src/connector\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9011/changes#crates/router/src/connector.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9011/changes#crates/router/src/connector.rs)  100% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9011/changes#crates/hyperswitch_connectors/src/connectors.rs)  [crates/hyperswitch\_connectors/src/connectors\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9011/changes#crates/hyperswitch_connectors/src/connectors.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9011/changes#crates/hyperswitch_connectors/src/connectors.rs)  77% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9011/changes#crates/hyperswitch_connectors/src/default_implementations_v2.rs)  [crates/hyperswitch\_connectors/src/default\_implementations\_v2\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9011/changes#crates/hyperswitch_connectors/src/default_implementations_v2.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9011/changes#crates/hyperswitch_connectors/src/default_implementations_v2.rs)  20% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9011/changes#crates/hyperswitch_connectors/src/default_implementations.rs)  [crates/hyperswitch\_connectors/src/default\_implementations\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9011/changes#crates/hyperswitch_connectors/src/default_implementations.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9011/changes#crates/hyperswitch_connectors/src/default_implementations.rs)  17% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9011/changes#config/config.example.toml)  [config/config\.example\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9011/changes#config/config.example.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9011/changes#config/deployments/integration_test.toml)  [config/deployments/integration\_test\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9011/changes#config/deployments/integration_test.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9011/changes#config/deployments/production.toml)  [config/deployments/production\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9011/changes#config/deployments/production.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9011/changes#config/deployments/sandbox.toml)  [config/deployments/sandbox\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9011/changes#config/deployments/sandbox.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9011/changes#config/development.toml)  [config/development\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9011/changes#config/development.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9011/changes#config/docker_compose.toml)  [config/docker\_compose\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9011/changes#config/docker_compose.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9011/changes#crates/connector_configs/src/connector.rs)  [crates/connector\_configs/src/connector\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9011/changes#crates/connector_configs/src/connector.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9011/changes#crates/connector_configs/src/connector.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9011/changes#crates/connector_configs/toml/development.toml)  [crates/connector\_configs/toml/development\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9011/changes#crates/connector_configs/toml/development.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9011/changes#crates/connector_configs/toml/production.toml)  [crates/connector\_configs/toml/production\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9011/changes#crates/connector_configs/toml/production.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9011/changes#crates/connector_configs/toml/sandbox.toml)  [crates/connector\_configs/toml/sandbox\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9011/changes#crates/connector_configs/toml/sandbox.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9011/changes#crates/hyperswitch_connectors/src/connectors/paysafe.rs)  [crates/hyperswitch\_connectors/src/connectors/paysafe\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9011/changes#crates/hyperswitch_connectors/src/connectors/paysafe.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9011/changes#crates/hyperswitch_connectors/src/connectors/paysafe.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9011/changes#crates/hyperswitch_connectors/src/connectors/paysafe/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/paysafe/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9011/changes#crates/hyperswitch_connectors/src/connectors/paysafe/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9011/changes#crates/hyperswitch_connectors/src/connectors/paysafe/transformers.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9011/changes#crates/hyperswitch_domain_models/src/connector_endpoints.rs)  [crates/hyperswitch\_domain\_models/src/connector\_endpoints\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9011/changes#crates/hyperswitch_domain_models/src/connector_endpoints.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9011/changes#crates/hyperswitch_domain_models/src/connector_endpoints.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9011/changes#crates/router/tests/connectors/main.rs)  [crates/router/tests/connectors/main\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9011/changes#crates/router/tests/connectors/main.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9011/changes#crates/router/tests/connectors/main.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9011/changes#crates/router/tests/connectors/paysafe.rs)  [crates/router/tests/connectors/paysafe\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9011/changes#crates/router/tests/connectors/paysafe.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9011/changes#crates/router/tests/connectors/paysafe.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9011/changes#crates/test_utils/src/connector_auth.rs)  [crates/test\_utils/src/connector\_auth\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9011/changes#crates/test_utils/src/connector_auth.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9011/changes#crates/test_utils/src/connector_auth.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9011/changes#loadtest/config/development.toml)  [loadtest/config/development\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9011/changes#loadtest/config/development.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9011/changes#scripts/add_connector.sh)  [scripts/add\_connector\.sh](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9011/changes#scripts/add_connector.sh) | Unsupported file format | + +
+ +=== COMMIT === +SUBJECT: feat(connector): [Paysafe] add connector template code (#9011) + +=== FILES === +Summary: 22 files changed, +1395 -25 +- config/config.example.toml (+1 -0) +- config/deployments/integration_test.toml (+1 -0) +- config/deployments/production.toml (+1 -0) +- config/deployments/sandbox.toml (+1 -0) +- config/development.toml (+1 -0) +- config/docker_compose.toml (+1 -0) +- crates/connector_configs/src/connector.rs (+1 -0) +- crates/connector_configs/toml/development.toml (+4 -0) +- crates/connector_configs/toml/production.toml (+4 -0) +- crates/connector_configs/toml/sandbox.toml (+5 -1) +- crates/hyperswitch_connectors/src/connectors.rs (+8 -7) +- crates/hyperswitch_connectors/src/connectors/paysafe.rs (+621 -0) +- crates/hyperswitch_connectors/src/connectors/paysafe/transformers.rs (+219 -0) +- crates/hyperswitch_connectors/src/default_implementations.rs (+55 -0) +- crates/hyperswitch_connectors/src/default_implementations_v2.rs (+30 -0) +- crates/hyperswitch_domain_models/src/connector_endpoints.rs (+1 -0) +- crates/router/src/connector.rs (+16 -16) +- crates/router/tests/connectors/main.rs (+1 -0) +- crates/router/tests/connectors/paysafe.rs (+421 -0) +- crates/test_utils/src/connector_auth.rs (+1 -0) +- loadtest/config/development.toml (+1 -0) +- scripts/add_connector.sh (+1 -1) + +=== PATCH === +diff --git a/config/config.example.toml b/config/config.example.toml +index 0467346e..5fe3dbd0 100644 +--- a/config/config.example.toml ++++ b/config/config.example.toml +@@ -276,6 +276,7 @@ payload.base_url = "https://api.payload.com" + payme.base_url = "https://sandbox.payme.io/" + payone.base_url = "https://payment.preprod.payone.com/" + paypal.base_url = "https://api-m.sandbox.paypal.com/" ++paysafe.base_url = "https://api.test.paysafe.com/paymenthub/" + paystack.base_url = "https://api.paystack.co" + paytm.base_url = "https://securegw-stage.paytm.in/" + payu.base_url = "https://secure.snd.payu.com/" +diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml +index a7dc0f04..21ac7323 100644 +--- a/config/deployments/integration_test.toml ++++ b/config/deployments/integration_test.toml +@@ -113,6 +113,7 @@ payload.base_url = "https://api.payload.com" + payme.base_url = "https://sandbox.payme.io/" + payone.base_url = "https://payment.preprod.payone.com/" + paypal.base_url = "https://api-m.sandbox.paypal.com/" ++paysafe.base_url = "https://api.test.paysafe.com/paymenthub/" + paystack.base_url = "https://api.paystack.co" + paytm.base_url = "https://securegw-stage.paytm.in/" + payu.base_url = "https://secure.snd.payu.com/" +diff --git a/config/deployments/production.toml b/config/deployments/production.toml +index 07fc2b06..853ec279 100644 +--- a/config/deployments/production.toml ++++ b/config/deployments/production.toml +@@ -117,6 +117,7 @@ payload.base_url = "https://api.payload.com" + payme.base_url = "https://live.payme.io/" + payone.base_url = "https://payment.payone.com/" + paypal.base_url = "https://api-m.paypal.com/" ++paysafe.base_url = "https://api.test.paysafe.com/paymenthub/" + paystack.base_url = "https://api.paystack.co" + paytm.base_url = "https://securegw-stage.paytm.in/" + payu.base_url = "https://secure.payu.com/api/" +diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml +index dbbe67f0..dbd5e87e 100644 +--- a/config/deployments/sandbox.toml ++++ b/config/deployments/sandbox.toml +@@ -117,6 +117,7 @@ payload.base_url = "https://api.payload.com" + payme.base_url = "https://sandbox.payme.io/" + payone.base_url = "https://payment.preprod.payone.com/" + paypal.base_url = "https://api-m.sandbox.paypal.com/" ++paysafe.base_url = "https://api.test.paysafe.com/paymenthub/" + paystack.base_url = "https://api.paystack.co" + paytm.base_url = "https://securegw-stage.paytm.in/" + payu.base_url = "https://secure.snd.payu.com/" +diff --git a/config/development.toml b/config/development.toml +index 0a2caf35..1215c323 100644 +--- a/config/development.toml ++++ b/config/development.toml +@@ -315,6 +315,7 @@ payload.base_url = "https://api.payload.com" + payme.base_url = "https://sandbox.payme.io/" + payone.base_url = "https://payment.preprod.payone.com/" + paypal.base_url = "https://api-m.sandbox.paypal.com/" ++paysafe.base_url = "https://api.test.paysafe.com/paymenthub/" + paystack.base_url = "https://api.paystack.co" + paytm.base_url = "https://securegw-stage.paytm.in/" + payu.base_url = "https://secure.snd.payu.com/" +diff --git a/config/docker_compose.toml b/config/docker_compose.toml +index 5c753b91..75305234 100644 +--- a/config/docker_compose.toml ++++ b/config/docker_compose.toml +@@ -202,6 +202,7 @@ payload.base_url = "https://api.payload.com" + payme.base_url = "https://sandbox.payme.io/" + payone.base_url = "https://payment.preprod.payone.com/" + paypal.base_url = "https://api-m.sandbox.paypal.com/" ++paysafe.base_url = "https://api.test.paysafe.com/paymenthub/" + paystack.base_url = "https://api.paystack.co" + paytm.base_url = "https://securegw-stage.paytm.in/" + payu.base_url = "https://secure.snd.payu.com/" +diff --git a/crates/connector_configs/src/connector.rs b/crates/connector_configs/src/connector.rs +index c1cae71f..fbdb9745 100644 +--- a/crates/connector_configs/src/connector.rs ++++ b/crates/connector_configs/src/connector.rs +@@ -270,6 +270,7 @@ pub struct ConnectorConfig { + #[cfg(feature = "payouts")] + pub payone_payout: Option, + pub paypal: Option, ++ pub paysafe: Option, + #[cfg(feature = "payouts")] + pub paypal_payout: Option, + pub paystack: Option, +diff --git a/crates/connector_configs/toml/development.toml b/crates/connector_configs/toml/development.toml +index bdedcf9d..ac14c559 100644 +--- a/crates/connector_configs/toml/development.toml ++++ b/crates/connector_configs/toml/development.toml +@@ -6696,3 +6696,7 @@ payment_experience = "redirect_to_url" + [hyperwallet.connector_auth.BodyKey] + api_key = "Password" + key1 = "Username" ++ ++[paysafe] ++[paysafe.connector_auth.HeaderKey] ++api_key = "API Key" +diff --git a/crates/connector_configs/toml/production.toml b/crates/connector_configs/toml/production.toml +index 21c9f20f..5b14d328 100644 +--- a/crates/connector_configs/toml/production.toml ++++ b/crates/connector_configs/toml/production.toml +@@ -5366,3 +5366,7 @@ type = "Text" + [hyperwallet.connector_auth.BodyKey] + api_key = "Password" + key1 = "Username" ++ ++[paysafe] ++[paysafe.connector_auth.HeaderKey] ++api_key = "API Key" +diff --git a/crates/connector_configs/toml/sandbox.toml b/crates/connector_configs/toml/sandbox.toml +index 597c3fb7..486af693 100644 +--- a/crates/connector_configs/toml/sandbox.toml ++++ b/crates/connector_configs/toml/sandbox.toml +@@ -6679,4 +6679,8 @@ payment_experience = "redirect_to_url" + [hyperwallet] + [hyperwallet.connector_auth.BodyKey] + api_key = "Password" +-key1 = "Username" +\ No newline at end of file ++key1 = "Username" ++ ++[paysafe] ++[paysafe.connector_auth.HeaderKey] ++api_key = "API Key" +diff --git a/crates/hyperswitch_connectors/src/connectors.rs b/crates/hyperswitch_connectors/src/connectors.rs +index e6494a59..60d6866b 100644 +--- a/crates/hyperswitch_connectors/src/connectors.rs ++++ b/crates/hyperswitch_connectors/src/connectors.rs +@@ -83,6 +83,7 @@ pub mod payload; + pub mod payme; + pub mod payone; + pub mod paypal; ++pub mod paysafe; + pub mod paystack; + pub mod paytm; + pub mod payu; +@@ -148,13 +149,13 @@ pub use self::{ + netcetera::Netcetera, nexinets::Nexinets, nexixpay::Nexixpay, nmi::Nmi, nomupay::Nomupay, + noon::Noon, nordea::Nordea, novalnet::Novalnet, nuvei::Nuvei, opayo::Opayo, opennode::Opennode, + paybox::Paybox, payeezy::Payeezy, payload::Payload, payme::Payme, payone::Payone, +- paypal::Paypal, paystack::Paystack, paytm::Paytm, payu::Payu, phonepe::Phonepe, +- placetopay::Placetopay, plaid::Plaid, powertranz::Powertranz, prophetpay::Prophetpay, +- rapyd::Rapyd, razorpay::Razorpay, recurly::Recurly, redsys::Redsys, riskified::Riskified, +- santander::Santander, shift4::Shift4, sift::Sift, signifyd::Signifyd, silverflow::Silverflow, +- square::Square, stax::Stax, stripe::Stripe, stripebilling::Stripebilling, taxjar::Taxjar, +- threedsecureio::Threedsecureio, thunes::Thunes, tokenio::Tokenio, trustpay::Trustpay, +- trustpayments::Trustpayments, tsys::Tsys, ++ paypal::Paypal, paysafe::Paysafe, paystack::Paystack, paytm::Paytm, payu::Payu, ++ phonepe::Phonepe, placetopay::Placetopay, plaid::Plaid, powertranz::Powertranz, ++ prophetpay::Prophetpay, rapyd::Rapyd, razorpay::Razorpay, recurly::Recurly, redsys::Redsys, ++ riskified::Riskified, santander::Santander, shift4::Shift4, sift::Sift, signifyd::Signifyd, ++ silverflow::Silverflow, square::Square, stax::Stax, stripe::Stripe, ++ stripebilling::Stripebilling, taxjar::Taxjar, threedsecureio::Threedsecureio, thunes::Thunes, ++ tokenio::Tokenio, trustpay::Trustpay, trustpayments::Trustpayments, tsys::Tsys, + unified_authentication_service::UnifiedAuthenticationService, vgs::Vgs, volt::Volt, + wellsfargo::Wellsfargo, wellsfargopayout::Wellsfargopayout, wise::Wise, worldline::Worldline, + worldpay::Worldpay, worldpayvantiv::Worldpayvantiv, worldpayxml::Worldpayxml, xendit::Xendit, +diff --git a/crates/hyperswitch_connectors/src/connectors/paysafe.rs b/crates/hyperswitch_connectors/src/connectors/paysafe.rs +new file mode 100644 +index 00000000..fc76cece +--- /dev/null ++++ b/crates/hyperswitch_connectors/src/connectors/paysafe.rs +@@ -0,0 +1,621 @@ ++pub mod transformers; ++ ++use std::sync::LazyLock; ++ ++use common_enums::enums; ++use common_utils::{ ++ errors::CustomResult, ++ ext_traits::BytesExt, ++ request::{Method, Request, RequestBuilder, RequestContent}, ++ types::{AmountConvertor, StringMinorUnit, StringMinorUnitForConnector}, ++}; ++use error_stack::{report, ResultExt}; ++use hyperswitch_domain_models::{ ++ payment_method_data::PaymentMethodData, ++ router_data::{AccessToken, ConnectorAuthType, ErrorResponse, RouterData}, ++ router_flow_types::{ ++ access_token_auth::AccessTokenAuth, ++ payments::{Authorize, Capture, PSync, PaymentMethodToken, Session, SetupMandate, Void}, ++ refunds::{Execute, RSync}, ++ }, ++ router_request_types::{ ++ AccessTokenRequestData, PaymentMethodTokenizationData, PaymentsAuthorizeData, ++ PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData, ++ RefundsData, SetupMandateRequestData, ++ }, ++ router_response_types::{ ++ ConnectorInfo, PaymentsResponseData, RefundsResponseData, SupportedPaymentMethods, ++ }, ++ types::{ ++ PaymentsAuthorizeRouterData, PaymentsCaptureRouterData, PaymentsSyncRouterData, ++ RefundSyncRouterData, RefundsRouterData, ++ }, ++}; ++use hyperswitch_interfaces::{ ++ api::{ ++ self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications, ++ ConnectorValidation, ++ }, ++ configs::Connectors, ++ errors, ++ events::connector_api_logs::ConnectorEvent, ++ types::{self, Response}, ++ webhooks, ++}; ++use masking::{ExposeInterface, Mask}; ++use transformers as paysafe; ++ ++use crate::{constants::headers, types::ResponseRouterData, utils}; ++ ++#[derive(Clone)] ++pub struct Paysafe { ++ amount_converter: &'static (dyn AmountConvertor + Sync), ++} ++ ++impl Paysafe { ++ pub fn new() -> &'static Self { ++ &Self { ++ amount_converter: &StringMinorUnitForConnector, ++ } ++ } ++} ++ ++impl api::Payment for Paysafe {} ++impl api::PaymentSession for Paysafe {} ++impl api::ConnectorAccessToken for Paysafe {} ++impl api::MandateSetup for Paysafe {} ++impl api::PaymentAuthorize for Paysafe {} ++impl api::PaymentSync for Paysafe {} ++impl api::PaymentCapture for Paysafe {} ++impl api::PaymentVoid for Paysafe {} ++impl api::Refund for Paysafe {} ++impl api::RefundExecute for Paysafe {} ++impl api::RefundSync for Paysafe {} ++impl api::PaymentToken for Paysafe {} ++ ++impl ConnectorIntegration ++ for Paysafe ++{ ++ // Not Implemented (R) ++} ++ ++impl ConnectorCommonExt for Paysafe ++where ++ Self: ConnectorIntegration, ++{ ++ fn build_headers( ++ &self, ++ req: &RouterData, ++ _connectors: &Connectors, ++ ) -> CustomResult)>, errors::ConnectorError> { ++ let mut header = vec![( ++ headers::CONTENT_TYPE.to_string(), ++ self.get_content_type().to_string().into(), ++ )]; ++ let mut api_key = self.get_auth_header(&req.connector_auth_type)?; ++ header.append(&mut api_key); ++ Ok(header) ++ } ++} ++ ++impl ConnectorCommon for Paysafe { ++ fn id(&self) -> &'static str { ++ "paysafe" ++ } ++ ++ fn get_currency_unit(&self) -> api::CurrencyUnit { ++ api::CurrencyUnit::Minor ++ } ++ ++ fn common_get_content_type(&self) -> &'static str { ++ "application/json" ++ } ++ ++ fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str { ++ connectors.paysafe.base_url.as_ref() ++ } ++ ++ fn get_auth_header( ++ &self, ++ auth_type: &ConnectorAuthType, ++ ) -> CustomResult)>, errors::ConnectorError> { ++ let auth = paysafe::PaysafeAuthType::try_from(auth_type) ++ .change_context(errors::ConnectorError::FailedToObtainAuthType)?; ++ Ok(vec![( ++ headers::AUTHORIZATION.to_string(), ++ auth.api_key.expose().into_masked(), ++ )]) ++ } ++ ++ fn build_error_response( ++ &self, ++ res: Response, ++ event_builder: Option<&mut ConnectorEvent>, ++ ) -> CustomResult { ++ let response: paysafe::PaysafeErrorResponse = res ++ .response ++ .parse_struct("PaysafeErrorResponse") ++ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; ++ ++ event_builder.map(|i| i.set_response_body(&response)); ++ router_env::logger::info!(connector_response=?response); ++ ++ Ok(ErrorResponse { ++ status_code: res.status_code, ++ code: response.code, ++ message: response.message, ++ reason: response.reason, ++ attempt_status: None, ++ connector_transaction_id: None, ++ network_advice_code: None, ++ network_decline_code: None, ++ network_error_message: None, ++ connector_metadata: None, ++ }) ++ } ++} ++ ++impl ConnectorValidation for Paysafe { ++ fn validate_mandate_payment( ++ &self, ++ _pm_type: Option, ++ pm_data: PaymentMethodData, ++ ) -> CustomResult<(), errors::ConnectorError> { ++ match pm_data { ++ PaymentMethodData::Card(_) => Err(errors::ConnectorError::NotImplemented( ++ "validate_mandate_payment does not support cards".to_string(), ++ ) ++ .into()), ++ _ => Ok(()), ++ } ++ } ++ ++ fn validate_psync_reference_id( ++ &self, ++ _data: &PaymentsSyncData, ++ _is_three_ds: bool, ++ _status: enums::AttemptStatus, ++ _connector_meta_data: Option, ++ ) -> CustomResult<(), errors::ConnectorError> { ++ Ok(()) ++ } ++} ++ ++impl ConnectorIntegration for Paysafe { ++ //TODO: implement sessions flow ++} ++ ++impl ConnectorIntegration for Paysafe {} ++ ++impl ConnectorIntegration for Paysafe {} ++ ++impl ConnectorIntegration for Paysafe { ++ fn get_headers( ++ &self, ++ req: &PaymentsAuthorizeRouterData, ++ connectors: &Connectors, ++ ) -> CustomResult)>, errors::ConnectorError> { ++ self.build_headers(req, connectors) ++ } ++ ++ fn get_content_type(&self) -> &'static str { ++ self.common_get_content_type() ++ } ++ ++ fn get_url( ++ &self, ++ _req: &PaymentsAuthorizeRouterData, ++ _connectors: &Connectors, ++ ) -> CustomResult { ++ Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into()) ++ } ++ ++ fn get_request_body( ++ &self, ++ req: &PaymentsAuthorizeRouterData, ++ _connectors: &Connectors, ++ ) -> CustomResult { ++ let amount = utils::convert_amount( ++ self.amount_converter, ++ req.request.minor_amount, ++ req.request.currency, ++ )?; ++ ++ let connector_router_data = paysafe::PaysafeRouterData::from((amount, req)); ++ let connector_req = paysafe::PaysafePaymentsRequest::try_from(&connector_router_data)?; ++ Ok(RequestContent::Json(Box::new(connector_req))) ++ } ++ ++ fn build_request( ++ &self, ++ req: &PaymentsAuthorizeRouterData, ++ connectors: &Connectors, ++ ) -> CustomResult, errors::ConnectorError> { ++ Ok(Some( ++ RequestBuilder::new() ++ .method(Method::Post) ++ .url(&types::PaymentsAuthorizeType::get_url( ++ self, req, connectors, ++ )?) ++ .attach_default_headers() ++ .headers(types::PaymentsAuthorizeType::get_headers( ++ self, req, connectors, ++ )?) ++ .set_body(types::PaymentsAuthorizeType::get_request_body( ++ self, req, connectors, ++ )?) ++ .build(), ++ )) ++ } ++ ++ fn handle_response( ++ &self, ++ data: &PaymentsAuthorizeRouterData, ++ event_builder: Option<&mut ConnectorEvent>, ++ res: Response, ++ ) -> CustomResult { ++ let response: paysafe::PaysafePaymentsResponse = res ++ .response ++ .parse_struct("Paysafe PaymentsAuthorizeResponse") ++ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; ++ event_builder.map(|i| i.set_response_body(&response)); ++ router_env::logger::info!(connector_response=?response); ++ RouterData::try_from(ResponseRouterData { ++ response, ++ data: data.clone(), ++ http_code: res.status_code, ++ }) ++ } ++ ++ fn get_error_response( ++ &self, ++ res: Response, ++ event_builder: Option<&mut ConnectorEvent>, ++ ) -> CustomResult { ++ self.build_error_response(res, event_builder) ++ } ++} ++ ++impl ConnectorIntegration for Paysafe { ++ fn get_headers( ++ &self, ++ req: &PaymentsSyncRouterData, ++ connectors: &Connectors, ++ ) -> CustomResult)>, errors::ConnectorError> { ++ self.build_headers(req, connectors) ++ } ++ ++ fn get_content_type(&self) -> &'static str { ++ self.common_get_content_type() ++ } ++ ++ fn get_url( ++ &self, ++ _req: &PaymentsSyncRouterData, ++ _connectors: &Connectors, ++ ) -> CustomResult { ++ Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into()) ++ } ++ ++ fn build_request( ++ &self, ++ req: &PaymentsSyncRouterData, ++ connectors: &Connectors, ++ ) -> CustomResult, errors::ConnectorError> { ++ Ok(Some( ++ RequestBuilder::new() ++ .method(Method::Get) ++ .url(&types::PaymentsSyncType::get_url(self, req, connectors)?) ++ .attach_default_headers() ++ .headers(types::PaymentsSyncType::get_headers(self, req, connectors)?) ++ .build(), ++ )) ++ } ++ ++ fn handle_response( ++ &self, ++ data: &PaymentsSyncRouterData, ++ event_builder: Option<&mut ConnectorEvent>, ++ res: Response, ++ ) -> CustomResult { ++ let response: paysafe::PaysafePaymentsResponse = res ++ .response ++ .parse_struct("paysafe PaymentsSyncResponse") ++ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; ++ event_builder.map(|i| i.set_response_body(&response)); ++ router_env::logger::info!(connector_response=?response); ++ RouterData::try_from(ResponseRouterData { ++ response, ++ data: data.clone(), ++ http_code: res.status_code, ++ }) ++ } ++ ++ fn get_error_response( ++ &self, ++ res: Response, ++ event_builder: Option<&mut ConnectorEvent>, ++ ) -> CustomResult { ++ self.build_error_response(res, event_builder) ++ } ++} ++ ++impl ConnectorIntegration for Paysafe { ++ fn get_headers( ++ &self, ++ req: &PaymentsCaptureRouterData, ++ connectors: &Connectors, ++ ) -> CustomResult)>, errors::ConnectorError> { ++ self.build_headers(req, connectors) ++ } ++ ++ fn get_content_type(&self) -> &'static str { ++ self.common_get_content_type() ++ } ++ ++ fn get_url( ++ &self, ++ _req: &PaymentsCaptureRouterData, ++ _connectors: &Connectors, ++ ) -> CustomResult { ++ Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into()) ++ } ++ ++ fn get_request_body( ++ &self, ++ _req: &PaymentsCaptureRouterData, ++ _connectors: &Connectors, ++ ) -> CustomResult { ++ Err(errors::ConnectorError::NotImplemented("get_request_body method".to_string()).into()) ++ } ++ ++ fn build_request( ++ &self, ++ req: &PaymentsCaptureRouterData, ++ connectors: &Connectors, ++ ) -> CustomResult, errors::ConnectorError> { ++ Ok(Some( ++ RequestBuilder::new() ++ .method(Method::Post) ++ .url(&types::PaymentsCaptureType::get_url(self, req, connectors)?) ++ .attach_default_headers() ++ .headers(types::PaymentsCaptureType::get_headers( ++ self, req, connectors, ++ )?) ++ .set_body(types::PaymentsCaptureType::get_request_body( ++ self, req, connectors, ++ )?) ++ .build(), ++ )) ++ } ++ ++ fn handle_response( ++ &self, ++ data: &PaymentsCaptureRouterData, ++ event_builder: Option<&mut ConnectorEvent>, ++ res: Response, ++ ) -> CustomResult { ++ let response: paysafe::PaysafePaymentsResponse = res ++ .response ++ .parse_struct("Paysafe PaymentsCaptureResponse") ++ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; ++ event_builder.map(|i| i.set_response_body(&response)); ++ router_env::logger::info!(connector_response=?response); ++ RouterData::try_from(ResponseRouterData { ++ response, ++ data: data.clone(), ++ http_code: res.status_code, ++ }) ++ } ++ ++ fn get_error_response( ++ &self, ++ res: Response, ++ event_builder: Option<&mut ConnectorEvent>, ++ ) -> CustomResult { ++ self.build_error_response(res, event_builder) ++ } ++} ++ ++impl ConnectorIntegration for Paysafe {} ++ ++impl ConnectorIntegration for Paysafe { ++ fn get_headers( ++ &self, ++ req: &RefundsRouterData, ++ connectors: &Connectors, ++ ) -> CustomResult)>, errors::ConnectorError> { ++ self.build_headers(req, connectors) ++ } ++ ++ fn get_content_type(&self) -> &'static str { ++ self.common_get_content_type() ++ } ++ ++ fn get_url( ++ &self, ++ _req: &RefundsRouterData, ++ _connectors: &Connectors, ++ ) -> CustomResult { ++ Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into()) ++ } ++ ++ fn get_request_body( ++ &self, ++ req: &RefundsRouterData, ++ _connectors: &Connectors, ++ ) -> CustomResult { ++ let refund_amount = utils::convert_amount( ++ self.amount_converter, ++ req.request.minor_refund_amount, ++ req.request.currency, ++ )?; ++ ++ let connector_router_data = paysafe::PaysafeRouterData::from((refund_amount, req)); ++ let connector_req = paysafe::PaysafeRefundRequest::try_from(&connector_router_data)?; ++ Ok(RequestContent::Json(Box::new(connector_req))) ++ } ++ ++ fn build_request( ++ &self, ++ req: &RefundsRouterData, ++ connectors: &Connectors, ++ ) -> CustomResult, errors::ConnectorError> { ++ let request = RequestBuilder::new() ++ .method(Method::Post) ++ .url(&types::RefundExecuteType::get_url(self, req, connectors)?) ++ .attach_default_headers() ++ .headers(types::RefundExecuteType::get_headers( ++ self, req, connectors, ++ )?) ++ .set_body(types::RefundExecuteType::get_request_body( ++ self, req, connectors, ++ )?) ++ .build(); ++ Ok(Some(request)) ++ } ++ ++ fn handle_response( ++ &self, ++ data: &RefundsRouterData, ++ event_builder: Option<&mut ConnectorEvent>, ++ res: Response, ++ ) -> CustomResult, errors::ConnectorError> { ++ let response: paysafe::RefundResponse = res ++ .response ++ .parse_struct("paysafe RefundResponse") ++ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; ++ event_builder.map(|i| i.set_response_body(&response)); ++ router_env::logger::info!(connector_response=?response); ++ RouterData::try_from(ResponseRouterData { ++ response, ++ data: data.clone(), ++ http_code: res.status_code, ++ }) ++ } ++ ++ fn get_error_response( ++ &self, ++ res: Response, ++ event_builder: Option<&mut ConnectorEvent>, ++ ) -> CustomResult { ++ self.build_error_response(res, event_builder) ++ } ++} ++ ++impl ConnectorIntegration for Paysafe { ++ fn get_headers( ++ &self, ++ req: &RefundSyncRouterData, ++ connectors: &Connectors, ++ ) -> CustomResult)>, errors::ConnectorError> { ++ self.build_headers(req, connectors) ++ } ++ ++ fn get_content_type(&self) -> &'static str { ++ self.common_get_content_type() ++ } ++ ++ fn get_url( ++ &self, ++ _req: &RefundSyncRouterData, ++ _connectors: &Connectors, ++ ) -> CustomResult { ++ Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into()) ++ } ++ ++ fn build_request( ++ &self, ++ req: &RefundSyncRouterData, ++ connectors: &Connectors, ++ ) -> CustomResult, errors::ConnectorError> { ++ Ok(Some( ++ RequestBuilder::new() ++ .method(Method::Get) ++ .url(&types::RefundSyncType::get_url(self, req, connectors)?) ++ .attach_default_headers() ++ .headers(types::RefundSyncType::get_headers(self, req, connectors)?) ++ .set_body(types::RefundSyncType::get_request_body( ++ self, req, connectors, ++ )?) ++ .build(), ++ )) ++ } ++ ++ fn handle_response( ++ &self, ++ data: &RefundSyncRouterData, ++ event_builder: Option<&mut ConnectorEvent>, ++ res: Response, ++ ) -> CustomResult { ++ let response: paysafe::RefundResponse = res ++ .response ++ .parse_struct("paysafe RefundSyncResponse") ++ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; ++ event_builder.map(|i| i.set_response_body(&response)); ++ router_env::logger::info!(connector_response=?response); ++ RouterData::try_from(ResponseRouterData { ++ response, ++ data: data.clone(), ++ http_code: res.status_code, ++ }) ++ } ++ ++ fn get_error_response( ++ &self, ++ res: Response, ++ event_builder: Option<&mut ConnectorEvent>, ++ ) -> CustomResult { ++ self.build_error_response(res, event_builder) ++ } ++} ++ ++#[async_trait::async_trait] ++impl webhooks::IncomingWebhook for Paysafe { ++ fn get_webhook_object_reference_id( ++ &self, ++ _request: &webhooks::IncomingWebhookRequestDetails<'_>, ++ ) -> CustomResult { ++ Err(report!(errors::ConnectorError::WebhooksNotImplemented)) ++ } ++ ++ fn get_webhook_event_type( ++ &self, ++ _request: &webhooks::IncomingWebhookRequestDetails<'_>, ++ ) -> CustomResult { ++ Err(report!(errors::ConnectorError::WebhooksNotImplemented)) ++ } ++ ++ fn get_webhook_resource_object( ++ &self, ++ _request: &webhooks::IncomingWebhookRequestDetails<'_>, ++ ) -> CustomResult, errors::ConnectorError> { ++ Err(report!(errors::ConnectorError::WebhooksNotImplemented)) ++ } ++} ++ ++static PAYSAFE_SUPPORTED_PAYMENT_METHODS: LazyLock = ++ LazyLock::new(SupportedPaymentMethods::new); ++ ++static PAYSAFE_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { ++ display_name: "Paysafe", ++ description: "Paysafe connector", ++ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, ++ integration_status: enums::ConnectorIntegrationStatus::Sandbox, ++}; ++ ++static PAYSAFE_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 0] = []; ++ ++impl ConnectorSpecifications for Paysafe { ++ fn get_connector_about(&self) -> Option<&'static ConnectorInfo> { ++ Some(&PAYSAFE_CONNECTOR_INFO) ++ } ++ ++ fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> { ++ Some(&*PAYSAFE_SUPPORTED_PAYMENT_METHODS) ++ } ++ ++ fn get_supported_webhook_flows(&self) -> Option<&'static [enums::EventClass]> { ++ Some(&PAYSAFE_SUPPORTED_WEBHOOK_FLOWS) ++ } ++} +diff --git a/crates/hyperswitch_connectors/src/connectors/paysafe/transformers.rs b/crates/hyperswitch_connectors/src/connectors/paysafe/transformers.rs +new file mode 100644 +index 00000000..f1a7dbdc +--- /dev/null ++++ b/crates/hyperswitch_connectors/src/connectors/paysafe/transformers.rs +@@ -0,0 +1,219 @@ ++use common_enums::enums; ++use common_utils::types::StringMinorUnit; ++use hyperswitch_domain_models::{ ++ payment_method_data::PaymentMethodData, ++ router_data::{ConnectorAuthType, RouterData}, ++ router_flow_types::refunds::{Execute, RSync}, ++ router_request_types::ResponseId, ++ router_response_types::{PaymentsResponseData, RefundsResponseData}, ++ types::{PaymentsAuthorizeRouterData, RefundsRouterData}, ++}; ++use hyperswitch_interfaces::errors; ++use masking::Secret; ++use serde::{Deserialize, Serialize}; ++ ++use crate::types::{RefundsResponseRouterData, ResponseRouterData}; ++ ++//TODO: Fill the struct with respective fields ++pub struct PaysafeRouterData { ++ pub amount: StringMinorUnit, // The type of amount that a connector accepts, for example, String, i64, f64, etc. ++ pub router_data: T, ++} ++ ++impl From<(StringMinorUnit, T)> for PaysafeRouterData { ++ fn from((amount, item): (StringMinorUnit, T)) -> Self { ++ //Todo : use utils to convert the amount to the type of amount that a connector accepts ++ Self { ++ amount, ++ router_data: item, ++ } ++ } ++} ++ ++//TODO: Fill the struct with respective fields ++#[derive(Default, Debug, Serialize, PartialEq)] ++pub struct PaysafePaymentsRequest { ++ amount: StringMinorUnit, ++ card: PaysafeCard, ++} ++ ++#[derive(Default, Debug, Serialize, Eq, PartialEq)] ++pub struct PaysafeCard { ++ number: cards::CardNumber, ++ expiry_month: Secret, ++ expiry_year: Secret, ++ cvc: Secret, ++ complete: bool, ++} ++ ++impl TryFrom<&PaysafeRouterData<&PaymentsAuthorizeRouterData>> for PaysafePaymentsRequest { ++ type Error = error_stack::Report; ++ fn try_from( ++ item: &PaysafeRouterData<&PaymentsAuthorizeRouterData>, ++ ) -> Result { ++ match item.router_data.request.payment_method_data.clone() { ++ PaymentMethodData::Card(_) => Err(errors::ConnectorError::NotImplemented( ++ "Card payment method not implemented".to_string(), ++ ) ++ .into()), ++ _ => Err(errors::ConnectorError::NotImplemented("Payment method".to_string()).into()), ++ } ++ } ++} ++ ++//TODO: Fill the struct with respective fields ++// Auth Struct ++pub struct PaysafeAuthType { ++ pub(super) api_key: Secret, ++} ++ ++impl TryFrom<&ConnectorAuthType> for PaysafeAuthType { ++ type Error = error_stack::Report; ++ fn try_from(auth_type: &ConnectorAuthType) -> Result { ++ match auth_type { ++ ConnectorAuthType::HeaderKey { api_key } => Ok(Self { ++ api_key: api_key.to_owned(), ++ }), ++ _ => Err(errors::ConnectorError::FailedToObtainAuthType.into()), ++ } ++ } ++} ++// PaymentsResponse ++//TODO: Append the remaining status flags ++#[derive(Debug, Clone, Copy, Default, Serialize, Deserialize, PartialEq)] ++#[serde(rename_all = "lowercase")] ++pub enum PaysafePaymentStatus { ++ Succeeded, ++ Failed, ++ #[default] ++ Processing, ++} ++ ++impl From for common_enums::AttemptStatus { ++ fn from(item: PaysafePaymentStatus) -> Self { ++ match item { ++ PaysafePaymentStatus::Succeeded => Self::Charged, ++ PaysafePaymentStatus::Failed => Self::Failure, ++ PaysafePaymentStatus::Processing => Self::Authorizing, ++ } ++ } ++} ++ ++//TODO: Fill the struct with respective fields ++#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)] ++pub struct PaysafePaymentsResponse { ++ status: PaysafePaymentStatus, ++ id: String, ++} ++ ++impl TryFrom> ++ for RouterData ++{ ++ type Error = error_stack::Report; ++ fn try_from( ++ item: ResponseRouterData, ++ ) -> Result { ++ Ok(Self { ++ status: common_enums::AttemptStatus::from(item.response.status), ++ response: Ok(PaymentsResponseData::TransactionResponse { ++ resource_id: ResponseId::ConnectorTransactionId(item.response.id), ++ redirection_data: Box::new(None), ++ mandate_reference: Box::new(None), ++ connector_metadata: None, ++ network_txn_id: None, ++ connector_response_reference_id: None, ++ incremental_authorization_allowed: None, ++ charges: None, ++ }), ++ ..item.data ++ }) ++ } ++} ++ ++//TODO: Fill the struct with respective fields ++// REFUND : ++// Type definition for RefundRequest ++#[derive(Default, Debug, Serialize)] ++pub struct PaysafeRefundRequest { ++ pub amount: StringMinorUnit, ++} ++ ++impl TryFrom<&PaysafeRouterData<&RefundsRouterData>> for PaysafeRefundRequest { ++ type Error = error_stack::Report; ++ fn try_from(item: &PaysafeRouterData<&RefundsRouterData>) -> Result { ++ Ok(Self { ++ amount: item.amount.to_owned(), ++ }) ++ } ++} ++ ++// Type definition for Refund Response ++ ++#[allow(dead_code)] ++#[derive(Debug, Copy, Serialize, Default, Deserialize, Clone)] ++pub enum RefundStatus { ++ Succeeded, ++ Failed, ++ #[default] ++ Processing, ++} ++ ++impl From for enums::RefundStatus { ++ fn from(item: RefundStatus) -> Self { ++ match item { ++ RefundStatus::Succeeded => Self::Success, ++ RefundStatus::Failed => Self::Failure, ++ RefundStatus::Processing => Self::Pending, ++ //TODO: Review mapping ++ } ++ } ++} ++ ++//TODO: Fill the struct with respective fields ++#[derive(Default, Debug, Clone, Serialize, Deserialize)] ++pub struct RefundResponse { ++ id: String, ++ status: RefundStatus, ++} ++ ++impl TryFrom> for RefundsRouterData { ++ type Error = error_stack::Report; ++ fn try_from( ++ item: RefundsResponseRouterData, ++ ) -> Result { ++ Ok(Self { ++ response: Ok(RefundsResponseData { ++ connector_refund_id: item.response.id.to_string(), ++ refund_status: enums::RefundStatus::from(item.response.status), ++ }), ++ ..item.data ++ }) ++ } ++} ++ ++impl TryFrom> for RefundsRouterData { ++ type Error = error_stack::Report; ++ fn try_from( ++ item: RefundsResponseRouterData, ++ ) -> Result { ++ Ok(Self { ++ response: Ok(RefundsResponseData { ++ connector_refund_id: item.response.id.to_string(), ++ refund_status: enums::RefundStatus::from(item.response.status), ++ }), ++ ..item.data ++ }) ++ } ++} ++ ++//TODO: Fill the struct with respective fields ++#[derive(Default, Debug, Serialize, Deserialize, PartialEq)] ++pub struct PaysafeErrorResponse { ++ pub status_code: u16, ++ pub code: String, ++ pub message: String, ++ pub reason: Option, ++ pub network_advice_code: Option, ++ pub network_decline_code: Option, ++ pub network_error_message: Option, ++} +diff --git a/crates/hyperswitch_connectors/src/default_implementations.rs b/crates/hyperswitch_connectors/src/default_implementations.rs +index f18b6591..8b87e0c0 100644 +--- a/crates/hyperswitch_connectors/src/default_implementations.rs ++++ b/crates/hyperswitch_connectors/src/default_implementations.rs +@@ -228,6 +228,7 @@ default_imp_for_authorize_session_token!( + connectors::Payme, + connectors::Payone, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Paystack, + connectors::Paytm, + connectors::Payu, +@@ -374,6 +375,7 @@ default_imp_for_calculate_tax!( + connectors::Payme, + connectors::Payone, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Paystack, + connectors::Paytm, + connectors::Payu, +@@ -432,6 +434,7 @@ macro_rules! default_imp_for_session_update { + } + + default_imp_for_session_update!( ++ connectors::Paysafe, + connectors::Vgs, + connectors::Aci, + connectors::Adyen, +@@ -573,6 +576,7 @@ macro_rules! default_imp_for_post_session_tokens { + } + + default_imp_for_post_session_tokens!( ++ connectors::Paysafe, + connectors::Vgs, + connectors::Aci, + connectors::Adyen, +@@ -802,6 +806,7 @@ default_imp_for_create_order!( + connectors::Payme, + connectors::Payone, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Paystack, + connectors::Paytm, + connectors::Payu, +@@ -908,6 +913,7 @@ default_imp_for_update_metadata!( + connectors::Katapult, + connectors::Klarna, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Rapyd, + connectors::Razorpay, + connectors::Recurly, +@@ -1049,6 +1055,7 @@ default_imp_for_cancel_post_capture!( + connectors::Katapult, + connectors::Klarna, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Rapyd, + connectors::Razorpay, + connectors::Recurly, +@@ -1138,6 +1145,7 @@ macro_rules! default_imp_for_complete_authorize { + } + + default_imp_for_complete_authorize!( ++ connectors::Paysafe, + connectors::Silverflow, + connectors::Vgs, + connectors::Aci, +@@ -1257,6 +1265,7 @@ macro_rules! default_imp_for_incremental_authorization { + } + + default_imp_for_incremental_authorization!( ++ connectors::Paysafe, + connectors::Vgs, + connectors::Aci, + connectors::Adyen, +@@ -1473,6 +1482,7 @@ default_imp_for_create_customer!( + connectors::Payload, + connectors::Payone, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Paystack, + connectors::Paytm, + connectors::Payu, +@@ -1533,6 +1543,7 @@ macro_rules! default_imp_for_connector_redirect_response { + } + + default_imp_for_connector_redirect_response!( ++ connectors::Paysafe, + connectors::Trustpayments, + connectors::Vgs, + connectors::Aci, +@@ -1653,6 +1664,7 @@ macro_rules! default_imp_for_pre_processing_steps{ + } + + default_imp_for_pre_processing_steps!( ++ connectors::Paysafe, + connectors::Trustpayments, + connectors::Silverflow, + connectors::Vgs, +@@ -1858,6 +1870,7 @@ default_imp_for_post_processing_steps!( + connectors::Payme, + connectors::Payone, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Paystack, + connectors::Paytm, + connectors::Payu, +@@ -1999,6 +2012,7 @@ default_imp_for_approve!( + connectors::Payload, + connectors::Payme, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Paystack, + connectors::Paytm, + connectors::Payone, +@@ -2143,6 +2157,7 @@ default_imp_for_reject!( + connectors::Payone, + connectors::Payme, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Paystack, + connectors::Paytm, + connectors::Payu, +@@ -2208,6 +2223,7 @@ macro_rules! default_imp_for_webhook_source_verification { + } + + default_imp_for_webhook_source_verification!( ++ connectors::Paysafe, + connectors::Vgs, + connectors::Aci, + connectors::Adyen, +@@ -2427,6 +2443,7 @@ default_imp_for_accept_dispute!( + connectors::Payme, + connectors::Payone, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Paystack, + connectors::Paytm, + connectors::Payu, +@@ -2566,6 +2583,7 @@ default_imp_for_submit_evidence!( + connectors::Payload, + connectors::Payme, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Payone, + connectors::Paystack, + connectors::Paytm, +@@ -2706,6 +2724,7 @@ default_imp_for_defend_dispute!( + connectors::Payme, + connectors::Payone, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Paystack, + connectors::Paytm, + connectors::Payu, +@@ -2849,6 +2868,7 @@ default_imp_for_fetch_disputes!( + connectors::Payme, + connectors::Payone, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Paystack, + connectors::Payu, + connectors::Paytm, +@@ -2991,6 +3011,7 @@ default_imp_for_dispute_sync!( + connectors::Payme, + connectors::Payone, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Paystack, + connectors::Payu, + connectors::Paytm, +@@ -3140,6 +3161,7 @@ default_imp_for_file_upload!( + connectors::Payme, + connectors::Payone, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Paystack, + connectors::Paytm, + connectors::Payu, +@@ -3196,6 +3218,7 @@ macro_rules! default_imp_for_payouts { + } + + default_imp_for_payouts!( ++ connectors::Paysafe, + connectors::Affirm, + connectors::Vgs, + connectors::Aci, +@@ -3331,6 +3354,7 @@ macro_rules! default_imp_for_payouts_create { + + #[cfg(feature = "payouts")] + default_imp_for_payouts_create!( ++ connectors::Paysafe, + connectors::Vgs, + connectors::Aci, + connectors::Adyenplatform, +@@ -3470,6 +3494,7 @@ macro_rules! default_imp_for_payouts_retrieve { + + #[cfg(feature = "payouts")] + default_imp_for_payouts_retrieve!( ++ connectors::Paysafe, + connectors::Vgs, + connectors::Aci, + connectors::Adyen, +@@ -3686,6 +3711,7 @@ default_imp_for_payouts_eligibility!( + connectors::Payload, + connectors::Payme, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Paystack, + connectors::Paytm, + connectors::Payone, +@@ -3753,6 +3779,7 @@ macro_rules! default_imp_for_payouts_fulfill { + + #[cfg(feature = "payouts")] + default_imp_for_payouts_fulfill!( ++ connectors::Paysafe, + connectors::Affirm, + connectors::Vgs, + connectors::Aci, +@@ -3963,6 +3990,7 @@ default_imp_for_payouts_cancel!( + connectors::Payload, + connectors::Payme, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Paystack, + connectors::Paytm, + connectors::Payone, +@@ -4105,6 +4133,7 @@ default_imp_for_payouts_quote!( + connectors::Payone, + connectors::Payme, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Paystack, + connectors::Paytm, + connectors::Payu, +@@ -4247,6 +4276,7 @@ default_imp_for_payouts_recipient!( + connectors::Payme, + connectors::Payone, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Paystack, + connectors::Paytm, + connectors::Payu, +@@ -4389,6 +4419,7 @@ default_imp_for_payouts_recipient_account!( + connectors::Payme, + connectors::Payone, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Paystack, + connectors::Paytm, + connectors::Payu, +@@ -4533,6 +4564,7 @@ default_imp_for_frm_sale!( + connectors::Payme, + connectors::Payone, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Paystack, + connectors::Paytm, + connectors::Payu, +@@ -4676,6 +4708,7 @@ default_imp_for_frm_checkout!( + connectors::Payme, + connectors::Payone, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Paystack, + connectors::Paytm, + connectors::Payu, +@@ -4819,6 +4852,7 @@ default_imp_for_frm_transaction!( + connectors::Payme, + connectors::Payone, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Paystack, + connectors::Paytm, + connectors::Payu, +@@ -4962,6 +4996,7 @@ default_imp_for_frm_fulfillment!( + connectors::Payload, + connectors::Payme, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Paystack, + connectors::Paytm, + connectors::Payu, +@@ -5105,6 +5140,7 @@ default_imp_for_frm_record_return!( + connectors::Payme, + connectors::Payone, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Paystack, + connectors::Paytm, + connectors::Payu, +@@ -5242,6 +5278,7 @@ default_imp_for_revoking_mandates!( + connectors::Payme, + connectors::Payone, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Paystack, + connectors::Paytm, + connectors::Payu, +@@ -5382,6 +5419,7 @@ default_imp_for_uas_pre_authentication!( + connectors::Payme, + connectors::Payone, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Paystack, + connectors::Paytm, + connectors::Payu, +@@ -5522,6 +5560,7 @@ default_imp_for_uas_post_authentication!( + connectors::Payme, + connectors::Payone, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Paystack, + connectors::Paytm, + connectors::Payu, +@@ -5675,6 +5714,7 @@ default_imp_for_uas_authentication_confirmation!( + connectors::Multisafepay, + connectors::Paybox, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Placetopay, + connectors::Plaid, + connectors::Rapyd, +@@ -5799,6 +5839,7 @@ default_imp_for_connector_request_id!( + connectors::Payme, + connectors::Payone, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Powertranz, + connectors::Prophetpay, + connectors::Mifinity, +@@ -5931,6 +5972,7 @@ default_imp_for_fraud_check!( + connectors::Paystack, + connectors::Paytm, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Payu, + connectors::Phonepe, + connectors::Powertranz, +@@ -6107,6 +6149,7 @@ default_imp_for_connector_authentication!( + connectors::Paybox, + connectors::Payme, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Placetopay, + connectors::Plaid, + connectors::Rapyd, +@@ -6229,6 +6272,7 @@ default_imp_for_uas_authentication!( + connectors::Payeezy, + connectors::Payload, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Paystack, + connectors::Paytm, + connectors::Payu, +@@ -6370,6 +6414,7 @@ default_imp_for_revenue_recovery!( + connectors::Payu, + connectors::Phonepe, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Powertranz, + connectors::Prophetpay, + connectors::Mifinity, +@@ -6514,6 +6559,7 @@ default_imp_for_billing_connector_payment_sync!( + connectors::Payu, + connectors::Phonepe, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Powertranz, + connectors::Prophetpay, + connectors::Mifinity, +@@ -6656,6 +6702,7 @@ default_imp_for_revenue_recovery_record_back!( + connectors::Payu, + connectors::Phonepe, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Powertranz, + connectors::Prophetpay, + connectors::Mifinity, +@@ -6798,6 +6845,7 @@ default_imp_for_billing_connector_invoice_sync!( + connectors::Payu, + connectors::Phonepe, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Powertranz, + connectors::Prophetpay, + connectors::Mifinity, +@@ -6934,6 +6982,7 @@ default_imp_for_external_vault!( + connectors::Payu, + connectors::Phonepe, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Plaid, + connectors::Powertranz, + connectors::Prophetpay, +@@ -7076,6 +7125,7 @@ default_imp_for_external_vault_insert!( + connectors::Payu, + connectors::Phonepe, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Plaid, + connectors::Powertranz, + connectors::Prophetpay, +@@ -7218,6 +7268,7 @@ default_imp_for_external_vault_retrieve!( + connectors::Payu, + connectors::Phonepe, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Plaid, + connectors::Powertranz, + connectors::Prophetpay, +@@ -7360,6 +7411,7 @@ default_imp_for_external_vault_delete!( + connectors::Payu, + connectors::Phonepe, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Plaid, + connectors::Powertranz, + connectors::Prophetpay, +@@ -7502,6 +7554,7 @@ default_imp_for_external_vault_create!( + connectors::Payu, + connectors::Phonepe, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Plaid, + connectors::Powertranz, + connectors::Prophetpay, +@@ -7645,6 +7698,7 @@ default_imp_for_connector_authentication_token!( + connectors::Payu, + connectors::Phonepe, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Plaid, + connectors::Powertranz, + connectors::Prophetpay, +@@ -7789,6 +7843,7 @@ default_imp_for_external_vault_proxy_payments_create!( + connectors::Payme, + connectors::Payone, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Paystack, + connectors::Paytm, + connectors::Payu, +diff --git a/crates/hyperswitch_connectors/src/default_implementations_v2.rs b/crates/hyperswitch_connectors/src/default_implementations_v2.rs +index 2d346a0e..5dc07ab4 100644 +--- a/crates/hyperswitch_connectors/src/default_implementations_v2.rs ++++ b/crates/hyperswitch_connectors/src/default_implementations_v2.rs +@@ -338,6 +338,7 @@ default_imp_for_new_connector_integration_payment!( + connectors::Payload, + connectors::Payme, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Paystack, + connectors::Paytm, + connectors::Payu, +@@ -481,6 +482,7 @@ default_imp_for_new_connector_integration_refund!( + connectors::Payload, + connectors::Payme, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Paystack, + connectors::Paytm, + connectors::Payu, +@@ -616,6 +618,7 @@ default_imp_for_new_connector_integration_connector_authentication_token!( + connectors::Payload, + connectors::Payme, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Paystack, + connectors::Payu, + connectors::Placetopay, +@@ -750,6 +753,7 @@ default_imp_for_new_connector_integration_connector_access_token!( + connectors::Payload, + connectors::Payme, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Paystack, + connectors::Paytm, + connectors::Payu, +@@ -893,6 +897,7 @@ default_imp_for_new_connector_integration_accept_dispute!( + connectors::Payload, + connectors::Payme, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Paystack, + connectors::Paytm, + connectors::Payu, +@@ -1041,6 +1046,7 @@ default_imp_for_new_connector_integration_fetch_disputes!( + connectors::Payme, + connectors::Payone, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Paystack, + connectors::Paytm, + connectors::Payu, +@@ -1185,6 +1191,7 @@ default_imp_for_new_connector_integration_dispute_sync!( + connectors::Payme, + connectors::Payone, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Paystack, + connectors::Paytm, + connectors::Payu, +@@ -1324,6 +1331,7 @@ default_imp_for_new_connector_integration_defend_dispute!( + connectors::Payload, + connectors::Payme, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Paystack, + connectors::Paytm, + connectors::Payu, +@@ -1466,6 +1474,7 @@ default_imp_for_new_connector_integration_submit_evidence!( + connectors::Payload, + connectors::Payme, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Paystack, + connectors::Payu, + connectors::Paytm, +@@ -1619,6 +1628,7 @@ default_imp_for_new_connector_integration_file_upload!( + connectors::Payload, + connectors::Payme, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Paystack, + connectors::Paytm, + connectors::Payu, +@@ -1764,6 +1774,7 @@ default_imp_for_new_connector_integration_payouts_create!( + connectors::Payload, + connectors::Payme, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Paystack, + connectors::Paytm, + connectors::Payu, +@@ -1909,6 +1920,7 @@ default_imp_for_new_connector_integration_payouts_eligibility!( + connectors::Payload, + connectors::Payme, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Paystack, + connectors::Paytm, + connectors::Payu, +@@ -2054,6 +2066,7 @@ default_imp_for_new_connector_integration_payouts_fulfill!( + connectors::Payload, + connectors::Payme, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Paystack, + connectors::Paytm, + connectors::Payu, +@@ -2199,6 +2212,7 @@ default_imp_for_new_connector_integration_payouts_cancel!( + connectors::Payload, + connectors::Payme, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Paystack, + connectors::Paytm, + connectors::Payu, +@@ -2344,6 +2358,7 @@ default_imp_for_new_connector_integration_payouts_quote!( + connectors::Payload, + connectors::Payme, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Paystack, + connectors::Paytm, + connectors::Payu, +@@ -2489,6 +2504,7 @@ default_imp_for_new_connector_integration_payouts_recipient!( + connectors::Payload, + connectors::Payme, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Paystack, + connectors::Paytm, + connectors::Payu, +@@ -2634,6 +2650,7 @@ default_imp_for_new_connector_integration_payouts_sync!( + connectors::Payload, + connectors::Payme, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Paystack, + connectors::Paytm, + connectors::Payu, +@@ -2779,6 +2796,7 @@ default_imp_for_new_connector_integration_payouts_recipient_account!( + connectors::Payload, + connectors::Payme, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Paystack, + connectors::Paytm, + connectors::Payu, +@@ -2922,6 +2940,7 @@ default_imp_for_new_connector_integration_webhook_source_verification!( + connectors::Payload, + connectors::Payme, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Paystack, + connectors::Paytm, + connectors::Payu, +@@ -3067,6 +3086,7 @@ default_imp_for_new_connector_integration_frm_sale!( + connectors::Payload, + connectors::Payme, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Paystack, + connectors::Paytm, + connectors::Payu, +@@ -3212,6 +3232,7 @@ default_imp_for_new_connector_integration_frm_checkout!( + connectors::Payload, + connectors::Payme, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Paystack, + connectors::Paytm, + connectors::Payu, +@@ -3357,6 +3378,7 @@ default_imp_for_new_connector_integration_frm_transaction!( + connectors::Payload, + connectors::Payme, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Paystack, + connectors::Paytm, + connectors::Payu, +@@ -3502,6 +3524,7 @@ default_imp_for_new_connector_integration_frm_fulfillment!( + connectors::Payload, + connectors::Payme, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Paystack, + connectors::Paytm, + connectors::Payu, +@@ -3647,6 +3670,7 @@ default_imp_for_new_connector_integration_frm_record_return!( + connectors::Payload, + connectors::Payme, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Paystack, + connectors::Paytm, + connectors::Payu, +@@ -3711,6 +3735,7 @@ macro_rules! default_imp_for_new_connector_integration_revoking_mandates { + } + + default_imp_for_new_connector_integration_revoking_mandates!( ++ connectors::Paysafe, + connectors::Vgs, + connectors::Aci, + connectors::Adyen, +@@ -3847,6 +3872,7 @@ macro_rules! default_imp_for_new_connector_integration_frm { + + #[cfg(feature = "frm")] + default_imp_for_new_connector_integration_frm!( ++ connectors::Paysafe, + connectors::Trustpayments, + connectors::Affirm, + connectors::Paytm, +@@ -3989,6 +4015,7 @@ macro_rules! default_imp_for_new_connector_integration_connector_authentication + } + + default_imp_for_new_connector_integration_connector_authentication!( ++ connectors::Paysafe, + connectors::Trustpayments, + connectors::Affirm, + connectors::Paytm, +@@ -4120,6 +4147,7 @@ macro_rules! default_imp_for_new_connector_integration_revenue_recovery { + } + + default_imp_for_new_connector_integration_revenue_recovery!( ++ connectors::Paysafe, + connectors::Trustpayments, + connectors::Affirm, + connectors::Paytm, +@@ -4339,6 +4367,7 @@ default_imp_for_new_connector_integration_external_vault!( + connectors::Payload, + connectors::Payme, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Paystack, + connectors::Paytm, + connectors::Payu, +@@ -4486,6 +4515,7 @@ default_imp_for_new_connector_integration_external_vault_proxy!( + connectors::Payme, + connectors::Payone, + connectors::Paypal, ++ connectors::Paysafe, + connectors::Paystack, + connectors::Paytm, + connectors::Payu, +diff --git a/crates/hyperswitch_domain_models/src/connector_endpoints.rs b/crates/hyperswitch_domain_models/src/connector_endpoints.rs +index 53b17691..d6b62a5e 100644 +--- a/crates/hyperswitch_domain_models/src/connector_endpoints.rs ++++ b/crates/hyperswitch_domain_models/src/connector_endpoints.rs +@@ -98,6 +98,7 @@ pub struct Connectors { + pub payme: ConnectorParams, + pub payone: ConnectorParams, + pub paypal: ConnectorParams, ++ pub paysafe: ConnectorParams, + pub paystack: ConnectorParams, + pub paytm: ConnectorParams, + pub payu: ConnectorParams, +diff --git a/crates/router/src/connector.rs b/crates/router/src/connector.rs +index 5e375593..a8e859cc 100644 +--- a/crates/router/src/connector.rs ++++ b/crates/router/src/connector.rs +@@ -31,20 +31,20 @@ pub use hyperswitch_connectors::connectors::{ + nexixpay, nexixpay::Nexixpay, nmi, nmi::Nmi, nomupay, nomupay::Nomupay, noon, noon::Noon, + nordea, nordea::Nordea, novalnet, novalnet::Novalnet, nuvei, nuvei::Nuvei, opayo, opayo::Opayo, + opennode, opennode::Opennode, paybox, paybox::Paybox, payeezy, payeezy::Payeezy, payload, +- payload::Payload, payme, payme::Payme, payone, payone::Payone, paypal, paypal::Paypal, +- paystack, paystack::Paystack, paytm, paytm::Paytm, payu, payu::Payu, phonepe, phonepe::Phonepe, +- placetopay, placetopay::Placetopay, plaid, plaid::Plaid, powertranz, powertranz::Powertranz, +- prophetpay, prophetpay::Prophetpay, rapyd, rapyd::Rapyd, razorpay, razorpay::Razorpay, recurly, +- recurly::Recurly, redsys, redsys::Redsys, riskified, riskified::Riskified, santander, +- santander::Santander, shift4, shift4::Shift4, sift, sift::Sift, signifyd, signifyd::Signifyd, +- silverflow, silverflow::Silverflow, square, square::Square, stax, stax::Stax, stripe, +- stripe::Stripe, stripebilling, stripebilling::Stripebilling, taxjar, taxjar::Taxjar, +- threedsecureio, threedsecureio::Threedsecureio, thunes, thunes::Thunes, tokenio, +- tokenio::Tokenio, trustpay, trustpay::Trustpay, trustpayments, trustpayments::Trustpayments, +- tsys, tsys::Tsys, unified_authentication_service, +- unified_authentication_service::UnifiedAuthenticationService, vgs, vgs::Vgs, volt, volt::Volt, +- wellsfargo, wellsfargo::Wellsfargo, wellsfargopayout, wellsfargopayout::Wellsfargopayout, wise, +- wise::Wise, worldline, worldline::Worldline, worldpay, worldpay::Worldpay, worldpayvantiv, +- worldpayvantiv::Worldpayvantiv, worldpayxml, worldpayxml::Worldpayxml, xendit, xendit::Xendit, +- zen, zen::Zen, zsl, zsl::Zsl, ++ payload::Payload, payme, payme::Payme, payone, payone::Payone, paypal, paypal::Paypal, paysafe, ++ paysafe::Paysafe, paystack, paystack::Paystack, paytm, paytm::Paytm, payu, payu::Payu, phonepe, ++ phonepe::Phonepe, placetopay, placetopay::Placetopay, plaid, plaid::Plaid, powertranz, ++ powertranz::Powertranz, prophetpay, prophetpay::Prophetpay, rapyd, rapyd::Rapyd, razorpay, ++ razorpay::Razorpay, recurly, recurly::Recurly, redsys, redsys::Redsys, riskified, ++ riskified::Riskified, santander, santander::Santander, shift4, shift4::Shift4, sift, ++ sift::Sift, signifyd, signifyd::Signifyd, silverflow, silverflow::Silverflow, square, ++ square::Square, stax, stax::Stax, stripe, stripe::Stripe, stripebilling, ++ stripebilling::Stripebilling, taxjar, taxjar::Taxjar, threedsecureio, ++ threedsecureio::Threedsecureio, thunes, thunes::Thunes, tokenio, tokenio::Tokenio, trustpay, ++ trustpay::Trustpay, trustpayments, trustpayments::Trustpayments, tsys, tsys::Tsys, ++ unified_authentication_service, unified_authentication_service::UnifiedAuthenticationService, ++ vgs, vgs::Vgs, volt, volt::Volt, wellsfargo, wellsfargo::Wellsfargo, wellsfargopayout, ++ wellsfargopayout::Wellsfargopayout, wise, wise::Wise, worldline, worldline::Worldline, ++ worldpay, worldpay::Worldpay, worldpayvantiv, worldpayvantiv::Worldpayvantiv, worldpayxml, ++ worldpayxml::Worldpayxml, xendit, xendit::Xendit, zen, zen::Zen, zsl, zsl::Zsl, + }; +diff --git a/crates/router/tests/connectors/main.rs b/crates/router/tests/connectors/main.rs +index ca96206e..87434a0e 100644 +--- a/crates/router/tests/connectors/main.rs ++++ b/crates/router/tests/connectors/main.rs +@@ -87,6 +87,7 @@ mod payload; + mod payme; + mod payone; + mod paypal; ++mod paysafe; + mod paystack; + mod paytm; + mod payu; +diff --git a/crates/router/tests/connectors/paysafe.rs b/crates/router/tests/connectors/paysafe.rs +new file mode 100644 +index 00000000..36afbb03 +--- /dev/null ++++ b/crates/router/tests/connectors/paysafe.rs +@@ -0,0 +1,421 @@ ++use hyperswitch_domain_models::payment_method_data::{Card, PaymentMethodData}; ++use masking::Secret; ++use router::types::{self, api, storage::enums}; ++use test_utils::connector_auth; ++ ++use crate::utils::{self, ConnectorActions}; ++ ++#[derive(Clone, Copy)] ++struct PaysafeTest; ++impl ConnectorActions for PaysafeTest {} ++impl utils::Connector for PaysafeTest { ++ fn get_data(&self) -> api::ConnectorData { ++ use router::connector::Paysafe; ++ utils::construct_connector_data_old( ++ Box::new(Paysafe::new()), ++ types::Connector::Plaid, ++ api::GetToken::Connector, ++ None, ++ ) ++ } ++ ++ fn get_auth_token(&self) -> types::ConnectorAuthType { ++ utils::to_connector_auth_type( ++ connector_auth::ConnectorAuthentication::new() ++ .paysafe ++ .expect("Missing connector authentication configuration") ++ .into(), ++ ) ++ } ++ ++ fn get_name(&self) -> String { ++ "paysafe".to_string() ++ } ++} ++ ++static CONNECTOR: PaysafeTest = PaysafeTest {}; ++ ++fn get_default_payment_info() -> Option { ++ None ++} ++ ++fn payment_method_details() -> Option { ++ None ++} ++ ++// Cards Positive Tests ++// Creates a payment using the manual capture flow (Non 3DS). ++#[actix_web::test] ++async fn should_only_authorize_payment() { ++ let response = CONNECTOR ++ .authorize_payment(payment_method_details(), get_default_payment_info()) ++ .await ++ .expect("Authorize payment response"); ++ assert_eq!(response.status, enums::AttemptStatus::Authorized); ++} ++ ++// Captures a payment using the manual capture flow (Non 3DS). ++#[actix_web::test] ++async fn should_capture_authorized_payment() { ++ let response = CONNECTOR ++ .authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info()) ++ .await ++ .expect("Capture payment response"); ++ assert_eq!(response.status, enums::AttemptStatus::Charged); ++} ++ ++// Partially captures a payment using the manual capture flow (Non 3DS). ++#[actix_web::test] ++async fn should_partially_capture_authorized_payment() { ++ let response = CONNECTOR ++ .authorize_and_capture_payment( ++ payment_method_details(), ++ Some(types::PaymentsCaptureData { ++ amount_to_capture: 50, ++ ..utils::PaymentCaptureType::default().0 ++ }), ++ get_default_payment_info(), ++ ) ++ .await ++ .expect("Capture payment response"); ++ assert_eq!(response.status, enums::AttemptStatus::Charged); ++} ++ ++// Synchronizes a payment using the manual capture flow (Non 3DS). ++#[actix_web::test] ++async fn should_sync_authorized_payment() { ++ let authorize_response = CONNECTOR ++ .authorize_payment(payment_method_details(), get_default_payment_info()) ++ .await ++ .expect("Authorize payment response"); ++ let txn_id = utils::get_connector_transaction_id(authorize_response.response); ++ let response = CONNECTOR ++ .psync_retry_till_status_matches( ++ enums::AttemptStatus::Authorized, ++ Some(types::PaymentsSyncData { ++ connector_transaction_id: types::ResponseId::ConnectorTransactionId( ++ txn_id.unwrap(), ++ ), ++ ..Default::default() ++ }), ++ get_default_payment_info(), ++ ) ++ .await ++ .expect("PSync response"); ++ assert_eq!(response.status, enums::AttemptStatus::Authorized,); ++} ++ ++// Voids a payment using the manual capture flow (Non 3DS). ++#[actix_web::test] ++async fn should_void_authorized_payment() { ++ let response = CONNECTOR ++ .authorize_and_void_payment( ++ payment_method_details(), ++ Some(types::PaymentsCancelData { ++ connector_transaction_id: String::from(""), ++ cancellation_reason: Some("requested_by_customer".to_string()), ++ ..Default::default() ++ }), ++ get_default_payment_info(), ++ ) ++ .await ++ .expect("Void payment response"); ++ assert_eq!(response.status, enums::AttemptStatus::Voided); ++} ++ ++// Refunds a payment using the manual capture flow (Non 3DS). ++#[actix_web::test] ++async fn should_refund_manually_captured_payment() { ++ let response = CONNECTOR ++ .capture_payment_and_refund( ++ payment_method_details(), ++ None, ++ None, ++ get_default_payment_info(), ++ ) ++ .await ++ .unwrap(); ++ assert_eq!( ++ response.response.unwrap().refund_status, ++ enums::RefundStatus::Success, ++ ); ++} ++ ++// Partially refunds a payment using the manual capture flow (Non 3DS). ++#[actix_web::test] ++async fn should_partially_refund_manually_captured_payment() { ++ let response = CONNECTOR ++ .capture_payment_and_refund( ++ payment_method_details(), ++ None, ++ Some(types::RefundsData { ++ refund_amount: 50, ++ ..utils::PaymentRefundType::default().0 ++ }), ++ get_default_payment_info(), ++ ) ++ .await ++ .unwrap(); ++ assert_eq!( ++ response.response.unwrap().refund_status, ++ enums::RefundStatus::Success, ++ ); ++} ++ ++// Synchronizes a refund using the manual capture flow (Non 3DS). ++#[actix_web::test] ++async fn should_sync_manually_captured_refund() { ++ let refund_response = CONNECTOR ++ .capture_payment_and_refund( ++ payment_method_details(), ++ None, ++ None, ++ get_default_payment_info(), ++ ) ++ .await ++ .unwrap(); ++ let response = CONNECTOR ++ .rsync_retry_till_status_matches( ++ enums::RefundStatus::Success, ++ refund_response.response.unwrap().connector_refund_id, ++ None, ++ get_default_payment_info(), ++ ) ++ .await ++ .unwrap(); ++ assert_eq!( ++ response.response.unwrap().refund_status, ++ enums::RefundStatus::Success, ++ ); ++} ++ ++// Creates a payment using the automatic capture flow (Non 3DS). ++#[actix_web::test] ++async fn should_make_payment() { ++ let authorize_response = CONNECTOR ++ .make_payment(payment_method_details(), get_default_payment_info()) ++ .await ++ .unwrap(); ++ assert_eq!(authorize_response.status, enums::AttemptStatus::Charged); ++} ++ ++// Synchronizes a payment using the automatic capture flow (Non 3DS). ++#[actix_web::test] ++async fn should_sync_auto_captured_payment() { ++ let authorize_response = CONNECTOR ++ .make_payment(payment_method_details(), get_default_payment_info()) ++ .await ++ .unwrap(); ++ assert_eq!(authorize_response.status, enums::AttemptStatus::Charged); ++ let txn_id = utils::get_connector_transaction_id(authorize_response.response); ++ assert_ne!(txn_id, None, "Empty connector transaction id"); ++ let response = CONNECTOR ++ .psync_retry_till_status_matches( ++ enums::AttemptStatus::Charged, ++ Some(types::PaymentsSyncData { ++ connector_transaction_id: types::ResponseId::ConnectorTransactionId( ++ txn_id.unwrap(), ++ ), ++ capture_method: Some(enums::CaptureMethod::Automatic), ++ ..Default::default() ++ }), ++ get_default_payment_info(), ++ ) ++ .await ++ .unwrap(); ++ assert_eq!(response.status, enums::AttemptStatus::Charged,); ++} ++ ++// Refunds a payment using the automatic capture flow (Non 3DS). ++#[actix_web::test] ++async fn should_refund_auto_captured_payment() { ++ let response = CONNECTOR ++ .make_payment_and_refund(payment_method_details(), None, get_default_payment_info()) ++ .await ++ .unwrap(); ++ assert_eq!( ++ response.response.unwrap().refund_status, ++ enums::RefundStatus::Success, ++ ); ++} ++ ++// Partially refunds a payment using the automatic capture flow (Non 3DS). ++#[actix_web::test] ++async fn should_partially_refund_succeeded_payment() { ++ let refund_response = CONNECTOR ++ .make_payment_and_refund( ++ payment_method_details(), ++ Some(types::RefundsData { ++ refund_amount: 50, ++ ..utils::PaymentRefundType::default().0 ++ }), ++ get_default_payment_info(), ++ ) ++ .await ++ .unwrap(); ++ assert_eq!( ++ refund_response.response.unwrap().refund_status, ++ enums::RefundStatus::Success, ++ ); ++} ++ ++// Creates multiple refunds against a payment using the automatic capture flow (Non 3DS). ++#[actix_web::test] ++async fn should_refund_succeeded_payment_multiple_times() { ++ CONNECTOR ++ .make_payment_and_multiple_refund( ++ payment_method_details(), ++ Some(types::RefundsData { ++ refund_amount: 50, ++ ..utils::PaymentRefundType::default().0 ++ }), ++ get_default_payment_info(), ++ ) ++ .await; ++} ++ ++// Synchronizes a refund using the automatic capture flow (Non 3DS). ++#[actix_web::test] ++async fn should_sync_refund() { ++ let refund_response = CONNECTOR ++ .make_payment_and_refund(payment_method_details(), None, get_default_payment_info()) ++ .await ++ .unwrap(); ++ let response = CONNECTOR ++ .rsync_retry_till_status_matches( ++ enums::RefundStatus::Success, ++ refund_response.response.unwrap().connector_refund_id, ++ None, ++ get_default_payment_info(), ++ ) ++ .await ++ .unwrap(); ++ assert_eq!( ++ response.response.unwrap().refund_status, ++ enums::RefundStatus::Success, ++ ); ++} ++ ++// Cards Negative scenarios ++// Creates a payment with incorrect CVC. ++#[actix_web::test] ++async fn should_fail_payment_for_incorrect_cvc() { ++ let response = CONNECTOR ++ .make_payment( ++ Some(types::PaymentsAuthorizeData { ++ payment_method_data: PaymentMethodData::Card(Card { ++ card_cvc: Secret::new("12345".to_string()), ++ ..utils::CCardType::default().0 ++ }), ++ ..utils::PaymentAuthorizeType::default().0 ++ }), ++ get_default_payment_info(), ++ ) ++ .await ++ .unwrap(); ++ assert_eq!( ++ response.response.unwrap_err().message, ++ "Your card's security code is invalid.".to_string(), ++ ); ++} ++ ++// Creates a payment with incorrect expiry month. ++#[actix_web::test] ++async fn should_fail_payment_for_invalid_exp_month() { ++ let response = CONNECTOR ++ .make_payment( ++ Some(types::PaymentsAuthorizeData { ++ payment_method_data: PaymentMethodData::Card(Card { ++ card_exp_month: Secret::new("20".to_string()), ++ ..utils::CCardType::default().0 ++ }), ++ ..utils::PaymentAuthorizeType::default().0 ++ }), ++ get_default_payment_info(), ++ ) ++ .await ++ .unwrap(); ++ assert_eq!( ++ response.response.unwrap_err().message, ++ "Your card's expiration month is invalid.".to_string(), ++ ); ++} ++ ++// Creates a payment with incorrect expiry year. ++#[actix_web::test] ++async fn should_fail_payment_for_incorrect_expiry_year() { ++ let response = CONNECTOR ++ .make_payment( ++ Some(types::PaymentsAuthorizeData { ++ payment_method_data: PaymentMethodData::Card(Card { ++ card_exp_year: Secret::new("2000".to_string()), ++ ..utils::CCardType::default().0 ++ }), ++ ..utils::PaymentAuthorizeType::default().0 ++ }), ++ get_default_payment_info(), ++ ) ++ .await ++ .unwrap(); ++ assert_eq!( ++ response.response.unwrap_err().message, ++ "Your card's expiration year is invalid.".to_string(), ++ ); ++} ++ ++// Voids a payment using automatic capture flow (Non 3DS). ++#[actix_web::test] ++async fn should_fail_void_payment_for_auto_capture() { ++ let authorize_response = CONNECTOR ++ .make_payment(payment_method_details(), get_default_payment_info()) ++ .await ++ .unwrap(); ++ assert_eq!(authorize_response.status, enums::AttemptStatus::Charged); ++ let txn_id = utils::get_connector_transaction_id(authorize_response.response); ++ assert_ne!(txn_id, None, "Empty connector transaction id"); ++ let void_response = CONNECTOR ++ .void_payment(txn_id.unwrap(), None, get_default_payment_info()) ++ .await ++ .unwrap(); ++ assert_eq!( ++ void_response.response.unwrap_err().message, ++ "You cannot cancel this PaymentIntent because it has a status of succeeded." ++ ); ++} ++ ++// Captures a payment using invalid connector payment id. ++#[actix_web::test] ++async fn should_fail_capture_for_invalid_payment() { ++ let capture_response = CONNECTOR ++ .capture_payment("123456789".to_string(), None, get_default_payment_info()) ++ .await ++ .unwrap(); ++ assert_eq!( ++ capture_response.response.unwrap_err().message, ++ String::from("No such payment_intent: '123456789'") ++ ); ++} ++ ++// Refunds a payment with refund amount higher than payment amount. ++#[actix_web::test] ++async fn should_fail_for_refund_amount_higher_than_payment_amount() { ++ let response = CONNECTOR ++ .make_payment_and_refund( ++ payment_method_details(), ++ Some(types::RefundsData { ++ refund_amount: 150, ++ ..utils::PaymentRefundType::default().0 ++ }), ++ get_default_payment_info(), ++ ) ++ .await ++ .unwrap(); ++ assert_eq!( ++ response.response.unwrap_err().message, ++ "Refund amount (₹1.50) is greater than charge amount (₹1.00)", ++ ); ++} ++ ++// Connector dependent test cases goes here ++ ++// [#478]: add unit tests for non 3DS, wallets & webhooks in connector tests +diff --git a/crates/test_utils/src/connector_auth.rs b/crates/test_utils/src/connector_auth.rs +index 49cb0717..720bdb32 100644 +--- a/crates/test_utils/src/connector_auth.rs ++++ b/crates/test_utils/src/connector_auth.rs +@@ -94,6 +94,7 @@ pub struct ConnectorAuthentication { + pub payme: Option, + pub payone: Option, + pub paypal: Option, ++ pub paysafe: Option, + pub paystack: Option, + pub paytm: Option, + pub payu: Option, +diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml +index 9c0a2efd..374119be 100644 +--- a/loadtest/config/development.toml ++++ b/loadtest/config/development.toml +@@ -169,6 +169,7 @@ payload.base_url = "https://api.payload.com" + payme.base_url = "https://sandbox.payme.io/" + payone.base_url = "https://payment.preprod.payone.com/" + paypal.base_url = "https://api-m.sandbox.paypal.com/" ++paysafe.base_url = "https://api.test.paysafe.com/paymenthub/" + paystack.base_url = "https://api.paystack.co" + paytm.base_url = "https://securegw-stage.paytm.in/" + payu.base_url = "https://secure.snd.payu.com/" +diff --git a/scripts/add_connector.sh b/scripts/add_connector.sh +index b826b238..6f041b8f 100755 +--- a/scripts/add_connector.sh ++++ b/scripts/add_connector.sh +@@ -6,7 +6,7 @@ function find_prev_connector() { + git checkout $self + cp $self $self.tmp + # Add new connector to existing list and sort it +- connectors=(aci adyen adyenplatform affirm airwallex amazonpay applepay archipel authipay authorizedotnet bambora bamboraapac bankofamerica barclaycard billwerk bitpay blackhawknetwork bluecode bluesnap boku braintree breadpay cashtocode celero chargebee checkbook checkout coinbase cryptopay ctp_visa custombilling cybersource datatrans deutschebank digitalvirgo dlocal dummyconnector dwolla ebanx elavon facilitapay fiserv fiservemea fiuu flexiti forte getnet globalpay globepay gocardless gpayments helcim hipay hyperswitch_vault hyperwallet hyperwallet iatapay inespay itaubank jpmorgan juspaythreedsserver katapult klarna mifinity mollie moneris mpgs multisafepay netcetera nexinets nexixpay nomupay noon nordea novalnet nuvei opayo opennode paybox payeezy payload payme payone paypal paystack paytm payu phonepe placetopay plaid powertranz prophetpay rapyd razorpay recurly redsys santander shift4 sift silverflow square stax stripe stripebilling taxjar threedsecureio thunes tokenio trustpay trustpayments tsys unified_authentication_service vgs volt wellsfargo wellsfargopayout wise worldline worldpay worldpayvantiv worldpayxml xendit zsl "$1") ++ connectors=(aci adyen adyenplatform affirm airwallex amazonpay applepay archipel authipay authorizedotnet bambora bamboraapac bankofamerica barclaycard billwerk bitpay blackhawknetwork bluecode bluesnap boku braintree breadpay cashtocode celero chargebee checkbook checkout coinbase cryptopay ctp_visa custombilling cybersource datatrans deutschebank digitalvirgo dlocal dummyconnector dwolla ebanx elavon facilitapay fiserv fiservemea fiuu flexiti forte getnet globalpay globepay gocardless gpayments helcim hipay hyperswitch_vault hyperwallet hyperwallet iatapay inespay itaubank jpmorgan juspaythreedsserver katapult klarna mifinity mollie moneris mpgs multisafepay netcetera nexinets nexixpay nomupay noon nordea novalnet nuvei opayo opennode paybox payeezy payload payme payone paypal paysafe paystack paytm payu phonepe placetopay plaid powertranz prophetpay rapyd razorpay recurly redsys santander shift4 sift silverflow square stax stripe stripebilling taxjar threedsecureio thunes tokenio trustpay trustpayments tsys unified_authentication_service vgs volt wellsfargo wellsfargopayout wise worldline worldpay worldpayvantiv worldpayxml xendit zsl "$1") + + + IFS=$'\n' sorted=($(sort <<<"${connectors[*]}")); unset IFS + +----- END CHUNK ----- \ No newline at end of file diff --git a/raw/cf/cf64d2a9dcef422e7d080e21a7e8644694337a51.txt b/raw/cf/cf64d2a9dcef422e7d080e21a7e8644694337a51.txt new file mode 100644 index 0000000000000000000000000000000000000000..d6bb87569ee3d253987f53406368bcf411ad3ce0 --- /dev/null +++ b/raw/cf/cf64d2a9dcef422e7d080e21a7e8644694337a51.txt @@ -0,0 +1,994 @@ +ROUTE: juspay/hyperswitch@cf64d2a9dcef422e7d080e21a7e8644694337a51 +REPO: https://github.com/juspay/hyperswitch +COMMIT: cf64d2a9dcef422e7d080e21a7e8644694337a51 +AUTHOR: Debarshi Gupta +DATE: 2025-08-27T15:37:24 + +=== ISSUE_AND_PR === +[PR #9044] feat(core): Added support for unified_connector_service CardNumber and Secret Type +URL: https://github.com/juspay/hyperswitch/pull/9044 +BODY: +## Type of Change + + +- [ ] Bugfix +- [ ] New feature +- [x] Enhancement +- [ ] Refactoring +- [ ] Dependency updates +- [ ] Documentation +- [ ] CI/CD + +## Description + + +Added SecretString type definition in UCS proto files which will get swapped out with hyperswitch_masking::Secret type during build. This will allow us to mask any sensitive data like card_cvc, card _exp_month etc. + +In this PR, all proto request types for which masked types were added, have been handled. + + +### Additional Changes + +- [ ] This PR modifies the API contract +- [ ] This PR modifies the database schema +- [ ] This PR modifies application configuration/environment variables + + + + +## Motivation and Context + + +Added SecretString type definition in UCS proto files which will get swapped out with hyperswitch_masking::Secret type during build. This will allow us to mask any sensitive data like card_cvc, card _exp_month etc. + +In this PR, all proto request types for which masked types were added, have been handled. + + +## How did you test it? + + +**Postman Tests** + +-Request + +``` +curl --location 'http://localhost:8080/payments' \ +--header 'Content-Type: application/json' \ +--header 'Accept: application/json' \ +--header 'api-key: dev_zYV0Xu6QYgNJZuZOeDHIjfk3DluWR00euuAzMdaMqRxP49SewUCvTsDxUF7Pti1g' \ +--data-raw '{ + "amount": 6540, + "currency": "USD", + "confirm": true, + "capture_method": "automatic", + "capture_on": "2022-09-10T10:11:12Z", + "amount_to_capture": 6540, + "customer_id": "StripeCustomer", + "email": "guest@example.com", + "name": "John Doe", + "phone": "999999999", + "phone_country_code": "+65", + "description": "Its my first payment request", + "authentication_type": "no_three_ds", + "return_url": "https://duck.com", + "payment_method": "card", + "payment_method_type": "credit", + "payment_method_data": { + "card": { + "card_number": "4111111111111111", + "card_exp_month": "03", + "card_exp_year": "2030", + "card_holder_name": "joseph Doe", + "card_cvc": "737", + "card_network": "Visa" + } + }, + "billing": { + "address": { + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "city": "San Fransico", + "state": "California", + "zip": "94122", + "country": "US", + "first_name": "PiX" + } + }, + "shipping": { + "address": { + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "city": "San Fransico", + "state": "California", + "zip": "94122", + "country": "US", + "first_name": "PiX" + } + }, + "statement_descriptor_name": "joseph", + "statement_descriptor_suffix": "JS", + "metadata": { + "udf1": "value1", + "new_customer": "true", + "login_date": "2019-09-10T10:11:12Z" + }, + "browser_info": { + "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36", + "accept_header": "text\\/html,application\\/xhtml+xml,application\\/xml;q=0.9,image\\/webp,image\\/apng,*\\/*;q=0.8", + "language": "en-GB", + "color_depth": 30, + "screen_height": 1117, + "screen_width": 1728, + "time_zone": -330, + "java_enabled": true, + "java_script_enabled": true + } +}' +``` + +-Response + +``` +{ + "payment_id": "pay_ti0kJ7n39hCU1Za6BA1Q", + "merchant_id": "postman_merchant_GHAction_f7d1326e-6685-4d0a-9e2b-cfa156f58d72", + "status": "succeeded", + "amount": 6540, + "net_amount": 6540, + "shipping_cost": null, + "amount_capturable": 0, + "amount_received": 6540, + "connector": "adyen", + "client_secret": "pay_ti0kJ7n39hCU1Za6BA1Q_secret_0u8uwkwWbCZoBzgbc1Gi", + "created": "2025-08-25T16:56:36.422Z", + "currency": "USD", + "customer_id": "StripeCustomer", + "customer": { + "id": "StripeCustomer", + "name": "John Doe", + "email": "guest@example.com", + "phone": "999999999", + "phone_country_code": "+65" + }, + "description": "Its my first payment request", + "refunds": null, + "disputes": null, + "mandate_id": null, + "mandate_data": null, + "setup_future_usage": null, + "off_session": null, + "capture_on": null, + "capture_method": "automatic", + "payment_method": "card", + "payment_method_data": { + "card": { + "last4": "1111", + "card_type": null, + "card_network": null, + "card_issuer": null, + "card_issuing_country": null, + "card_isin": "411111", + "card_extended_bin": null, + "card_exp_month": "03", + "card_exp_year": "2030", + "card_holder_name": "joseph Doe", + "payment_checks": null, + "authentication_data": null + }, + "billing": null + }, + "payment_token": null, + "shipping": { + "address": { + "city": "San Fransico", + "country": "US", + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "zip": "94122", + "state": "California", + "first_name": "PiX", + "last_name": null, + "origin_zip": null + }, + "phone": null, + "email": null + }, + "billing": { + "address": { + "city": "San Fransico", + "country": "US", + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "zip": "94122", + "state": "California", + "first_name": "PiX", + "last_name": null, + "origin_zip": null + }, + "phone": null, + "email": null + }, + "order_details": null, + "email": "guest@example.com", + "name": "John Doe", + "phone": "999999999", + "return_url": "https://duck.com/", + "authentication_type": "no_three_ds", + "statement_descriptor_name": "joseph", + "statement_descriptor_suffix": "JS", + "next_action": null, + "cancellation_reason": null, + "error_code": null, + "error_message": null, + "unified_code": null, + "unified_message": null, + "payment_experience": null, + "payment_method_type": "credit", + "connector_label": null, + "business_country": null, + "business_label": "default", + "business_sub_label": null, + "allowed_payment_method_types": null, + "ephemeral_key": { + "customer_id": "StripeCustomer", + "created_at": 1756140996, + "expires": 1756144596, + "secret": "epk_771b7c9d4b7d496bbbe978d3d0a9cf3c" + }, + "manual_retry_allowed": false, + "connector_transaction_id": "GC7LHGQ4H4H89PV5", + "frm_message": null, + "metadata": { + "udf1": "value1", + "login_date": "2019-09-10T10:11:12Z", + "new_customer": "true" + }, + "connector_metadata": null, + "feature_metadata": { + "redirect_response": null, + "search_tags": null, + "apple_pay_recurring_details": null, + "gateway_system": "unified_connector_service" + }, + "reference_id": "pay_ti0kJ7n39hCU1Za6BA1Q_1", + "payment_link": null, + "profile_id": "pro_dofrMH9OfAlOx7z74Tqu", + "surcharge_details": null, + "attempt_count": 1, + "merchant_decision": null, + "merchant_connector_id": "mca_gGrBd8TAXH5LZWccr8Fm", + "incremental_authorization_allowed": false, + "authorization_count": null, + "incremental_authorizations": null, + "external_authentication_details": null, + "external_3ds_authentication_attempted": false, + "expires_on": "2025-08-25T17:11:36.422Z", + "fingerprint": null, + "browser_info": { + "language": "en-GB", + "time_zone": -330, + "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36", + "color_depth": 30, + "java_enabled": true, + "screen_width": 1728, + "accept_header": "text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,*\/*;q=0.8", + "screen_height": 1117, + "java_script_enabled": true + }, + "payment_channel": null, + "payment_method_id": null, + "network_transaction_id": null, + "payment_method_status": null, + "updated": "2025-08-25T16:56:37.362Z", + "split_payments": null, + "frm_metadata": null, + "extended_authorization_applied": null, + "capture_before": null, + "merchant_order_reference_id": null, + "order_tax_amount": null, + "connector_mandate_id": null, + "card_discovery": "manual", + "force_3ds_challenge": false, + "force_3ds_challenge_trigger": false, + "issuer_error_code": null, + "issuer_error_message": null, + "is_iframe_redirection_enabled": null, + "enable_partial_authorization": null +} +``` + + +## Checklist + + +- [x] I formatted the code `cargo +nightly fmt --all` +- [x] I addressed lints thrown by `cargo clippy` +- [x] I reviewed the submitted code +- [ ] I added unit tests for my changes where possible +COMMENTS: +- semanticdiff-com[bot]: Review changes with  SemanticDiff +
+Changed Files +
+ +| File | Status | +| :--- | :--- | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9044/changes#crates/router/src/core/unified_connector_service.rs)  [crates/router/src/core/unified\_connector\_service\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9044/changes#crates/router/src/core/unified_connector_service.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9044/changes#crates/router/src/core/unified_connector_service.rs)  69% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9044/changes#crates/router/src/core/unified_connector_service/transformers.rs)  [crates/router/src/core/unified\_connector\_service/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9044/changes#crates/router/src/core/unified_connector_service/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9044/changes#crates/router/src/core/unified_connector_service/transformers.rs)  56% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9044/changes#Cargo.lock)  [Cargo\.lock](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9044/changes#Cargo.lock) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9044/changes#crates/external_services/Cargo.toml)  [crates/external\_services/Cargo\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9044/changes#crates/external_services/Cargo.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9044/changes#crates/router/Cargo.toml)  [crates/router/Cargo\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/9044/changes#crates/router/Cargo.toml) | Unsupported file format | + +
+- sai-harsha-vardhan [crates/router/src/core/unified_connector_service.rs:289]: Why are we doing `.expose().into()` here? + +=== COMMIT === +SUBJECT: feat(core): Added support for unified_connector_service CardNumber and Secret Type (#9044) +BODY: +Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> + +=== FILES === +Summary: 5 files changed, +186 -91 +- Cargo.lock (+108 -24) +- crates/external_services/Cargo.toml (+1 -1) +- crates/router/Cargo.toml (+2 -1) +- crates/router/src/core/unified_connector_service.rs (+23 -15) +- crates/router/src/core/unified_connector_service/transformers.rs (+52 -50) + +=== PATCH === +diff --git a/Cargo.lock b/Cargo.lock +index 0855392d..9dbbad05 100644 +--- a/Cargo.lock ++++ b/Cargo.lock +@@ -357,7 +357,7 @@ dependencies = [ + "error-stack 0.4.1", + "futures 0.3.31", + "hyperswitch_interfaces", +- "masking", ++ "masking 0.1.0", + "opensearch", + "reqwest 0.11.27", + "router_env", +@@ -462,7 +462,7 @@ dependencies = [ + "deserialize_form_style_query_parameter", + "error-stack 0.4.1", + "euclid", +- "masking", ++ "masking 0.1.0", + "mime", + "nutype", + "reqwest 0.11.27", +@@ -1620,7 +1620,7 @@ version = "0.1.0" + dependencies = [ + "common_utils", + "error-stack 0.4.1", +- "masking", ++ "masking 0.1.0", + "regex", + "router_env", + "serde", +@@ -1846,7 +1846,7 @@ name = "common_enums" + version = "0.1.0" + dependencies = [ + "diesel", +- "masking", ++ "masking 0.1.0", + "router_derive", + "serde", + "serde_json", +@@ -1865,7 +1865,7 @@ dependencies = [ + "diesel", + "error-stack 0.4.1", + "euclid", +- "masking", ++ "masking 0.1.0", + "serde", + "serde_json", + "time", +@@ -1889,7 +1889,7 @@ dependencies = [ + "globset", + "hex", + "http 0.2.12", +- "masking", ++ "masking 0.1.0", + "md5", + "nanoid", + "nutype", +@@ -2633,7 +2633,7 @@ dependencies = [ + "common_utils", + "diesel", + "error-stack 0.4.1", +- "masking", ++ "masking 0.1.0", + "router_derive", + "router_env", + "serde", +@@ -2721,7 +2721,7 @@ dependencies = [ + "error-stack 0.4.1", + "external_services", + "hyperswitch_interfaces", +- "masking", ++ "masking 0.1.0", + "mime", + "redis_interface", + "reqwest 0.11.27", +@@ -3020,7 +3020,7 @@ name = "events" + version = "0.1.0" + dependencies = [ + "error-stack 0.4.1", +- "masking", ++ "masking 0.1.0", + "router_env", + "serde", + "serde_json", +@@ -3053,7 +3053,7 @@ dependencies = [ + "hyper-util", + "hyperswitch_interfaces", + "lettre", +- "masking", ++ "masking 0.1.0", + "once_cell", + "prost", + "prost-types", +@@ -3377,8 +3377,9 @@ dependencies = [ + + [[package]] + name = "g2h" +-version = "0.4.0" +-source = "git+https://github.com/NishantJoshi00/g2h?branch=fixing-response-serializing#fd2c856b2c6c88a85d6fe51d95b4d3342b788d31" ++version = "0.5.0" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "d843f7c70cdae8a2452e0b2f463b7e483a57cece7687da89371d952d44e0445d" + dependencies = [ + "cargo_metadata 0.19.2", + "heck 0.5.0", +@@ -3540,19 +3541,21 @@ dependencies = [ + [[package]] + name = "grpc-api-types" + version = "0.1.0" +-source = "git+https://github.com/juspay/connector-service?rev=aae51574fed25b0a7849e3832cff8904bc310cf5#aae51574fed25b0a7849e3832cff8904bc310cf5" ++source = "git+https://github.com/juspay/connector-service?rev=a56de0a4ee393af5c401f02b6b4344cb263f4cac#a56de0a4ee393af5c401f02b6b4344cb263f4cac" + dependencies = [ + "axum 0.8.4", + "error-stack 0.5.0", + "g2h", + "heck 0.5.0", + "http 1.3.1", ++ "masking 0.1.0 (git+https://github.com/juspay/hyperswitch?tag=v1.116.0)", + "prost", + "prost-build", + "prost-types", + "serde", + "tonic 0.13.1", + "tonic-build", ++ "ucs_cards", + ] + + [[package]] +@@ -4046,7 +4049,7 @@ dependencies = [ + "isocountry", + "josekit", + "lazy_static", +- "masking", ++ "masking 0.1.0", + "mime", + "nanoid", + "num-traits", +@@ -4104,7 +4107,7 @@ dependencies = [ + "error-stack 0.4.1", + "futures 0.3.31", + "http 0.2.12", +- "masking", ++ "masking 0.1.0", + "mime", + "router_derive", + "router_env", +@@ -4131,7 +4134,7 @@ dependencies = [ + "error-stack 0.4.1", + "http 0.2.12", + "hyperswitch_domain_models", +- "masking", ++ "masking 0.1.0", + "mime", + "reqwest 0.11.27", + "router_env", +@@ -4392,7 +4395,7 @@ dependencies = [ + "async-trait", + "common_utils", + "error-stack 0.4.1", +- "masking", ++ "masking 0.1.0", + "nom 7.1.3", + "reqwest 0.12.7", + "router_env", +@@ -4603,7 +4606,7 @@ dependencies = [ + "criterion", + "euclid", + "hyperswitch_constraint_graph", +- "masking", ++ "masking 0.1.0", + "serde", + "serde_json", + "strum 0.26.3", +@@ -4843,6 +4846,23 @@ dependencies = [ + "zeroize", + ] + ++[[package]] ++name = "masking" ++version = "0.1.0" ++source = "git+https://github.com/juspay/hyperswitch?tag=v1.116.0#672d749e20bec7800613878e36a0ab3885177326" ++dependencies = [ ++ "bytes 1.10.1", ++ "diesel", ++ "erased-serde 0.4.6", ++ "prost", ++ "serde", ++ "serde_json", ++ "subtle", ++ "time", ++ "url", ++ "zeroize", ++] ++ + [[package]] + name = "matchers" + version = "0.1.0" +@@ -5702,7 +5722,7 @@ dependencies = [ + "error-stack 0.4.1", + "hyperswitch_domain_models", + "hyperswitch_interfaces", +- "masking", ++ "masking 0.1.0", + "rdkafka", + "router_env", + "scheduler", +@@ -5958,7 +5978,7 @@ dependencies = [ + "common_utils", + "error-stack 0.4.1", + "http 0.2.12", +- "masking", ++ "masking 0.1.0", + "mime", + "serde", + "serde_json", +@@ -6810,7 +6830,7 @@ dependencies = [ + "josekit", + "jsonwebtoken", + "kgraph_utils", +- "masking", ++ "masking 0.1.0", + "maud", + "mimalloc", + "mime", +@@ -6855,6 +6875,7 @@ dependencies = [ + "tokio 1.45.1", + "totp-rs", + "tracing-futures", ++ "ucs_cards", + "unicode-segmentation", + "url", + "urlencoding", +@@ -6940,7 +6961,7 @@ dependencies = [ + [[package]] + name = "rust-grpc-client" + version = "0.1.0" +-source = "git+https://github.com/juspay/connector-service?rev=aae51574fed25b0a7849e3832cff8904bc310cf5#aae51574fed25b0a7849e3832cff8904bc310cf5" ++source = "git+https://github.com/juspay/connector-service?rev=a56de0a4ee393af5c401f02b6b4344cb263f4cac#a56de0a4ee393af5c401f02b6b4344cb263f4cac" + dependencies = [ + "grpc-api-types", + ] +@@ -8146,7 +8167,7 @@ dependencies = [ + "error-stack 0.4.1", + "futures 0.3.31", + "hyperswitch_domain_models", +- "masking", ++ "masking 0.1.0", + "moka", + "redis_interface", + "router_derive", +@@ -8442,7 +8463,7 @@ dependencies = [ + "base64 0.22.1", + "clap", + "common_enums", +- "masking", ++ "masking 0.1.0", + "rand 0.8.5", + "regex", + "reqwest 0.11.27", +@@ -9324,6 +9345,69 @@ version = "0.1.6" + source = "registry+https://github.com/rust-lang/crates.io-index" + checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" + ++[[package]] ++name = "ucs_cards" ++version = "0.1.0" ++source = "git+https://github.com/juspay/connector-service?rev=a56de0a4ee393af5c401f02b6b4344cb263f4cac#a56de0a4ee393af5c401f02b6b4344cb263f4cac" ++dependencies = [ ++ "bytes 1.10.1", ++ "error-stack 0.4.1", ++ "masking 0.1.0 (git+https://github.com/juspay/hyperswitch?tag=v1.116.0)", ++ "prost", ++ "regex", ++ "serde", ++ "thiserror 1.0.69", ++ "time", ++ "ucs_common_utils", ++] ++ ++[[package]] ++name = "ucs_common_enums" ++version = "0.1.0" ++source = "git+https://github.com/juspay/connector-service?rev=a56de0a4ee393af5c401f02b6b4344cb263f4cac#a56de0a4ee393af5c401f02b6b4344cb263f4cac" ++dependencies = [ ++ "serde", ++ "strum 0.26.3", ++ "thiserror 1.0.69", ++ "utoipa", ++] ++ ++[[package]] ++name = "ucs_common_utils" ++version = "0.1.0" ++source = "git+https://github.com/juspay/connector-service?rev=a56de0a4ee393af5c401f02b6b4344cb263f4cac#a56de0a4ee393af5c401f02b6b4344cb263f4cac" ++dependencies = [ ++ "anyhow", ++ "blake3", ++ "bytes 1.10.1", ++ "chrono", ++ "error-stack 0.4.1", ++ "hex", ++ "http 1.3.1", ++ "masking 0.1.0 (git+https://github.com/juspay/hyperswitch?tag=v1.116.0)", ++ "md5", ++ "nanoid", ++ "once_cell", ++ "quick-xml", ++ "rand 0.8.5", ++ "regex", ++ "reqwest 0.11.27", ++ "ring 0.17.14", ++ "rust_decimal", ++ "semver 1.0.26", ++ "serde", ++ "serde_json", ++ "serde_urlencoded", ++ "strum 0.26.3", ++ "thiserror 1.0.69", ++ "time", ++ "tracing", ++ "ucs_common_enums", ++ "url", ++ "utoipa", ++ "uuid", ++] ++ + [[package]] + name = "unarray" + version = "0.1.4" +diff --git a/crates/external_services/Cargo.toml b/crates/external_services/Cargo.toml +index 7aa5ccfb..39cd26b2 100644 +--- a/crates/external_services/Cargo.toml ++++ b/crates/external_services/Cargo.toml +@@ -66,7 +66,7 @@ reqwest = { version = "0.11.27", features = ["rustls-tls"] } + http = "0.2.12" + url = { version = "2.5.4", features = ["serde"] } + quick-xml = { version = "0.31.0", features = ["serialize"] } +-unified-connector-service-client = { git = "https://github.com/juspay/connector-service", rev = "aae51574fed25b0a7849e3832cff8904bc310cf5", package = "rust-grpc-client" } ++unified-connector-service-client = { git = "https://github.com/juspay/connector-service", rev = "a56de0a4ee393af5c401f02b6b4344cb263f4cac", package = "rust-grpc-client" } + + + # First party crates +diff --git a/crates/router/Cargo.toml b/crates/router/Cargo.toml +index db0486bb..8d3a139c 100644 +--- a/crates/router/Cargo.toml ++++ b/crates/router/Cargo.toml +@@ -89,7 +89,8 @@ reqwest = { version = "0.11.27", features = ["json", "rustls-tls", "gzip", "mult + ring = "0.17.14" + rust_decimal = { version = "1.37.1", features = ["serde-with-float", "serde-with-str"] } + rust-i18n = { git = "https://github.com/kashif-m/rust-i18n", rev = "f2d8096aaaff7a87a847c35a5394c269f75e077a" } +-unified-connector-service-client = { git = "https://github.com/juspay/connector-service", rev = "aae51574fed25b0a7849e3832cff8904bc310cf5", package = "rust-grpc-client" } ++unified-connector-service-client = { git = "https://github.com/juspay/connector-service", rev = "a56de0a4ee393af5c401f02b6b4344cb263f4cac", package = "rust-grpc-client" } ++unified-connector-service-cards = { git = "https://github.com/juspay/connector-service", rev = "a56de0a4ee393af5c401f02b6b4344cb263f4cac", package = "ucs_cards" } + rustc-hash = "1.1.0" + rustls = "0.22" + rustls-pemfile = "2" +diff --git a/crates/router/src/core/unified_connector_service.rs b/crates/router/src/core/unified_connector_service.rs +index 82bf058b..f35b90a7 100644 +--- a/crates/router/src/core/unified_connector_service.rs ++++ b/crates/router/src/core/unified_connector_service.rs +@@ -18,6 +18,7 @@ use hyperswitch_domain_models::{ + }; + use masking::{ExposeInterface, PeekInterface, Secret}; + use router_env::logger; ++use unified_connector_service_cards::CardNumber; + use unified_connector_service_client::payments::{ + self as payments_grpc, payment_method::PaymentMethod, CardDetails, CardPaymentMethodType, + PaymentServiceAuthorizeResponse, RewardPaymentMethodType, +@@ -277,11 +278,17 @@ pub fn build_unified_connector_service_payment_method( + .transpose()?; + + let card_details = CardDetails { +- card_number: card.card_number.get_card_no(), +- card_exp_month, +- card_exp_year: card.get_expiry_year_4_digit().peek().to_string(), +- card_cvc: card.card_cvc.peek().to_string(), +- card_holder_name: card.card_holder_name.map(|name| name.expose()), ++ card_number: Some( ++ CardNumber::from_str(&card.card_number.get_card_no()).change_context( ++ UnifiedConnectorServiceError::RequestEncodingFailedWithReason( ++ "Failed to parse card number".to_string(), ++ ), ++ )?, ++ ), ++ card_exp_month: Some(card_exp_month.into()), ++ card_exp_year: Some(card.get_expiry_year_4_digit().expose().into()), ++ card_cvc: Some(card.card_cvc.expose().into()), ++ card_holder_name: card.card_holder_name.map(|name| name.expose().into()), + card_issuer: card.card_issuer.clone(), + card_network: card_network.map(|card_network| card_network.into()), + card_type: card.card_type.clone(), +@@ -316,12 +323,13 @@ pub fn build_unified_connector_service_payment_method( + hyperswitch_domain_models::payment_method_data::UpiData::UpiCollect( + upi_collect_data, + ) => { +- let vpa_id = upi_collect_data.vpa_id.map(|vpa| vpa.expose()); +- let upi_details = payments_grpc::UpiCollect { vpa_id }; ++ let upi_details = payments_grpc::UpiCollect { ++ vpa_id: upi_collect_data.vpa_id.map(|vpa| vpa.expose().into()), ++ }; + PaymentMethod::UpiCollect(upi_details) + } + hyperswitch_domain_models::payment_method_data::UpiData::UpiIntent(_) => { +- let upi_details = payments_grpc::UpiIntent {}; ++ let upi_details = payments_grpc::UpiIntent { app_name: None }; + PaymentMethod::UpiIntent(upi_details) + } + }; +@@ -369,13 +377,13 @@ pub fn build_unified_connector_service_payment_method_for_external_proxy( + .map(payments_grpc::CardNetwork::foreign_try_from) + .transpose()?; + let card_details = CardDetails { +- card_number: external_vault_card.card_number.peek().to_string(), +- card_exp_month: external_vault_card.card_exp_month.peek().to_string(), +- card_exp_year: external_vault_card.card_exp_year.peek().to_string(), +- card_cvc: external_vault_card.card_cvc.peek().to_string(), +- card_holder_name: external_vault_card +- .card_holder_name +- .map(|name| name.expose()), ++ card_number: Some(CardNumber::from_str(external_vault_card.card_number.peek()).change_context( ++ UnifiedConnectorServiceError::RequestEncodingFailedWithReason("Failed to parse card number".to_string()) ++ )?), ++ card_exp_month: Some(external_vault_card.card_exp_month.expose().into()), ++ card_exp_year: Some(external_vault_card.card_exp_year.expose().into()), ++ card_cvc: Some(external_vault_card.card_cvc.expose().into()), ++ card_holder_name: external_vault_card.card_holder_name.map(|name| name.expose().into()), + card_issuer: external_vault_card.card_issuer.clone(), + card_network: card_network.map(|card_network| card_network.into()), + card_type: external_vault_card.card_type.clone(), +diff --git a/crates/router/src/core/unified_connector_service/transformers.rs b/crates/router/src/core/unified_connector_service/transformers.rs +index 9162b9e1..40422e82 100644 +--- a/crates/router/src/core/unified_connector_service/transformers.rs ++++ b/crates/router/src/core/unified_connector_service/transformers.rs +@@ -141,7 +141,7 @@ impl ForeignTryFrom<&RouterData>() + }) + .unwrap_or_default(), ++ test_mode: None, + }) + } + } +@@ -264,7 +265,7 @@ impl + .request + .email + .clone() +- .map(|e| e.expose().expose()), ++ .map(|e| e.expose().expose().into()), + browser_info, + access_token: None, + session_token: None, +@@ -316,6 +317,7 @@ impl + .collect::>() + }) + .unwrap_or_default(), ++ test_mode: None, + }) + } + } +@@ -372,7 +374,7 @@ impl ForeignTryFrom<&RouterData + let shipping = payment_address.get_shipping().map(|address| { + let details = address.address.as_ref(); + +- let get_str = +- |opt: &Option>| opt.as_ref().map(|s| s.peek().to_owned()); +- +- let get_plain = |opt: &Option| opt.clone(); +- + let country = details.and_then(|details| { + details + .country +@@ -875,20 +874,23 @@ impl ForeignTryFrom + }); + + payments_grpc::Address { +- first_name: get_str(&details.and_then(|d| d.first_name.clone())), +- last_name: get_str(&details.and_then(|d| d.last_name.clone())), +- line1: get_str(&details.and_then(|d| d.line1.clone())), +- line2: get_str(&details.and_then(|d| d.line2.clone())), +- line3: get_str(&details.and_then(|d| d.line3.clone())), +- city: get_plain(&details.and_then(|d| d.city.clone())), +- state: get_str(&details.and_then(|d| d.state.clone())), +- zip_code: get_str(&details.and_then(|d| d.zip.clone())), ++ first_name: details.and_then(|d| d.first_name.as_ref().map(|s| s.clone().expose())), ++ last_name: details.and_then(|d| d.last_name.as_ref().map(|s| s.clone().expose())), ++ line1: details.and_then(|d| d.line1.as_ref().map(|s| s.clone().expose().into())), ++ line2: details.and_then(|d| d.line2.as_ref().map(|s| s.clone().expose().into())), ++ line3: details.and_then(|d| d.line3.as_ref().map(|s| s.clone().expose().into())), ++ city: details.and_then(|d| d.city.as_ref().map(|s| s.clone().into())), ++ state: details.and_then(|d| d.state.as_ref().map(|s| s.clone().expose().into())), ++ zip_code: details.and_then(|d| d.zip.as_ref().map(|s| s.clone().expose().into())), + country_alpha2_code: country, +- email: address.email.as_ref().map(|e| e.peek().to_string()), ++ email: address ++ .email ++ .as_ref() ++ .map(|e| e.clone().expose().expose().into()), + phone_number: address + .phone + .as_ref() +- .and_then(|phone| phone.number.as_ref().map(|n| n.peek().to_string())), ++ .and_then(|phone| phone.number.as_ref().map(|n| n.clone().expose().into())), + phone_country_code: address.phone.as_ref().and_then(|p| p.country_code.clone()), + } + }); +@@ -896,11 +898,6 @@ impl ForeignTryFrom + let billing = payment_address.get_payment_billing().map(|address| { + let details = address.address.as_ref(); + +- let get_str = +- |opt: &Option>| opt.as_ref().map(|s| s.peek().to_owned()); +- +- let get_plain = |opt: &Option| opt.clone(); +- + let country = details.and_then(|details| { + details + .country +@@ -910,20 +907,21 @@ impl ForeignTryFrom + }); + + payments_grpc::Address { +- first_name: get_str(&details.and_then(|d| d.first_name.clone())), +- last_name: get_str(&details.and_then(|d| d.last_name.clone())), +- line1: get_str(&details.and_then(|d| d.line1.clone())), +- line2: get_str(&details.and_then(|d| d.line2.clone())), +- line3: get_str(&details.and_then(|d| d.line3.clone())), +- city: get_plain(&details.and_then(|d| d.city.clone())), +- state: get_str(&details.and_then(|d| d.state.clone())), +- zip_code: get_str(&details.and_then(|d| d.zip.clone())), ++ first_name: details ++ .and_then(|d| d.first_name.as_ref().map(|s| s.peek().to_string())), ++ last_name: details.and_then(|d| d.last_name.as_ref().map(|s| s.peek().to_string())), ++ line1: details.and_then(|d| d.line1.as_ref().map(|s| s.peek().to_string().into())), ++ line2: details.and_then(|d| d.line2.as_ref().map(|s| s.peek().to_string().into())), ++ line3: details.and_then(|d| d.line3.as_ref().map(|s| s.peek().to_string().into())), ++ city: details.and_then(|d| d.city.as_ref().map(|s| s.clone().into())), ++ state: details.and_then(|d| d.state.as_ref().map(|s| s.peek().to_string().into())), ++ zip_code: details.and_then(|d| d.zip.as_ref().map(|s| s.peek().to_string().into())), + country_alpha2_code: country, +- email: address.email.as_ref().map(|e| e.peek().to_string()), ++ email: address.email.as_ref().map(|e| e.peek().to_string().into()), + phone_number: address + .phone + .as_ref() +- .and_then(|phone| phone.number.as_ref().map(|n| n.peek().to_string())), ++ .and_then(|phone| phone.number.as_ref().map(|n| n.peek().to_string().into())), + phone_country_code: address.phone.as_ref().and_then(|p| p.country_code.clone()), + } + }); +@@ -932,12 +930,6 @@ impl ForeignTryFrom + payment_address.get_payment_method_billing().map(|address| { + let details = address.address.as_ref(); + +- let get_str = |opt: &Option>| { +- opt.as_ref().map(|s| s.peek().to_owned()) +- }; +- +- let get_plain = |opt: &Option| opt.clone(); +- + let country = details.and_then(|details| { + details + .country +@@ -947,20 +939,30 @@ impl ForeignTryFrom + }); + + payments_grpc::Address { +- first_name: get_str(&details.and_then(|d| d.first_name.clone())), +- last_name: get_str(&details.and_then(|d| d.last_name.clone())), +- line1: get_str(&details.and_then(|d| d.line1.clone())), +- line2: get_str(&details.and_then(|d| d.line2.clone())), +- line3: get_str(&details.and_then(|d| d.line3.clone())), +- city: get_plain(&details.and_then(|d| d.city.clone())), +- state: get_str(&details.and_then(|d| d.state.clone())), +- zip_code: get_str(&details.and_then(|d| d.zip.clone())), ++ first_name: details ++ .and_then(|d| d.first_name.as_ref().map(|s| s.peek().to_string())), ++ last_name: details ++ .and_then(|d| d.last_name.as_ref().map(|s| s.peek().to_string())), ++ line1: details ++ .and_then(|d| d.line1.as_ref().map(|s| s.peek().to_string().into())), ++ line2: details ++ .and_then(|d| d.line2.as_ref().map(|s| s.peek().to_string().into())), ++ line3: details ++ .and_then(|d| d.line3.as_ref().map(|s| s.peek().to_string().into())), ++ city: details.and_then(|d| d.city.as_ref().map(|s| s.clone().into())), ++ state: details ++ .and_then(|d| d.state.as_ref().map(|s| s.peek().to_string().into())), ++ zip_code: details ++ .and_then(|d| d.zip.as_ref().map(|s| s.peek().to_string().into())), + country_alpha2_code: country, +- email: address.email.as_ref().map(|e| e.peek().to_string()), ++ email: address ++ .email ++ .as_ref() ++ .map(|e| e.clone().expose().expose().into()), + phone_number: address + .phone + .as_ref() +- .and_then(|phone| phone.number.as_ref().map(|n| n.peek().to_string())), ++ .and_then(|phone| phone.number.as_ref().map(|n| n.clone().expose().into())), + phone_country_code: address.phone.as_ref().and_then(|p| p.country_code.clone()), + } + }); + +----- END CHUNK ----- \ No newline at end of file diff --git a/raw/d1/d122f0157c8ccb3e000b83fb03b7587d87e5e5ea.txt b/raw/d1/d122f0157c8ccb3e000b83fb03b7587d87e5e5ea.txt new file mode 100644 index 0000000000000000000000000000000000000000..b14319843708cd812be917279e6a1672fbdc2b90 --- /dev/null +++ b/raw/d1/d122f0157c8ccb3e000b83fb03b7587d87e5e5ea.txt @@ -0,0 +1,37 @@ +ROUTE: juspay/hyperswitch@d122f0157c8ccb3e000b83fb03b7587d87e5e5ea +REPO: https://github.com/juspay/hyperswitch +COMMIT: d122f0157c8ccb3e000b83fb03b7587d87e5e5ea +AUTHOR: github-actions <41898282+github-actions[bot]@users.noreply.github.com> +DATE: 2025-08-28T00:30:09 + +=== COMMIT === +SUBJECT: chore(version): 2025.08.28.0 + +=== FILES === +Summary: 1 files changed, +10 -0 +- CHANGELOG.md (+10 -0) + +=== PATCH === +diff --git a/CHANGELOG.md b/CHANGELOG.md +index b3293b8c..5e68aee8 100644 +--- a/CHANGELOG.md ++++ b/CHANGELOG.md +@@ -4,6 +4,16 @@ All notable changes to HyperSwitch will be documented here. + + - - - + ++## 2025.08.28.0 ++ ++### Features ++ ++- **core:** Added support for unified_connector_service CardNumber and Secret Type ([#9044](https://github.com/juspay/hyperswitch/pull/9044)) ([`cf64d2a`](https://github.com/juspay/hyperswitch/commit/cf64d2a9dcef422e7d080e21a7e8644694337a51)) ++ ++**Full Changelog:** [`2025.08.27.0...2025.08.28.0`](https://github.com/juspay/hyperswitch/compare/2025.08.27.0...2025.08.28.0) ++ ++- - - ++ + ## 2025.08.27.0 + + ### Features + +----- END CHUNK ----- \ No newline at end of file diff --git a/raw/d1/d18a94188ea93d07c4581888880088a9e676b1fd.txt b/raw/d1/d18a94188ea93d07c4581888880088a9e676b1fd.txt new file mode 100644 index 0000000000000000000000000000000000000000..5175eb476effdb9dc6c321e8dbaf5336b703893b --- /dev/null +++ b/raw/d1/d18a94188ea93d07c4581888880088a9e676b1fd.txt @@ -0,0 +1,1461 @@ +ROUTE: juspay/hyperswitch@d18a94188ea93d07c4581888880088a9e676b1fd +REPO: https://github.com/juspay/hyperswitch +COMMIT: d18a94188ea93d07c4581888880088a9e676b1fd +AUTHOR: Shivansh Mathur <104988143+su-shivanshmathur@users.noreply.github.com> +DATE: 2025-08-25T13:11:42 + +=== ISSUE_AND_PR === +[PR #8959] feat(injector): add support for new crate - injector for external vault proxy +URL: https://github.com/juspay/hyperswitch/pull/8959 +BODY: +## Type of Change + + +- [ ] Bugfix +- [x] New feature +- [ ] Enhancement +- [ ] Refactoring +- [ ] Dependency updates +- [ ] Documentation +- [ ] CI/CD + +## Description + + +This is the injector crate which would be used for External Vault proxy usage + +Screenshot 2025-07-09 at 12 03 03 PM + +Screenshot 2025-07-09 at 12 15 08 PM + +### Additional Changes + +- [ ] This PR modifies the API contract +- [ ] This PR modifies the database schema +- [ ] This PR modifies application configuration/environment variables + + + + +## Motivation and Context + +Needed a generic way of passing on text as card number which would be swaped on vaults's end for not having PCI compliant data in router. + +## How did you test it? + + + +Have added a test case in the crate itself + +Screenshot 2025-08-05 at 5 48 40 PM + +Screenshot 2025-08-05 at 5 49 22 PM + + + +## Checklist + + +- [ ] I formatted the code `cargo +nightly fmt --all` +- [ ] I addressed lints thrown by `cargo clippy` +- [ ] I reviewed the submitted code +- [ ] I added unit tests for my changes where possible +COMMENTS: +- semanticdiff-com[bot]: Review changes with  SemanticDiff +
+Changed Files +
+ +| File | Status | +| :--- | :--- | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8959/changes#Cargo.lock)  [Cargo\.lock](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8959/changes#Cargo.lock) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8959/changes#crates/injector/Cargo.toml)  [crates/injector/Cargo\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8959/changes#crates/injector/Cargo.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8959/changes#crates/injector/src/injector.rs)  [crates/injector/src/injector\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8959/changes#crates/injector/src/injector.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8959/changes#crates/injector/src/injector.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8959/changes#crates/injector/src/lib.rs)  [crates/injector/src/lib\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8959/changes#crates/injector/src/lib.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8959/changes#crates/injector/src/lib.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8959/changes#crates/injector/src/types.rs)  [crates/injector/src/types\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8959/changes#crates/injector/src/types.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8959/changes#crates/injector/src/types.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8959/changes#crates/router/Cargo.toml)  [crates/router/Cargo\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8959/changes#crates/router/Cargo.toml) | Unsupported file format | + +
+- prasunna09 [crates/injector/src/lib.rs:136]: can we please use nom parser instead of regex. +- prasunna09 [crates/injector/src/lib.rs:142]: we can use into_iter +- prasunna09 [crates/api_models/src/injector.rs:24]: Instead of VaultType, can we rename it to VaultConnectors? +- prasunna09 [crates/api_models/src/injector.rs:137]: can we have doc comments for these fields? +- prasunna09 [crates/hyperswitch_domain_models/src/injector.rs:41]: if we have same enums defined in api, and domain, shouldn't these be in common_enums.rs? +- prasunna09 [crates/hyperswitch_domain_models/src/injector.rs:76]: if we move this enum to common_enums, then we dont require this transformations right? +- prasunna09 [crates/hyperswitch_domain_models/src/injector.rs:12]: why are we using api model to diesel model conversions? +it has to be api to domain model right? +- prasunna09 [crates/hyperswitch_interfaces/src/api.rs:398]: is this required? +- prasunna09 [crates/injector/src/lib.rs:452]: why do we require this check? +- prasunna09 [crates/injector/src/lib.rs:470]: why are we wrapping the template with Value::String? +- prasunna09 [crates/injector/src/lib.rs:133]: since vault_data is being wrapped in value:: string earlier, other than this arm, nothing will be used? +- prasunna09 [crates/injector/src/lib.rs:133]: ```suggestion + Value::String(token_value) => { +``` +please have a better naming convention +- prasunna09 [crates/injector/src/lib.rs:485]: ```suggestion + Err(error_stack::Report::new(InjectorError::InvalidTemplate( + "Template processing resulted in non-string value".to_string(), + )))? + } + }; +``` +- prasunna09 [crates/injector/src/lib.rs:488]: why do we need length here? +- prasunna09 [crates/injector/src/lib.rs:511]: do we need this fn? can't we re-use existing `call_connector_api`? +- prasunna09 [crates/api_models/src/injector.rs:34]: ```suggestion + pub base_url: url::Url, +``` +- prasunna09 [crates/api_models/src/injector.rs:42]: What is this proxy url for? why does UCS need to send it injector? +or will this be shared by Payments service to UCS in request's metadata? +- prasunna09 [crates/api_models/src/injector.rs:42]: ```suggestion + pub proxy_url: Option, +``` +- prasunna09 [crates/hyperswitch_domain_models/src/injector.rs:16]: ```suggestion + pub vault_connector: VaultConnectors, +``` +- prasunna09 [crates/hyperswitch_connectors/src/connectors/redsys.rs:909]: please revert this change if not needed. + +=== COMMIT === +SUBJECT: feat(injector): add support for new crate - injector for external vault proxy (#8959) +BODY: +Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> + +=== FILES === +Summary: 6 files changed, +1204 -2 +- Cargo.lock (+59 -2) +- crates/injector/Cargo.toml (+31 -0) +- crates/injector/src/injector.rs (+887 -0) +- crates/injector/src/lib.rs (+6 -0) +- crates/injector/src/types.rs (+220 -0) +- crates/router/Cargo.toml (+1 -0) + +=== PATCH === +diff --git a/Cargo.lock b/Cargo.lock +index 5fae101a..0855392d 100644 +--- a/Cargo.lock ++++ b/Cargo.lock +@@ -4385,6 +4385,24 @@ dependencies = [ + "cfb", + ] + ++[[package]] ++name = "injector" ++version = "0.1.0" ++dependencies = [ ++ "async-trait", ++ "common_utils", ++ "error-stack 0.4.1", ++ "masking", ++ "nom 7.1.3", ++ "reqwest 0.12.7", ++ "router_env", ++ "serde", ++ "serde_json", ++ "thiserror 1.0.69", ++ "tokio 1.45.1", ++ "url", ++] ++ + [[package]] + name = "into-attr" + version = "0.1.1" +@@ -6574,7 +6592,7 @@ dependencies = [ + "serde_json", + "serde_urlencoded", + "sync_wrapper 0.1.2", +- "system-configuration", ++ "system-configuration 0.5.1", + "tokio 1.45.1", + "tokio-native-tls", + "tokio-rustls 0.24.1", +@@ -6597,8 +6615,10 @@ dependencies = [ + "async-compression", + "base64 0.22.1", + "bytes 1.10.1", ++ "encoding_rs", + "futures-core", + "futures-util", ++ "h2 0.4.8", + "http 1.3.1", + "http-body 1.0.1", + "http-body-util", +@@ -6622,6 +6642,7 @@ dependencies = [ + "serde_json", + "serde_urlencoded", + "sync_wrapper 1.0.1", ++ "system-configuration 0.6.1", + "tokio 1.45.1", + "tokio-native-tls", + "tokio-rustls 0.26.2", +@@ -6630,6 +6651,7 @@ dependencies = [ + "url", + "wasm-bindgen", + "wasm-bindgen-futures", ++ "wasm-streams", + "web-sys", + "webpki-roots 0.26.11", + "windows-registry", +@@ -6784,6 +6806,7 @@ dependencies = [ + "hyperswitch_domain_models", + "hyperswitch_interfaces", + "infer", ++ "injector", + "josekit", + "jsonwebtoken", + "kgraph_utils", +@@ -8296,7 +8319,18 @@ checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" + dependencies = [ + "bitflags 1.3.2", + "core-foundation", +- "system-configuration-sys", ++ "system-configuration-sys 0.5.0", ++] ++ ++[[package]] ++name = "system-configuration" ++version = "0.6.1" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" ++dependencies = [ ++ "bitflags 2.9.0", ++ "core-foundation", ++ "system-configuration-sys 0.6.0", + ] + + [[package]] +@@ -8309,6 +8343,16 @@ dependencies = [ + "libc", + ] + ++[[package]] ++name = "system-configuration-sys" ++version = "0.6.0" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" ++dependencies = [ ++ "core-foundation-sys", ++ "libc", ++] ++ + [[package]] + name = "tagptr" + version = "0.2.0" +@@ -9685,6 +9729,19 @@ dependencies = [ + "unicode-ident", + ] + ++[[package]] ++name = "wasm-streams" ++version = "0.4.1" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "4e072d4e72f700fb3443d8fe94a39315df013eef1104903cdb0a2abd322bbecd" ++dependencies = [ ++ "futures-util", ++ "js-sys", ++ "wasm-bindgen", ++ "wasm-bindgen-futures", ++ "web-sys", ++] ++ + [[package]] + name = "web-sys" + version = "0.3.77" +diff --git a/crates/injector/Cargo.toml b/crates/injector/Cargo.toml +new file mode 100644 +index 00000000..1e51eb6f +--- /dev/null ++++ b/crates/injector/Cargo.toml +@@ -0,0 +1,31 @@ ++[package] ++name = "injector" ++description = "Token injection and payload processing for payment connectors" ++version = "0.1.0" ++edition.workspace = true ++rust-version.workspace = true ++license.workspace = true ++ ++[features] ++default = ["serde", "tracing-actix-web"] ++ ++serde = [] ++tracing-actix-web = [] ++ ++[dependencies] ++common_utils = { version = "0.1.0", path = "../common_utils" } ++masking = { version = "0.1.0", path = "../masking" } ++router_env = { version = "0.1.0", path = "../router_env" } ++ ++async-trait = { version = "0.1.88" } ++error-stack = { version = "0.4.1" } ++nom = { version = "7.1.3" } ++reqwest = { version = "0.12.0", features = ["json", "stream"] } ++serde = { version = "1.0.219", features = ["derive"] } ++serde_json = { version = "1.0.140" } ++thiserror = { version = "1.0.69" } ++tokio = { version = "1.42.0", features = ["macros", "rt-multi-thread"] } ++url = { version = "2.5.4", features = ["serde"] } ++ ++[lints] ++workspace = true +\ No newline at end of file +diff --git a/crates/injector/src/injector.rs b/crates/injector/src/injector.rs +new file mode 100644 +index 00000000..cbeade41 +--- /dev/null ++++ b/crates/injector/src/injector.rs +@@ -0,0 +1,887 @@ ++pub mod core { ++ use std::collections::HashMap; ++ ++ use async_trait::async_trait; ++ use common_utils::request::{Method, RequestBuilder, RequestContent}; ++ use error_stack::ResultExt; ++ use masking::{self, ExposeInterface}; ++ use nom::{ ++ bytes::complete::{tag, take_while1}, ++ character::complete::{char, multispace0}, ++ sequence::{delimited, preceded, terminated}, ++ IResult, ++ }; ++ use router_env::{instrument, logger, tracing}; ++ use serde_json::Value; ++ use thiserror::Error; ++ ++ use crate as injector_types; ++ use crate::{ContentType, InjectorRequest, InjectorResponse}; ++ ++ impl From for Method { ++ fn from(method: injector_types::HttpMethod) -> Self { ++ match method { ++ injector_types::HttpMethod::GET => Self::Get, ++ injector_types::HttpMethod::POST => Self::Post, ++ injector_types::HttpMethod::PUT => Self::Put, ++ injector_types::HttpMethod::PATCH => Self::Patch, ++ injector_types::HttpMethod::DELETE => Self::Delete, ++ } ++ } ++ } ++ ++ /// Proxy configuration structure (copied from hyperswitch_interfaces to make injector standalone) ++ #[derive(Debug, serde::Deserialize, Clone)] ++ #[serde(default)] ++ pub struct Proxy { ++ /// The URL of the HTTP proxy server. ++ pub http_url: Option, ++ /// The URL of the HTTPS proxy server. ++ pub https_url: Option, ++ /// The timeout duration (in seconds) for idle connections in the proxy pool. ++ pub idle_pool_connection_timeout: Option, ++ /// A comma-separated list of hosts that should bypass the proxy. ++ pub bypass_proxy_hosts: Option, ++ } ++ ++ impl Default for Proxy { ++ fn default() -> Self { ++ Self { ++ http_url: Default::default(), ++ https_url: Default::default(), ++ idle_pool_connection_timeout: Some(90), ++ bypass_proxy_hosts: Default::default(), ++ } ++ } ++ } ++ ++ /// Simplified HTTP client for injector (copied from external_services to make injector standalone) ++ /// This is a minimal implementation that covers the essential functionality needed by injector ++ #[instrument(skip_all)] ++ pub async fn send_request( ++ client_proxy: &Proxy, ++ request: common_utils::request::Request, ++ _option_timeout_secs: Option, ++ ) -> error_stack::Result { ++ logger::info!("Making HTTP request using standalone injector HTTP client"); ++ ++ // Create reqwest client with proxy configuration ++ let mut client_builder = reqwest::Client::builder(); ++ ++ // Configure proxy if provided ++ if let Some(proxy_url) = &client_proxy.https_url { ++ let proxy = reqwest::Proxy::https(proxy_url).map_err(|e| { ++ logger::error!("Failed to configure HTTPS proxy: {}", e); ++ error_stack::Report::new(InjectorError::HttpRequestFailed) ++ })?; ++ client_builder = client_builder.proxy(proxy); ++ } ++ ++ if let Some(proxy_url) = &client_proxy.http_url { ++ let proxy = reqwest::Proxy::http(proxy_url).map_err(|e| { ++ logger::error!("Failed to configure HTTP proxy: {}", e); ++ error_stack::Report::new(InjectorError::HttpRequestFailed) ++ })?; ++ client_builder = client_builder.proxy(proxy); ++ } ++ ++ let client = client_builder.build().map_err(|e| { ++ logger::error!("Failed to build HTTP client: {}", e); ++ error_stack::Report::new(InjectorError::HttpRequestFailed) ++ })?; ++ ++ // Build the request ++ let method = match request.method { ++ Method::Get => reqwest::Method::GET, ++ Method::Post => reqwest::Method::POST, ++ Method::Put => reqwest::Method::PUT, ++ Method::Patch => reqwest::Method::PATCH, ++ Method::Delete => reqwest::Method::DELETE, ++ }; ++ ++ let mut req_builder = client.request(method, &request.url); ++ ++ // Add headers ++ for (key, value) in &request.headers { ++ let header_value = match value { ++ masking::Maskable::Masked(secret) => secret.clone().expose(), ++ masking::Maskable::Normal(normal) => normal.clone(), ++ }; ++ req_builder = req_builder.header(key, header_value); ++ } ++ ++ // Add body if present ++ if let Some(body) = request.body { ++ match body { ++ RequestContent::Json(payload) => { ++ req_builder = req_builder.json(&payload); ++ } ++ RequestContent::FormUrlEncoded(payload) => { ++ req_builder = req_builder.form(&payload); ++ } ++ RequestContent::RawBytes(payload) => { ++ req_builder = req_builder.body(payload); ++ } ++ _ => { ++ logger::warn!("Unsupported request content type, using raw bytes"); ++ } ++ } ++ } ++ ++ // Send the request ++ let response = req_builder.send().await.map_err(|e| { ++ logger::error!("HTTP request failed: {}", e); ++ error_stack::Report::new(InjectorError::HttpRequestFailed) ++ })?; ++ ++ Ok(response) ++ } ++ ++ #[derive(Error, Debug)] ++ pub enum InjectorError { ++ #[error("Token replacement failed: {0}")] ++ TokenReplacementFailed(String), ++ #[error("HTTP request failed")] ++ HttpRequestFailed, ++ #[error("Serialization error: {0}")] ++ SerializationError(String), ++ #[error("Invalid template: {0}")] ++ InvalidTemplate(String), ++ } ++ ++ #[instrument(skip_all)] ++ pub async fn injector_core( ++ request: InjectorRequest, ++ ) -> error_stack::Result { ++ logger::info!("Starting injector_core processing"); ++ let injector = Injector::new(); ++ injector.injector_core(request).await ++ } ++ ++ /// Represents a token reference found in a template string ++ #[derive(Debug)] ++ pub struct TokenReference { ++ /// The field name to be replaced (without the {{$}} wrapper) ++ pub field: String, ++ } ++ ++ /// Parses a single token reference from a string using nom parser combinators ++ /// ++ /// Expects tokens in the format `{{$field_name}}` where field_name contains ++ /// only alphanumeric characters and underscores. ++ pub fn parse_token(input: &str) -> IResult<&str, TokenReference> { ++ let (input, field) = delimited( ++ tag("{{"), ++ preceded( ++ multispace0, ++ preceded( ++ char('$'), ++ terminated( ++ take_while1(|c: char| c.is_alphanumeric() || c == '_'), ++ multispace0, ++ ), ++ ), ++ ), ++ tag("}}"), ++ )(input)?; ++ Ok(( ++ input, ++ TokenReference { ++ field: field.to_string(), ++ }, ++ )) ++ } ++ ++ /// Finds all token references in a string using nom parser ++ /// ++ /// Scans through the entire input string and extracts all valid token references. ++ /// Returns a vector of TokenReference structs containing the field names. ++ pub fn find_all_tokens(input: &str) -> Vec { ++ let mut tokens = Vec::new(); ++ let mut current_input = input; ++ ++ while !current_input.is_empty() { ++ if let Ok((remaining, token_ref)) = parse_token(current_input) { ++ tokens.push(token_ref); ++ current_input = remaining; ++ } else { ++ // Move forward one character if no token found ++ if let Some((_, rest)) = current_input.split_at_checked(1) { ++ current_input = rest; ++ } else { ++ break; ++ } ++ } ++ } ++ ++ tokens ++ } ++ ++ /// Recursively searches for a field in vault data JSON structure ++ /// ++ /// Performs a depth-first search through the JSON object hierarchy to find ++ /// a field with the specified name. Returns the first matching value found. ++ pub fn find_field_recursively_in_vault_data( ++ obj: &serde_json::Map, ++ field_name: &str, ++ ) -> Option { ++ obj.get(field_name).cloned().or_else(|| { ++ obj.values() ++ .filter_map(|val| { ++ if let Value::Object(inner_obj) = val { ++ find_field_recursively_in_vault_data(inner_obj, field_name) ++ } else { ++ None ++ } ++ }) ++ .next() ++ }) ++ } ++ ++ #[async_trait] ++ pub trait TokenInjector { ++ async fn injector_core( ++ &self, ++ request: InjectorRequest, ++ ) -> error_stack::Result; ++ } ++ ++ pub struct Injector; ++ ++ impl Injector { ++ pub fn new() -> Self { ++ Self ++ } ++ ++ /// Processes a string template and replaces token references with vault data ++ #[instrument(skip_all)] ++ pub fn interpolate_string_template_with_vault_data( ++ &self, ++ template: String, ++ vault_data: &Value, ++ vault_connector: &injector_types::VaultConnectors, ++ ) -> error_stack::Result { ++ // Find all tokens using nom parser ++ let tokens = find_all_tokens(&template); ++ let mut result = template; ++ ++ for token_ref in tokens.into_iter() { ++ let extracted_field_value = self.extract_field_from_vault_data( ++ vault_data, ++ &token_ref.field, ++ vault_connector, ++ )?; ++ let token_str = match extracted_field_value { ++ Value::String(token_value) => token_value, ++ _ => serde_json::to_string(&extracted_field_value).unwrap_or_default(), ++ }; ++ ++ // Replace the token in the result string ++ let token_pattern = format!("{{{{${}}}}}", token_ref.field); ++ result = result.replace(&token_pattern, &token_str); ++ } ++ ++ Ok(result) ++ } ++ ++ #[instrument(skip_all)] ++ pub fn interpolate_token_references_with_vault_data( ++ &self, ++ value: Value, ++ vault_data: &Value, ++ vault_connector: &injector_types::VaultConnectors, ++ ) -> error_stack::Result { ++ match value { ++ Value::Object(obj) => { ++ let new_obj = obj ++ .into_iter() ++ .map(|(key, val)| { ++ self.interpolate_token_references_with_vault_data( ++ val, ++ vault_data, ++ vault_connector, ++ ) ++ .map(|processed| (key, processed)) ++ }) ++ .collect::, InjectorError>>()?; ++ Ok(Value::Object(new_obj)) ++ } ++ Value::String(s) => { ++ let processed_string = self.interpolate_string_template_with_vault_data( ++ s, ++ vault_data, ++ vault_connector, ++ )?; ++ Ok(Value::String(processed_string)) ++ } ++ _ => Ok(value), ++ } ++ } ++ ++ #[instrument(skip_all)] ++ fn extract_field_from_vault_data( ++ &self, ++ vault_data: &Value, ++ field_name: &str, ++ vault_connector: &injector_types::VaultConnectors, ++ ) -> error_stack::Result { ++ logger::debug!( ++ "Extracting field '{}' from vault data using vault type {:?}", ++ field_name, ++ vault_connector ++ ); ++ ++ match vault_data { ++ Value::Object(obj) => { ++ let raw_value = find_field_recursively_in_vault_data(obj, field_name) ++ .ok_or_else(|| { ++ error_stack::Report::new(InjectorError::TokenReplacementFailed( ++ format!("Field '{field_name}' not found"), ++ )) ++ })?; ++ ++ // Apply vault-specific token transformation ++ self.apply_vault_specific_transformation(raw_value, vault_connector, field_name) ++ } ++ _ => Err(error_stack::Report::new( ++ InjectorError::TokenReplacementFailed( ++ "Vault data is not a valid JSON object".to_string(), ++ ), ++ )), ++ } ++ } ++ ++ #[instrument(skip_all)] ++ fn apply_vault_specific_transformation( ++ &self, ++ extracted_field_value: Value, ++ vault_connector: &injector_types::VaultConnectors, ++ field_name: &str, ++ ) -> error_stack::Result { ++ match vault_connector { ++ injector_types::VaultConnectors::VGS => { ++ logger::debug!( ++ "VGS vault: Using direct token replacement for field '{}'", ++ field_name ++ ); ++ Ok(extracted_field_value) ++ } ++ } ++ } ++ ++ #[instrument(skip_all)] ++ async fn make_http_request( ++ &self, ++ config: &injector_types::DomainConnectionConfig, ++ payload: &str, ++ content_type: &ContentType, ++ ) -> error_stack::Result { ++ logger::info!( ++ method = ?config.http_method, ++ base_url = %config.base_url, ++ endpoint = %config.endpoint_path, ++ content_type = ?content_type, ++ payload_length = payload.len(), ++ headers_count = config.headers.len(), ++ "Making HTTP request to connector" ++ ); ++ // Validate inputs first ++ if config.endpoint_path.is_empty() { ++ logger::error!("Endpoint path is empty"); ++ Err(error_stack::Report::new(InjectorError::InvalidTemplate( ++ "Endpoint path cannot be empty".to_string(), ++ )))?; ++ } ++ ++ // Construct URL safely by joining base URL with endpoint path ++ let url = config.base_url.join(&config.endpoint_path).map_err(|e| { ++ logger::error!("Failed to join base URL with endpoint path: {}", e); ++ error_stack::Report::new(InjectorError::InvalidTemplate(format!( ++ "Invalid URL construction: {e}" ++ ))) ++ })?; ++ ++ logger::debug!("Constructed URL: {}", url); ++ ++ // Convert headers to common_utils Headers format safely ++ let headers: Vec<(String, masking::Maskable)> = config ++ .headers ++ .clone() ++ .into_iter() ++ .map(|(k, v)| (k, masking::Maskable::new_normal(v.expose().clone()))) ++ .collect(); ++ ++ // Determine method and request content ++ let method = Method::from(config.http_method); ++ ++ // Determine request content based on content type with error handling ++ let request_content = match content_type { ++ ContentType::ApplicationJson => { ++ // Try to parse as JSON, fallback to raw string ++ match serde_json::from_str::(payload) { ++ Ok(json) => Some(RequestContent::Json(Box::new(json))), ++ Err(e) => { ++ logger::debug!( ++ "Failed to parse payload as JSON: {}, falling back to raw bytes", ++ e ++ ); ++ Some(RequestContent::RawBytes(payload.as_bytes().to_vec())) ++ } ++ } ++ } ++ ContentType::ApplicationXWwwFormUrlencoded => { ++ // Parse form data safely ++ let form_data: HashMap = ++ url::form_urlencoded::parse(payload.as_bytes()) ++ .into_owned() ++ .collect(); ++ Some(RequestContent::FormUrlEncoded(Box::new(form_data))) ++ } ++ ContentType::ApplicationXml | ContentType::TextXml => { ++ Some(RequestContent::RawBytes(payload.as_bytes().to_vec())) ++ } ++ ContentType::TextPlain => { ++ Some(RequestContent::RawBytes(payload.as_bytes().to_vec())) ++ } ++ }; ++ ++ // Build request safely ++ let mut request_builder = RequestBuilder::new() ++ .method(method) ++ .url(url.as_str()) ++ .headers(headers); ++ ++ if let Some(content) = request_content { ++ request_builder = request_builder.set_body(content); ++ } ++ ++ // Add certificate configuration if provided ++ if let Some(cert_content) = &config.client_cert { ++ logger::debug!("Adding client certificate content"); ++ request_builder = request_builder.add_certificate(Some(cert_content.clone())); ++ } ++ ++ if let Some(key_content) = &config.client_key { ++ logger::debug!("Adding client private key content"); ++ request_builder = request_builder.add_certificate_key(Some(key_content.clone())); ++ } ++ ++ if let Some(ca_content) = &config.ca_cert { ++ logger::debug!("Adding CA certificate content"); ++ request_builder = request_builder.add_ca_certificate_pem(Some(ca_content.clone())); ++ } ++ ++ // Log certificate configuration (but not the actual content) ++ logger::info!( ++ has_client_cert = config.client_cert.is_some(), ++ has_client_key = config.client_key.is_some(), ++ has_ca_cert = config.ca_cert.is_some(), ++ insecure = config.insecure.unwrap_or(false), ++ cert_format = ?config.cert_format, ++ "Certificate configuration applied" ++ ); ++ ++ let request = request_builder.build(); ++ ++ let proxy = if let Some(proxy_url) = &config.proxy_url { ++ logger::debug!("Using proxy: {}", proxy_url); ++ // Determine if it's HTTP or HTTPS proxy based on URL scheme ++ if proxy_url.scheme() == "https" { ++ Proxy { ++ http_url: None, ++ https_url: Some(proxy_url.to_string()), ++ idle_pool_connection_timeout: Some(90), ++ bypass_proxy_hosts: None, ++ } ++ } else { ++ Proxy { ++ http_url: Some(proxy_url.to_string()), ++ https_url: None, ++ idle_pool_connection_timeout: Some(90), ++ bypass_proxy_hosts: None, ++ } ++ } ++ } else { ++ logger::debug!("No proxy configured, using direct connection"); ++ Proxy::default() ++ }; ++ ++ // Send request using local standalone http client ++ logger::debug!("Sending HTTP request to connector"); ++ let response = send_request(&proxy, request, None).await?; ++ ++ logger::info!( ++ status_code = response.status().as_u16(), ++ "Received response from connector" ++ ); ++ ++ let response_text = response ++ .text() ++ .await ++ .change_context(InjectorError::HttpRequestFailed)?; ++ ++ logger::debug!( ++ response_length = response_text.len(), ++ "Processing connector response" ++ ); ++ ++ // Try to parse as JSON, fallback to string value with error logging ++ match serde_json::from_str::(&response_text) { ++ Ok(json) => { ++ logger::debug!("Successfully parsed response as JSON"); ++ Ok(json) ++ } ++ Err(e) => { ++ logger::debug!( ++ "Failed to parse response as JSON: {}, returning as string", ++ e ++ ); ++ Ok(Value::String(response_text)) ++ } ++ } ++ } ++ } ++ ++ impl Default for Injector { ++ fn default() -> Self { ++ Self::new() ++ } ++ } ++ ++ #[async_trait] ++ impl TokenInjector for Injector { ++ #[instrument(skip_all)] ++ async fn injector_core( ++ &self, ++ request: InjectorRequest, ++ ) -> error_stack::Result { ++ logger::info!("Starting token injection process"); ++ ++ let start_time = std::time::Instant::now(); ++ ++ // Convert API model to domain model ++ let domain_request: injector_types::DomainInjectorRequest = request.into(); ++ ++ // Extract token data from SecretSerdeValue for vault data lookup ++ let vault_data = domain_request ++ .token_data ++ .specific_token_data ++ .expose() ++ .clone(); ++ ++ logger::debug!( ++ template_length = domain_request.connector_payload.template.len(), ++ vault_connector = ?domain_request.token_data.vault_connector, ++ "Processing token injection request" ++ ); ++ ++ // Process template string directly with vault-specific logic ++ let processed_payload = self.interpolate_string_template_with_vault_data( ++ domain_request.connector_payload.template, ++ &vault_data, ++ &domain_request.token_data.vault_connector, ++ )?; ++ ++ logger::debug!( ++ processed_payload_length = processed_payload.len(), ++ "Token replacement completed" ++ ); ++ ++ // Determine content type from headers or default to form-urlencoded ++ let content_type = domain_request ++ .connection_config ++ .headers ++ .get("Content-Type") ++ .and_then(|ct| match ct.clone().expose().as_str() { ++ "application/json" => Some(ContentType::ApplicationJson), ++ "application/x-www-form-urlencoded" => { ++ Some(ContentType::ApplicationXWwwFormUrlencoded) ++ } ++ "application/xml" => Some(ContentType::ApplicationXml), ++ "text/xml" => Some(ContentType::TextXml), ++ "text/plain" => Some(ContentType::TextPlain), ++ _ => None, ++ }) ++ .unwrap_or(ContentType::ApplicationXWwwFormUrlencoded); ++ ++ // Make HTTP request to connector and return raw response ++ let response_data = self ++ .make_http_request( ++ &domain_request.connection_config, ++ &processed_payload, ++ &content_type, ++ ) ++ .await?; ++ ++ let elapsed = start_time.elapsed(); ++ logger::info!( ++ duration_ms = elapsed.as_millis(), ++ response_size = serde_json::to_string(&response_data) ++ .map(|s| s.len()) ++ .unwrap_or(0), ++ "Token injection completed successfully" ++ ); ++ ++ // Return the raw connector response for connector-agnostic handling ++ Ok(response_data) ++ } ++ } ++} ++ ++// Re-export all items ++pub use core::*; ++ ++#[cfg(test)] ++#[allow(clippy::unwrap_used)] ++mod tests { ++ use router_env::logger; ++ ++ use super::core::*; ++ use crate::*; ++ ++ #[test] ++ fn test_token_parsing() { ++ let result = parse_token("{{$card_number}}"); ++ assert!(result.is_ok()); ++ let (_, token_ref) = result.unwrap(); ++ assert_eq!(token_ref.field, "card_number"); ++ } ++ ++ #[test] ++ fn test_token_interpolation() { ++ let injector = Injector::new(); ++ let template = serde_json::Value::String("card_number={{$card_number}}&cvv={{$cvv}}&expiry={{$exp_month}}/{{$exp_year}}&amount=50¤cy=USD&transaction_type=purchase".to_string()); ++ ++ let vault_data = serde_json::json!({ ++ "card_number": "TEST_card123", ++ "cvv": "TEST_cvv456", ++ "exp_month": "TEST_12", ++ "exp_year": "TEST_2026" ++ }); ++ ++ // Test with VGS vault (direct replacement) ++ let vault_connector = VaultConnectors::VGS; ++ let result = injector ++ .interpolate_token_references_with_vault_data(template, &vault_data, &vault_connector) ++ .unwrap(); ++ assert_eq!(result, serde_json::Value::String("card_number=TEST_card123&cvv=TEST_cvv456&expiry=TEST_12/TEST_2026&amount=50¤cy=USD&transaction_type=purchase".to_string())); ++ } ++ ++ #[test] ++ fn test_field_not_found() { ++ let injector = Injector::new(); ++ let template = serde_json::Value::String("{{$unknown_field}}".to_string()); ++ ++ let vault_data = serde_json::json!({ ++ "card_number": "TEST_CARD_NUMBER" ++ }); ++ ++ let vault_connector = VaultConnectors::VGS; ++ let result = injector.interpolate_token_references_with_vault_data( ++ template, ++ &vault_data, ++ &vault_connector, ++ ); ++ assert!(result.is_err()); ++ } ++ ++ #[test] ++ fn test_recursive_field_search() { ++ let vault_data = serde_json::json!({ ++ "payment_method": { ++ "card": { ++ "number": "TEST_CARD_NUMBER" ++ } ++ } ++ }); ++ ++ let obj = vault_data.as_object().unwrap(); ++ let result = find_field_recursively_in_vault_data(obj, "number"); ++ assert_eq!( ++ result, ++ Some(serde_json::Value::String("TEST_CARD_NUMBER".to_string())) ++ ); ++ } ++ ++ #[test] ++ fn test_vault_specific_token_handling() { ++ let injector = Injector::new(); ++ let template = serde_json::Value::String("{{$card_number}}".to_string()); ++ ++ let vault_data = serde_json::json!({ ++ "card_number": "TOKEN" ++ }); ++ ++ // Test VGS vault - direct replacement ++ let vgs_result = injector ++ .interpolate_token_references_with_vault_data( ++ template.clone(), ++ &vault_data, ++ &VaultConnectors::VGS, ++ ) ++ .unwrap(); ++ assert_eq!(vgs_result, serde_json::Value::String("TOKEN".to_string())); ++ } ++ ++ #[tokio::test] ++ #[ignore = "Integration test that requires network access"] ++ async fn test_injector_core_integration() { ++ use std::collections::HashMap; ++ ++ // Create test request ++ let mut headers = HashMap::new(); ++ headers.insert( ++ "Content-Type".to_string(), ++ masking::Secret::new("application/x-www-form-urlencoded".to_string()), ++ ); ++ headers.insert( ++ "Authorization".to_string(), ++ masking::Secret::new("Bearer Test".to_string()), ++ ); ++ ++ let specific_token_data = common_utils::pii::SecretSerdeValue::new(serde_json::json!({ ++ "card_number": "TEST_123", ++ "cvv": "123", ++ "exp_month": "12", ++ "exp_year": "25" ++ })); ++ ++ let request = InjectorRequest { ++ connector_payload: ConnectorPayload { ++ template: "card_number={{$card_number}}&cvv={{$cvv}}&expiry={{$exp_month}}/{{$exp_year}}&amount=50¤cy=USD&transaction_type=purchase".to_string(), ++ }, ++ token_data: TokenData { ++ vault_connector: VaultConnectors::VGS, ++ specific_token_data, ++ }, ++ connection_config: ConnectionConfig { ++ base_url: "https://api.stripe.com".parse().unwrap(), ++ endpoint_path: "/v1/payment_intents".to_string(), ++ http_method: HttpMethod::POST, ++ headers, ++ proxy_url: None, // Remove proxy that was causing issues ++ // Certificate fields (None for basic test) ++ client_cert: None, ++ client_key: None, ++ ca_cert: None, // Empty CA cert for testing ++ insecure: None, ++ cert_password: None, ++ cert_format: None, ++ max_response_size: None, // Use default ++ }, ++ }; ++ ++ // Test the core function - this will make a real HTTP request to httpbin.org ++ let result = injector_core(request).await; ++ ++ // The request should succeed (httpbin.org should be accessible) ++ if let Err(ref e) = result { ++ logger::info!("Error: {e:?}"); ++ } ++ assert!( ++ result.is_ok(), ++ "injector_core should succeed with valid request: {result:?}" ++ ); ++ ++ let response = result.unwrap(); ++ ++ // Print the actual response for demonstration ++ logger::info!("=== HTTP RESPONSE FROM HTTPBIN.ORG ==="); ++ logger::info!( ++ "{}", ++ serde_json::to_string_pretty(&response).unwrap_or_default() ++ ); ++ logger::info!("======================================="); ++ ++ // Response should be a JSON value from httpbin.org ++ assert!( ++ response.is_object() || response.is_string(), ++ "Response should be JSON object or string" ++ ); ++ } ++ ++ #[tokio::test] ++ #[ignore = "Integration test that requires network access"] ++ async fn test_certificate_configuration() { ++ use std::collections::HashMap; ++ ++ let mut headers = HashMap::new(); ++ headers.insert( ++ "Content-Type".to_string(), ++ masking::Secret::new("application/x-www-form-urlencoded".to_string()), ++ ); ++ headers.insert( ++ "Authorization".to_string(), ++ masking::Secret::new("Bearer API_KEY".to_string()), ++ ); ++ ++ let specific_token_data = common_utils::pii::SecretSerdeValue::new(serde_json::json!({ ++ "card_number": "TOKEN", ++ "cvv": "123", ++ "exp_month": "12", ++ "exp_year": "25" ++ })); ++ ++ // Test with insecure flag (skip certificate verification) ++ let request = InjectorRequest { ++ connector_payload: ConnectorPayload { ++ template: "card_number={{$card_number}}&cvv={{$cvv}}&expiry={{$exp_month}}/{{$exp_year}}&amount=50¤cy=USD&transaction_type=purchase".to_string(), ++ }, ++ token_data: TokenData { ++ vault_connector: VaultConnectors::VGS, ++ specific_token_data, ++ }, ++ connection_config: ConnectionConfig { ++ base_url: "https://api.stripe.com".parse().unwrap(), ++ endpoint_path: "/v1/payment_intents".to_string(), ++ http_method: HttpMethod::POST, ++ headers, ++ proxy_url: Some("https://proxy.example.com:8443".parse().unwrap()), ++ // Certificate configuration - using insecure for testing ++ client_cert: None, ++ client_key: None, ++ ca_cert: Some(masking::Secret::new("CERT".to_string())), ++ insecure: None, // This allows testing with self-signed certs ++ cert_password: None, ++ cert_format: None, ++ max_response_size: None, // Use default ++ }, ++ }; ++ ++ let result = injector_core(request).await; ++ ++ // Should succeed even with insecure flag ++ assert!( ++ result.is_ok(), ++ "Certificate test should succeed: {result:?}" ++ ); ++ ++ let response = result.unwrap(); ++ ++ // Print the actual response for demonstration ++ logger::info!("=== CERTIFICATE TEST RESPONSE ==="); ++ logger::info!( ++ "{}", ++ serde_json::to_string_pretty(&response).unwrap_or_default() ++ ); ++ logger::info!("================================"); ++ ++ // Verify the token was replaced in the JSON ++ // httpbin.org returns the request data in the 'data' or 'json' field ++ let response_contains_token = if let Some(response_str) = response.as_str() { ++ response_str.contains("TOKEN") ++ } else if response.is_object() { ++ // Check if the response contains our token in the request data ++ let response_str = serde_json::to_string(&response).unwrap_or_default(); ++ response_str.contains("TOKEN") ++ } else { ++ false ++ }; ++ ++ assert!( ++ response_contains_token, ++ "Response should contain replaced token: {}", ++ serde_json::to_string_pretty(&response).unwrap_or_default() ++ ); ++ } ++} +diff --git a/crates/injector/src/lib.rs b/crates/injector/src/lib.rs +new file mode 100644 +index 00000000..b3a63e1d +--- /dev/null ++++ b/crates/injector/src/lib.rs +@@ -0,0 +1,6 @@ ++pub mod injector; ++pub mod types; ++ ++// Re-export all functionality ++pub use injector::*; ++pub use types::*; +diff --git a/crates/injector/src/types.rs b/crates/injector/src/types.rs +new file mode 100644 +index 00000000..a627d8ff +--- /dev/null ++++ b/crates/injector/src/types.rs +@@ -0,0 +1,220 @@ ++pub mod models { ++ use std::collections::HashMap; ++ ++ use common_utils::pii::SecretSerdeValue; ++ use masking::Secret; ++ use serde::{Deserialize, Serialize}; ++ use url::Url; ++ ++ // Enums for the injector - making it standalone ++ ++ /// Content types supported by the injector for HTTP requests ++ #[derive(Clone, Copy, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize)] ++ #[serde(rename_all = "snake_case")] ++ pub enum ContentType { ++ ApplicationJson, ++ ApplicationXWwwFormUrlencoded, ++ ApplicationXml, ++ TextXml, ++ TextPlain, ++ } ++ ++ /// HTTP methods supported by the injector ++ #[derive(Clone, Copy, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize)] ++ #[serde(rename_all = "UPPERCASE")] ++ pub enum HttpMethod { ++ GET, ++ POST, ++ PUT, ++ PATCH, ++ DELETE, ++ } ++ ++ /// Accept types supported by the injector for HTTP requests ++ #[derive(Clone, Copy, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize)] ++ #[serde(rename_all = "snake_case")] ++ pub enum AcceptType { ++ ApplicationJson, ++ ApplicationXml, ++ TextXml, ++ TextPlain, ++ Any, ++ } ++ ++ /// Vault connectors supported by the injector for token management ++ /// ++ /// Currently supports VGS as the primary vault connector. While only VGS is ++ /// implemented today, this enum structure is maintained for future extensibility ++ /// to support additional vault providers (e.g., Basis Theory, Skyflow, etc.) ++ /// without breaking API compatibility. ++ #[derive(Clone, Copy, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize)] ++ #[serde(rename_all = "UPPERCASE")] ++ pub enum VaultConnectors { ++ /// VGS (Very Good Security) vault connector ++ VGS, ++ } ++ ++ /// Token data containing vault-specific information for token replacement ++ #[derive(Clone, Debug, Deserialize, Serialize)] ++ pub struct TokenData { ++ /// The specific token data retrieved from the vault ++ pub specific_token_data: SecretSerdeValue, ++ /// The type of vault connector being used (e.g., VGS) ++ pub vault_connector: VaultConnectors, ++ } ++ ++ /// Connector payload containing the template to be processed ++ #[derive(Clone, Debug, Deserialize, Serialize)] ++ pub struct ConnectorPayload { ++ /// Template string containing token references in the format {{$field_name}} ++ pub template: String, ++ } ++ ++ /// Configuration for HTTP connection to the external connector ++ #[derive(Clone, Debug, Deserialize, Serialize)] ++ pub struct ConnectionConfig { ++ /// Base URL of the connector endpoint ++ pub base_url: Url, ++ /// Path to append to the base URL for the specific endpoint ++ pub endpoint_path: String, ++ /// HTTP method to use for the request ++ pub http_method: HttpMethod, ++ /// HTTP headers to include in the request ++ pub headers: HashMap>, ++ /// Optional proxy URL for routing the request through a proxy server ++ pub proxy_url: Option, ++ /// Optional client certificate for mutual TLS authentication ++ pub client_cert: Option>, ++ /// Optional client private key for mutual TLS authentication ++ pub client_key: Option>, ++ /// Optional CA certificate for verifying the server certificate ++ pub ca_cert: Option>, ++ /// Whether to skip certificate verification (for testing only) ++ pub insecure: Option, ++ /// Optional password for encrypted client certificate ++ pub cert_password: Option>, ++ /// Format of the client certificate (e.g., "PEM") ++ pub cert_format: Option, ++ /// Maximum response size in bytes (defaults to 10MB if not specified) ++ pub max_response_size: Option, ++ } ++ ++ /// Complete request structure for the injector service ++ #[derive(Clone, Debug, Deserialize, Serialize)] ++ pub struct InjectorRequest { ++ /// Token data from the vault ++ pub token_data: TokenData, ++ /// Payload template to process ++ pub connector_payload: ConnectorPayload, ++ /// HTTP connection configuration ++ pub connection_config: ConnectionConfig, ++ } ++ ++ pub type InjectorResponse = serde_json::Value; ++ ++ // Domain models for internal use ++ ++ /// Domain model for token data containing vault-specific information ++ #[derive(Clone, Debug)] ++ pub struct DomainTokenData { ++ /// The specific token data retrieved from the vault, containing sensitive PII ++ pub specific_token_data: SecretSerdeValue, ++ /// The type of vault connector being used for token retrieval ++ pub vault_connector: VaultConnectors, ++ } ++ ++ impl From for DomainTokenData { ++ fn from(token_data: TokenData) -> Self { ++ Self { ++ specific_token_data: token_data.specific_token_data, ++ vault_connector: token_data.vault_connector, ++ } ++ } ++ } ++ ++ /// Domain model for connector payload containing the template to be processed ++ #[derive(Clone, Debug)] ++ pub struct DomainConnectorPayload { ++ /// Template string containing token references in the format {{$field_name}} ++ pub template: String, ++ } ++ ++ impl From for DomainConnectorPayload { ++ fn from(payload: ConnectorPayload) -> Self { ++ Self { ++ template: payload.template, ++ } ++ } ++ } ++ ++ /// Domain model for HTTP connection configuration to external connectors ++ #[derive(Clone, Debug)] ++ pub struct DomainConnectionConfig { ++ /// Base URL of the connector endpoint ++ pub base_url: Url, ++ /// Path to append to the base URL for the specific endpoint ++ pub endpoint_path: String, ++ /// HTTP method to use for the request ++ pub http_method: HttpMethod, ++ /// HTTP headers to include in the request (values are masked for security) ++ pub headers: HashMap>, ++ /// Optional proxy URL for routing the request through a proxy server ++ pub proxy_url: Option, ++ /// Optional client certificate for mutual TLS authentication (masked) ++ pub client_cert: Option>, ++ /// Optional client private key for mutual TLS authentication (masked) ++ pub client_key: Option>, ++ /// Optional CA certificate for verifying the server certificate (masked) ++ pub ca_cert: Option>, ++ /// Whether to skip certificate verification (should only be true for testing) ++ pub insecure: Option, ++ /// Optional password for encrypted client certificate (masked) ++ pub cert_password: Option>, ++ /// Format of the client certificate (e.g., "PEM", "DER") ++ pub cert_format: Option, ++ /// Maximum response size in bytes (defaults to 10MB if not specified) ++ pub max_response_size: Option, ++ } ++ ++ impl From for DomainConnectionConfig { ++ fn from(config: ConnectionConfig) -> Self { ++ Self { ++ base_url: config.base_url, ++ endpoint_path: config.endpoint_path, ++ http_method: config.http_method, ++ headers: config.headers, ++ proxy_url: config.proxy_url, ++ client_cert: config.client_cert, ++ client_key: config.client_key, ++ ca_cert: config.ca_cert, ++ insecure: config.insecure, ++ cert_password: config.cert_password, ++ cert_format: config.cert_format, ++ max_response_size: config.max_response_size, ++ } ++ } ++ } ++ ++ /// Complete domain request structure for the injector service ++ #[derive(Clone, Debug)] ++ pub struct DomainInjectorRequest { ++ /// Token data retrieved from the vault for replacement ++ pub token_data: DomainTokenData, ++ /// Payload template containing token references to be processed ++ pub connector_payload: DomainConnectorPayload, ++ /// HTTP connection configuration for making the external request ++ pub connection_config: DomainConnectionConfig, ++ } ++ ++ impl From for DomainInjectorRequest { ++ fn from(request: InjectorRequest) -> Self { ++ Self { ++ token_data: request.token_data.into(), ++ connector_payload: request.connector_payload.into(), ++ connection_config: request.connection_config.into(), ++ } ++ } ++ } ++} ++ ++pub use models::*; +diff --git a/crates/router/Cargo.toml b/crates/router/Cargo.toml +index fe4bd5e3..db0486bb 100644 +--- a/crates/router/Cargo.toml ++++ b/crates/router/Cargo.toml +@@ -131,6 +131,7 @@ hyperswitch_connectors = { version = "0.1.0", path = "../hyperswitch_connectors" + hyperswitch_constraint_graph = { version = "0.1.0", path = "../hyperswitch_constraint_graph" } + hyperswitch_domain_models = { version = "0.1.0", path = "../hyperswitch_domain_models", default-features = false } + hyperswitch_interfaces = { version = "0.1.0", path = "../hyperswitch_interfaces", default-features = false } ++injector = { version = "0.1.0", path = "../injector", optional = true } + kgraph_utils = { version = "0.1.0", path = "../kgraph_utils" } + masking = { version = "0.1.0", path = "../masking" } + pm_auth = { version = "0.1.0", path = "../pm_auth", package = "pm_auth" } + +----- END CHUNK ----- \ No newline at end of file diff --git a/raw/d8/d8cefa9f4f12fd0cc6fd7847cff8f478303f0f0e.txt b/raw/d8/d8cefa9f4f12fd0cc6fd7847cff8f478303f0f0e.txt new file mode 100644 index 0000000000000000000000000000000000000000..36f9d49ef1ca4d953c67f0909d001af2481d640e --- /dev/null +++ b/raw/d8/d8cefa9f4f12fd0cc6fd7847cff8f478303f0f0e.txt @@ -0,0 +1,53 @@ +ROUTE: juspay/hyperswitch@d8cefa9f4f12fd0cc6fd7847cff8f478303f0f0e +REPO: https://github.com/juspay/hyperswitch +COMMIT: d8cefa9f4f12fd0cc6fd7847cff8f478303f0f0e +AUTHOR: github-actions <41898282+github-actions[bot]@users.noreply.github.com> +DATE: 2025-08-20T00:30:02 + +=== COMMIT === +SUBJECT: chore(version): 2025.08.20.0 + +=== FILES === +Summary: 1 files changed, +26 -0 +- CHANGELOG.md (+26 -0) + +=== PATCH === +diff --git a/CHANGELOG.md b/CHANGELOG.md +index 53def15b..61fe48a5 100644 +--- a/CHANGELOG.md ++++ b/CHANGELOG.md +@@ -4,6 +4,32 @@ All notable changes to HyperSwitch will be documented here. + + - - - + ++## 2025.08.20.0 ++ ++### Features ++ ++- Added create endpoint for dynamic_routing ([#8755](https://github.com/juspay/hyperswitch/pull/8755)) ([`58abb60`](https://github.com/juspay/hyperswitch/commit/58abb604d7a89519befa296d59506857bbdb0b8b)) ++ ++### Bug Fixes ++ ++- **connector:** [Wise] change amount conversion unit ([#8991](https://github.com/juspay/hyperswitch/pull/8991)) ([`c5174fd`](https://github.com/juspay/hyperswitch/commit/c5174fd6ed720340fcffe8715503eb4e5fcfc774)) ++- **core:** Address Deserialization issue ([#8980](https://github.com/juspay/hyperswitch/pull/8980)) ([`f76c6a7`](https://github.com/juspay/hyperswitch/commit/f76c6a7839cc21421cc38fe2cb332f99d13c6fdf)) ++ ++### Refactors ++ ++- **connector:** ++ - [Nuvei] Fix card 3ds ([#8913](https://github.com/juspay/hyperswitch/pull/8913)) ([`ba15c0f`](https://github.com/juspay/hyperswitch/commit/ba15c0f194e2e128a1304e11d45f794cd3b69cbe)) ++ - [AdyenPlatform] update required fields ([#8990](https://github.com/juspay/hyperswitch/pull/8990)) ([`72eb25f`](https://github.com/juspay/hyperswitch/commit/72eb25f074b600aa7db6c5ddab640a89f074e725)) ++- [Netcetera] Handle response deserialization error ([#8988](https://github.com/juspay/hyperswitch/pull/8988)) ([`0816699`](https://github.com/juspay/hyperswitch/commit/08166991f814c73b4217800ecdee560626b4986c)) ++ ++### Documentation ++ ++- Update connector guide ([#8739](https://github.com/juspay/hyperswitch/pull/8739)) ([`6a17a6f`](https://github.com/juspay/hyperswitch/commit/6a17a6f0f5cc0f2c5ca1ba42eb7ccff8c9d9b0b6)) ++ ++**Full Changelog:** [`2025.08.19.0...2025.08.20.0`](https://github.com/juspay/hyperswitch/compare/2025.08.19.0...2025.08.20.0) ++ ++- - - ++ + ## 2025.08.19.0 + + ### Features + +----- END CHUNK ----- \ No newline at end of file diff --git a/raw/dd/ddf1a6a5f36fcc8fd8e6a0497ee7f7ff7a5b98fa.txt b/raw/dd/ddf1a6a5f36fcc8fd8e6a0497ee7f7ff7a5b98fa.txt new file mode 100644 index 0000000000000000000000000000000000000000..a85159d31792c06e4de72ba7b20981e23274708f --- /dev/null +++ b/raw/dd/ddf1a6a5f36fcc8fd8e6a0497ee7f7ff7a5b98fa.txt @@ -0,0 +1,1378 @@ +ROUTE: juspay/hyperswitch@ddf1a6a5f36fcc8fd8e6a0497ee7f7ff7a5b98fa +REPO: https://github.com/juspay/hyperswitch +COMMIT: ddf1a6a5f36fcc8fd8e6a0497ee7f7ff7a5b98fa +AUTHOR: Anurag Thakur +DATE: 2025-08-25T09:37:21 + +=== ISSUE_AND_PR === +[PR #7942] feat(connector): Add VGS connector impls +URL: https://github.com/juspay/hyperswitch/pull/7942 +BODY: +## Type of Change + + +- [ ] Bugfix +- [x] New feature +- [ ] Enhancement +- [ ] Refactoring +- [ ] Dependency updates +- [ ] Documentation +- [ ] CI/CD + +## Description + +- Added Connector changes for VGS +- Implemented `ExternalVaultInsertFlow` and `ExternalVaultRetrieveFlow` for VGS +- This allows Payment methods to be vaulted in VGS when `is_external_vault_enabled` is set to true in profile +- Updated VGS URL in TOML files + +### Additional Changes + +- [ ] This PR modifies the API contract +- [ ] This PR modifies the database schema +- [ ] This PR modifies application configuration/environment variables + + + + +## Motivation and Context + +Closes #9023 + +## How did you test it? + + +Confirm Request: + +``` +curl --location 'http://localhost:8080/v2/payments/12345_pay_0198d09ccd8a77729274a5c3858e13f3/confirm-intent' \ +--header 'x-profile-id: pro_TVu6gSPZXAVEa2h0JCRe' \ +--header 'x-client-secret: cs_0198d09cce0774338628683873a2db9d' \ +--header 'Authorization: publishable-key=pk_dev_17e15cb3538d4bd99af971ee2d4d081f,client-secret=cs_0198d09cce0774338628683873a2db9d' \ +--header 'Content-Type: application/json' \ +--header 'api-key: pk_dev_17e15cb3538d4bd99af971ee2d4d081f' \ +--data '{ + "payment_method_data": { + "card": { + "card_cvc": "123", + "card_exp_month": "10", + "card_exp_year": "25", + "card_number": "4242424242424242", + "card_holder_name": "joseph Doe" + } + }, + "payment_method_type": "card", + "payment_method_subtype": "card", + "browser_info": { + "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36", + "accept_header": "text\\/html,application\\/xhtml+xml,application\\/xml;q=0.9,image\\/webp,image\\/apng,*\\/*;q=0.8", + "language": "en-GB", + "color_depth": 24, + "screen_height": 1440, + "screen_width": 2560, + "time_zone": -330, + "java_enabled": true, + "java_script_enabled": true, + "ip_address": "0.0.0.0" + }, + "customer_acceptance": { + "acceptance_type": "online", + "accepted_at": "2022-09-10T10:11:12Z", + "online": { + "ip_address": "123.32.25.123", + "user_agent": "Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36" + } + } + +}' +``` + +Insert Request: +image + +Insert Response: +image + + +Confirm Request: + +``` +curl --location 'http://localhost:8080/v2/payments/12345_pay_0198d09ccd8a77729274a5c3858e13f3/confirm-intent' \ +--header 'x-profile-id: pro_TVu6gSPZXAVEa2h0JCRe' \ +--header 'x-client-secret: cs_0198d09cce0774338628683873a2db9d' \ +--header 'Authorization: publishable-key=pk_dev_17e15cb3538d4bd99af971ee2d4d081f,client-secret=cs_0198d09cce0774338628683873a2db9d' \ +--header 'Content-Type: application/json' \ +--header 'api-key: pk_dev_17e15cb3538d4bd99af971ee2d4d081f' \ +--data '{ + "payment_method_data": { + "card_token": { + "card_cvc": "123" + } + }, + "payment_method_type": "card", + "payment_method_subtype": "card", + "payment_token": "token_UBCgOA3daIE4CP4pugXW" +}' +``` + + +Retrieve Request: +image + +Retrieve Response: +image + + +## Checklist + + +- [x] I formatted the code `cargo +nightly fmt --all` +- [x] I addressed lints thrown by `cargo clippy` +- [x] I reviewed the submitted code +- [ ] I added unit tests for my changes where possible +COMMENTS: +- semanticdiff-com[bot]: Review changes with  SemanticDiff +
+Changed Files +
+ +| File | Status | +| :--- | :--- | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/7942/changes#crates/router/src/core/payment_methods.rs)  [crates/router/src/core/payment\_methods\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/7942/changes#crates/router/src/core/payment_methods.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/7942/changes#crates/router/src/core/payment_methods.rs)  85% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/7942/changes#crates/router/src/types/api/connector_mapping.rs)  [crates/router/src/types/api/connector\_mapping\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/7942/changes#crates/router/src/types/api/connector_mapping.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/7942/changes#crates/router/src/types/api/connector_mapping.rs)  79% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/7942/changes#crates/router/src/types/api/feature_matrix.rs)  [crates/router/src/types/api/feature\_matrix\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/7942/changes#crates/router/src/types/api/feature_matrix.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/7942/changes#crates/router/src/types/api/feature_matrix.rs)  79% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/7942/changes#crates/router/tests/connectors/vgs.rs)  [crates/router/tests/connectors/vgs\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/7942/changes#crates/router/tests/connectors/vgs.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/7942/changes#crates/router/tests/connectors/vgs.rs)  45% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/7942/changes#crates/hyperswitch_connectors/src/default_implementations.rs)  [crates/hyperswitch\_connectors/src/default\_implementations\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/7942/changes#crates/hyperswitch_connectors/src/default_implementations.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/7942/changes#crates/hyperswitch_connectors/src/default_implementations.rs)  23% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/7942/changes#crates/hyperswitch_connectors/src/connectors/vgs/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/vgs/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/7942/changes#crates/hyperswitch_connectors/src/connectors/vgs/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/7942/changes#crates/hyperswitch_connectors/src/connectors/vgs/transformers.rs)  20% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/7942/changes#crates/hyperswitch_connectors/src/connectors/vgs.rs)  [crates/hyperswitch\_connectors/src/connectors/vgs\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/7942/changes#crates/hyperswitch_connectors/src/connectors/vgs.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/7942/changes#crates/hyperswitch_connectors/src/connectors/vgs.rs)  9% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/7942/changes#config/config.example.toml)  [config/config\.example\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/7942/changes#config/config.example.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/7942/changes#config/deployments/integration_test.toml)  [config/deployments/integration\_test\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/7942/changes#config/deployments/integration_test.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/7942/changes#config/deployments/production.toml)  [config/deployments/production\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/7942/changes#config/deployments/production.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/7942/changes#config/deployments/sandbox.toml)  [config/deployments/sandbox\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/7942/changes#config/deployments/sandbox.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/7942/changes#config/development.toml)  [config/development\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/7942/changes#config/development.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/7942/changes#config/docker_compose.toml)  [config/docker\_compose\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/7942/changes#config/docker_compose.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/7942/changes#loadtest/config/development.toml)  [loadtest/config/development\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/7942/changes#loadtest/config/development.toml) | Unsupported file format | + +
+- Sakilmostak [crates/hyperswitch_connectors/src/connectors/vgs/transformers.rs:83]: Nit: Handle for signature key as well + +=== COMMIT === +SUBJECT: feat(connector): Add VGS connector impls (#7942) + +=== FILES === +Summary: 14 files changed, +254 -497 +- config/config.example.toml (+1 -1) +- config/deployments/integration_test.toml (+1 -1) +- config/deployments/production.toml (+1 -1) +- config/deployments/sandbox.toml (+1 -1) +- config/development.toml (+1 -1) +- config/docker_compose.toml (+1 -1) +- crates/hyperswitch_connectors/src/connectors/vgs.rs (+84 -308) +- crates/hyperswitch_connectors/src/connectors/vgs/transformers.rs (+124 -146) +- crates/hyperswitch_connectors/src/default_implementations.rs (+0 -3) +- crates/router/src/core/payment_methods.rs (+36 -30) +- crates/router/src/types/api/connector_mapping.rs (+1 -1) +- crates/router/src/types/api/feature_matrix.rs (+1 -1) +- crates/router/tests/connectors/vgs.rs (+1 -1) +- loadtest/config/development.toml (+1 -1) + +=== PATCH === +diff --git a/config/config.example.toml b/config/config.example.toml +index eb976ce8..0467346e 100644 +--- a/config/config.example.toml ++++ b/config/config.example.toml +@@ -309,7 +309,7 @@ trustpayments.base_url = "https://webservices.securetrading.net/" + trustpay.base_url_bank_redirects = "https://aapi.trustpay.eu/" + tsys.base_url = "https://stagegw.transnox.com/" + unified_authentication_service.base_url = "http://localhost:8000" +-vgs.base_url = "https://sandbox.vault-api.verygoodvault.com" ++vgs.base_url = "https://api.sandbox.verygoodvault.com/" + volt.base_url = "https://api.sandbox.volt.io/" + wellsfargo.base_url = "https://apitest.cybersource.com/" + wellsfargopayout.base_url = "https://api-sandbox.wellsfargo.com/" +diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml +index 7ebb3e10..a7dc0f04 100644 +--- a/config/deployments/integration_test.toml ++++ b/config/deployments/integration_test.toml +@@ -144,7 +144,7 @@ trustpay.base_url = "https://test-tpgw.trustpay.eu/" + trustpayments.base_url = "https://webservices.securetrading.net/" + trustpay.base_url_bank_redirects = "https://aapi.trustpay.eu/" + tsys.base_url = "https://stagegw.transnox.com/" +-vgs.base_url = "https://sandbox.vault-api.verygoodvault.com" ++vgs.base_url = "https://api.sandbox.verygoodvault.com/" + volt.base_url = "https://api.sandbox.volt.io/" + wellsfargo.base_url = "https://apitest.cybersource.com/" + wellsfargopayout.base_url = "https://api-sandbox.wellsfargo.com/" +diff --git a/config/deployments/production.toml b/config/deployments/production.toml +index 3cb914fd..07fc2b06 100644 +--- a/config/deployments/production.toml ++++ b/config/deployments/production.toml +@@ -148,7 +148,7 @@ trustpay.base_url = "https://tpgw.trustpay.eu/" + trustpayments.base_url = "https://webservices.securetrading.net/" + trustpay.base_url_bank_redirects = "https://aapi.trustpay.eu/" + tsys.base_url = "https://gateway.transit-pass.com/" +-vgs.base_url = "https://sandbox.vault-api.verygoodvault.com" ++vgs.base_url = "https://api.live.verygoodvault.com/" + volt.base_url = "https://api.volt.io/" + wellsfargo.base_url = "https://api.cybersource.com/" + wellsfargopayout.base_url = "https://api.wellsfargo.com/" +diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml +index b91df6cf..dbbe67f0 100644 +--- a/config/deployments/sandbox.toml ++++ b/config/deployments/sandbox.toml +@@ -148,7 +148,7 @@ trustpay.base_url = "https://test-tpgw.trustpay.eu/" + trustpayments.base_url = "https://webservices.securetrading.net/" + trustpay.base_url_bank_redirects = "https://aapi.trustpay.eu/" + tsys.base_url = "https://stagegw.transnox.com/" +-vgs.base_url = "https://sandbox.vault-api.verygoodvault.com" ++vgs.base_url = "https://api.sandbox.verygoodvault.com/" + volt.base_url = "https://api.sandbox.volt.io/" + wellsfargo.base_url = "https://apitest.cybersource.com/" + wellsfargopayout.base_url = "https://api-sandbox.wellsfargo.com/" +diff --git a/config/development.toml b/config/development.toml +index 02a5dce3..0a2caf35 100644 +--- a/config/development.toml ++++ b/config/development.toml +@@ -355,7 +355,7 @@ trustpay.base_url = "https://test-tpgw.trustpay.eu/" + trustpayments.base_url = "https://webservices.securetrading.net/" + tsys.base_url = "https://stagegw.transnox.com/" + unified_authentication_service.base_url = "http://localhost:8000/" +-vgs.base_url = "https://sandbox.vault-api.verygoodvault.com" ++vgs.base_url = "https://api.sandbox.verygoodvault.com/" + volt.base_url = "https://api.sandbox.volt.io/" + wellsfargo.base_url = "https://apitest.cybersource.com/" + wellsfargopayout.base_url = "https://api-sandbox.wellsfargo.com/" +diff --git a/config/docker_compose.toml b/config/docker_compose.toml +index c60a2b03..5c753b91 100644 +--- a/config/docker_compose.toml ++++ b/config/docker_compose.toml +@@ -235,7 +235,7 @@ trustpayments.base_url = "https://webservices.securetrading.net/" + trustpay.base_url_bank_redirects = "https://aapi.trustpay.eu/" + tsys.base_url = "https://stagegw.transnox.com/" + unified_authentication_service.base_url = "http://localhost:8000" +-vgs.base_url = "https://sandbox.vault-api.verygoodvault.com" ++vgs.base_url = "https://api.sandbox.verygoodvault.com/" + volt.base_url = "https://api.sandbox.volt.io/" + wellsfargo.base_url = "https://apitest.cybersource.com/" + wellsfargopayout.base_url = "https://api-sandbox.wellsfargo.com/" +diff --git a/crates/hyperswitch_connectors/src/connectors/vgs.rs b/crates/hyperswitch_connectors/src/connectors/vgs.rs +index 68751d6e..d7bdf452 100644 +--- a/crates/hyperswitch_connectors/src/connectors/vgs.rs ++++ b/crates/hyperswitch_connectors/src/connectors/vgs.rs +@@ -1,10 +1,10 @@ + pub mod transformers; + ++use base64::Engine; + use common_utils::{ + errors::CustomResult, + ext_traits::BytesExt, + request::{Method, Request, RequestBuilder, RequestContent}, +- types::{AmountConvertor, StringMinorUnit, StringMinorUnitForConnector}, + }; + use error_stack::{report, ResultExt}; + use hyperswitch_domain_models::{ +@@ -13,17 +13,15 @@ use hyperswitch_domain_models::{ + access_token_auth::AccessTokenAuth, + payments::{Authorize, Capture, PSync, PaymentMethodToken, Session, SetupMandate, Void}, + refunds::{Execute, RSync}, ++ ExternalVaultInsertFlow, ExternalVaultRetrieveFlow, + }, + router_request_types::{ + AccessTokenRequestData, PaymentMethodTokenizationData, PaymentsAuthorizeData, + PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData, +- RefundsData, SetupMandateRequestData, +- }, +- router_response_types::{PaymentsResponseData, RefundsResponseData}, +- types::{ +- PaymentsAuthorizeRouterData, PaymentsCaptureRouterData, PaymentsSyncRouterData, +- RefundSyncRouterData, RefundsRouterData, ++ RefundsData, SetupMandateRequestData, VaultRequestData, + }, ++ router_response_types::{PaymentsResponseData, RefundsResponseData, VaultResponseData}, ++ types::VaultRouterData, + }; + use hyperswitch_interfaces::{ + api::{ +@@ -36,23 +34,13 @@ use hyperswitch_interfaces::{ + types::{self, Response}, + webhooks, + }; +-use masking::{ExposeInterface, Mask}; ++use masking::Mask; + use transformers as vgs; + +-use crate::{constants::headers, types::ResponseRouterData, utils}; ++use crate::{constants::headers, types::ResponseRouterData}; + + #[derive(Clone)] +-pub struct Vgs { +- amount_converter: &'static (dyn AmountConvertor + Sync), +-} +- +-impl Vgs { +- pub fn new() -> &'static Self { +- &Self { +- amount_converter: &StringMinorUnitForConnector, +- } +- } +-} ++pub struct Vgs; + + impl api::Payment for Vgs {} + impl api::PaymentSession for Vgs {} +@@ -66,6 +54,9 @@ impl api::Refund for Vgs {} + impl api::RefundExecute for Vgs {} + impl api::RefundSync for Vgs {} + impl api::PaymentToken for Vgs {} ++impl api::ExternalVaultInsert for Vgs {} ++impl api::ExternalVault for Vgs {} ++impl api::ExternalVaultRetrieve for Vgs {} + + impl ConnectorIntegration + for Vgs +@@ -82,13 +73,21 @@ where + req: &RouterData, + _connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { +- let mut header = vec![( +- headers::CONTENT_TYPE.to_string(), +- self.get_content_type().to_string().into(), +- )]; +- let mut api_key = self.get_auth_header(&req.connector_auth_type)?; +- header.append(&mut api_key); +- Ok(header) ++ let auth = vgs::VgsAuthType::try_from(&req.connector_auth_type) ++ .change_context(errors::ConnectorError::FailedToObtainAuthType)?; ++ let auth_value = auth ++ .username ++ .zip(auth.password) ++ .map(|(username, password)| { ++ format!( ++ "Basic {}", ++ common_utils::consts::BASE64_ENGINE.encode(format!("{username}:{password}")) ++ ) ++ }); ++ Ok(vec![( ++ headers::AUTHORIZATION.to_string(), ++ auth_value.into_masked(), ++ )]) + } + } + +@@ -111,14 +110,9 @@ impl ConnectorCommon for Vgs { + + fn get_auth_header( + &self, +- auth_type: &ConnectorAuthType, ++ _auth_type: &ConnectorAuthType, + ) -> CustomResult)>, errors::ConnectorError> { +- let auth = vgs::VgsAuthType::try_from(auth_type) +- .change_context(errors::ConnectorError::FailedToObtainAuthType)?; +- Ok(vec![( +- headers::AUTHORIZATION.to_string(), +- auth.username.expose().into_masked(), +- )]) ++ Ok(vec![]) + } + + fn build_error_response( +@@ -134,11 +128,16 @@ impl ConnectorCommon for Vgs { + event_builder.map(|i| i.set_response_body(&response)); + router_env::logger::info!(connector_response=?response); + ++ let error = response ++ .errors ++ .first() ++ .ok_or(errors::ConnectorError::ResponseHandlingFailed)?; ++ + Ok(ErrorResponse { + status_code: res.status_code, +- code: response.code, +- message: response.message, +- reason: response.reason, ++ code: error.code.clone(), ++ message: error.code.clone(), ++ reason: error.detail.clone(), + attempt_status: None, + connector_transaction_id: None, + network_decline_code: None, +@@ -149,212 +148,68 @@ impl ConnectorCommon for Vgs { + } + } + +-impl ConnectorValidation for Vgs { +- //TODO: implement functions when support enabled +-} ++impl ConnectorValidation for Vgs {} + +-impl ConnectorIntegration for Vgs { +- //TODO: implement sessions flow +-} ++impl ConnectorIntegration for Vgs {} + + impl ConnectorIntegration for Vgs {} + + impl ConnectorIntegration for Vgs {} + +-impl ConnectorIntegration for Vgs { +- fn get_headers( +- &self, +- req: &PaymentsAuthorizeRouterData, +- connectors: &Connectors, +- ) -> CustomResult)>, errors::ConnectorError> { +- self.build_headers(req, connectors) +- } +- +- fn get_content_type(&self) -> &'static str { +- self.common_get_content_type() +- } ++impl ConnectorIntegration for Vgs {} + +- fn get_url( +- &self, +- _req: &PaymentsAuthorizeRouterData, +- _connectors: &Connectors, +- ) -> CustomResult { +- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into()) +- } +- +- fn get_request_body( +- &self, +- req: &PaymentsAuthorizeRouterData, +- _connectors: &Connectors, +- ) -> CustomResult { +- let amount = utils::convert_amount( +- self.amount_converter, +- req.request.minor_amount, +- req.request.currency, +- )?; +- +- let connector_router_data = vgs::VgsRouterData::from((amount, req)); +- let connector_req = vgs::VgsPaymentsRequest::try_from(&connector_router_data)?; +- Ok(RequestContent::Json(Box::new(connector_req))) +- } +- +- fn build_request( +- &self, +- req: &PaymentsAuthorizeRouterData, +- connectors: &Connectors, +- ) -> CustomResult, errors::ConnectorError> { +- Ok(Some( +- RequestBuilder::new() +- .method(Method::Post) +- .url(&types::PaymentsAuthorizeType::get_url( +- self, req, connectors, +- )?) +- .attach_default_headers() +- .headers(types::PaymentsAuthorizeType::get_headers( +- self, req, connectors, +- )?) +- .set_body(types::PaymentsAuthorizeType::get_request_body( +- self, req, connectors, +- )?) +- .build(), +- )) +- } ++impl ConnectorIntegration for Vgs {} + +- fn handle_response( +- &self, +- data: &PaymentsAuthorizeRouterData, +- event_builder: Option<&mut ConnectorEvent>, +- res: Response, +- ) -> CustomResult { +- let response: vgs::VgsPaymentsResponse = res +- .response +- .parse_struct("Vgs PaymentsAuthorizeResponse") +- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; +- event_builder.map(|i| i.set_response_body(&response)); +- router_env::logger::info!(connector_response=?response); +- RouterData::try_from(ResponseRouterData { +- response, +- data: data.clone(), +- http_code: res.status_code, +- }) +- } ++impl ConnectorIntegration for Vgs {} + +- fn get_error_response( +- &self, +- res: Response, +- event_builder: Option<&mut ConnectorEvent>, +- ) -> CustomResult { +- self.build_error_response(res, event_builder) +- } +-} ++impl ConnectorIntegration for Vgs {} + +-impl ConnectorIntegration for Vgs { +- fn get_headers( +- &self, +- req: &PaymentsSyncRouterData, +- connectors: &Connectors, +- ) -> CustomResult)>, errors::ConnectorError> { +- self.build_headers(req, connectors) +- } ++impl ConnectorIntegration for Vgs {} + +- fn get_content_type(&self) -> &'static str { +- self.common_get_content_type() +- } ++impl ConnectorIntegration for Vgs {} + ++impl ConnectorIntegration for Vgs { + fn get_url( + &self, +- _req: &PaymentsSyncRouterData, +- _connectors: &Connectors, +- ) -> CustomResult { +- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into()) +- } +- +- fn build_request( +- &self, +- req: &PaymentsSyncRouterData, ++ _req: &VaultRouterData, + connectors: &Connectors, +- ) -> CustomResult, errors::ConnectorError> { +- Ok(Some( +- RequestBuilder::new() +- .method(Method::Get) +- .url(&types::PaymentsSyncType::get_url(self, req, connectors)?) +- .attach_default_headers() +- .headers(types::PaymentsSyncType::get_headers(self, req, connectors)?) +- .build(), +- )) +- } +- +- fn handle_response( +- &self, +- data: &PaymentsSyncRouterData, +- event_builder: Option<&mut ConnectorEvent>, +- res: Response, +- ) -> CustomResult { +- let response: vgs::VgsPaymentsResponse = res +- .response +- .parse_struct("vgs PaymentsSyncResponse") +- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; +- event_builder.map(|i| i.set_response_body(&response)); +- router_env::logger::info!(connector_response=?response); +- RouterData::try_from(ResponseRouterData { +- response, +- data: data.clone(), +- http_code: res.status_code, +- }) ++ ) -> CustomResult { ++ Ok(format!("{}aliases", self.base_url(connectors))) + } + +- fn get_error_response( +- &self, +- res: Response, +- event_builder: Option<&mut ConnectorEvent>, +- ) -> CustomResult { +- self.build_error_response(res, event_builder) +- } +-} +- +-impl ConnectorIntegration for Vgs { + fn get_headers( + &self, +- req: &PaymentsCaptureRouterData, ++ req: &VaultRouterData, + connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { + self.build_headers(req, connectors) + } + +- fn get_content_type(&self) -> &'static str { +- self.common_get_content_type() +- } +- +- fn get_url( +- &self, +- _req: &PaymentsCaptureRouterData, +- _connectors: &Connectors, +- ) -> CustomResult { +- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into()) +- } +- + fn get_request_body( + &self, +- _req: &PaymentsCaptureRouterData, ++ req: &VaultRouterData, + _connectors: &Connectors, + ) -> CustomResult { +- Err(errors::ConnectorError::NotImplemented("get_request_body method".to_string()).into()) ++ let connector_req = vgs::VgsInsertRequest::try_from(req)?; ++ Ok(RequestContent::Json(Box::new(connector_req))) + } + + fn build_request( + &self, +- req: &PaymentsCaptureRouterData, ++ req: &VaultRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { + Ok(Some( + RequestBuilder::new() + .method(Method::Post) +- .url(&types::PaymentsCaptureType::get_url(self, req, connectors)?) ++ .url(&types::ExternalVaultInsertType::get_url( ++ self, req, connectors, ++ )?) + .attach_default_headers() +- .headers(types::PaymentsCaptureType::get_headers( ++ .headers(types::ExternalVaultInsertType::get_headers( + self, req, connectors, + )?) +- .set_body(types::PaymentsCaptureType::get_request_body( ++ .set_body(types::ExternalVaultInsertType::get_request_body( + self, req, connectors, + )?) + .build(), +@@ -363,13 +218,13 @@ impl ConnectorIntegration fo + + fn handle_response( + &self, +- data: &PaymentsCaptureRouterData, ++ data: &VaultRouterData, + event_builder: Option<&mut ConnectorEvent>, + res: Response, +- ) -> CustomResult { +- let response: vgs::VgsPaymentsResponse = res ++ ) -> CustomResult, errors::ConnectorError> { ++ let response: vgs::VgsInsertResponse = res + .response +- .parse_struct("Vgs PaymentsCaptureResponse") ++ .parse_struct("VgsInsertResponse") + .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; + event_builder.map(|i| i.set_response_body(&response)); + router_env::logger::info!(connector_response=?response); +@@ -389,125 +244,46 @@ impl ConnectorIntegration fo + } + } + +-impl ConnectorIntegration for Vgs {} +- +-impl ConnectorIntegration for Vgs { +- fn get_headers( +- &self, +- req: &RefundsRouterData, +- connectors: &Connectors, +- ) -> CustomResult)>, errors::ConnectorError> { +- self.build_headers(req, connectors) +- } +- +- fn get_content_type(&self) -> &'static str { +- self.common_get_content_type() +- } +- ++impl ConnectorIntegration for Vgs { + fn get_url( + &self, +- _req: &RefundsRouterData, +- _connectors: &Connectors, ++ req: &VaultRouterData, ++ connectors: &Connectors, + ) -> CustomResult { +- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into()) +- } +- +- fn get_request_body( +- &self, +- req: &RefundsRouterData, +- _connectors: &Connectors, +- ) -> CustomResult { +- let refund_amount = utils::convert_amount( +- self.amount_converter, +- req.request.minor_refund_amount, +- req.request.currency, ++ let alias = req.request.connector_vault_id.clone().ok_or( ++ errors::ConnectorError::MissingRequiredField { ++ field_name: "connector_vault_id", ++ }, + )?; + +- let connector_router_data = vgs::VgsRouterData::from((refund_amount, req)); +- let connector_req = vgs::VgsRefundRequest::try_from(&connector_router_data)?; +- Ok(RequestContent::Json(Box::new(connector_req))) +- } +- +- fn build_request( +- &self, +- req: &RefundsRouterData, +- connectors: &Connectors, +- ) -> CustomResult, errors::ConnectorError> { +- let request = RequestBuilder::new() +- .method(Method::Post) +- .url(&types::RefundExecuteType::get_url(self, req, connectors)?) +- .attach_default_headers() +- .headers(types::RefundExecuteType::get_headers( +- self, req, connectors, +- )?) +- .set_body(types::RefundExecuteType::get_request_body( +- self, req, connectors, +- )?) +- .build(); +- Ok(Some(request)) +- } +- +- fn handle_response( +- &self, +- data: &RefundsRouterData, +- event_builder: Option<&mut ConnectorEvent>, +- res: Response, +- ) -> CustomResult, errors::ConnectorError> { +- let response: vgs::RefundResponse = res +- .response +- .parse_struct("vgs RefundResponse") +- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; +- event_builder.map(|i| i.set_response_body(&response)); +- router_env::logger::info!(connector_response=?response); +- RouterData::try_from(ResponseRouterData { +- response, +- data: data.clone(), +- http_code: res.status_code, +- }) +- } +- +- fn get_error_response( +- &self, +- res: Response, +- event_builder: Option<&mut ConnectorEvent>, +- ) -> CustomResult { +- self.build_error_response(res, event_builder) ++ Ok(format!("{}aliases/{alias}", self.base_url(connectors))) + } +-} + +-impl ConnectorIntegration for Vgs { + fn get_headers( + &self, +- req: &RefundSyncRouterData, ++ req: &VaultRouterData, + connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { + self.build_headers(req, connectors) + } + +- fn get_content_type(&self) -> &'static str { +- self.common_get_content_type() +- } +- +- fn get_url( +- &self, +- _req: &RefundSyncRouterData, +- _connectors: &Connectors, +- ) -> CustomResult { +- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into()) ++ fn get_http_method(&self) -> Method { ++ Method::Get + } + + fn build_request( + &self, +- req: &RefundSyncRouterData, ++ req: &VaultRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { + Ok(Some( + RequestBuilder::new() + .method(Method::Get) +- .url(&types::RefundSyncType::get_url(self, req, connectors)?) ++ .url(&types::ExternalVaultRetrieveType::get_url( ++ self, req, connectors, ++ )?) + .attach_default_headers() +- .headers(types::RefundSyncType::get_headers(self, req, connectors)?) +- .set_body(types::RefundSyncType::get_request_body( ++ .headers(types::ExternalVaultRetrieveType::get_headers( + self, req, connectors, + )?) + .build(), +@@ -516,14 +292,14 @@ impl ConnectorIntegration for Vgs { + + fn handle_response( + &self, +- data: &RefundSyncRouterData, ++ data: &VaultRouterData, + event_builder: Option<&mut ConnectorEvent>, + res: Response, +- ) -> CustomResult { +- let response: vgs::RefundResponse = res +- .response +- .parse_struct("vgs RefundSyncResponse") +- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; ++ ) -> CustomResult, errors::ConnectorError> { ++ let response: vgs::VgsRetrieveResponse = ++ res.response ++ .parse_struct("VgsRetrieveResponse") ++ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; + event_builder.map(|i| i.set_response_body(&response)); + router_env::logger::info!(connector_response=?response); + RouterData::try_from(ResponseRouterData { +diff --git a/crates/hyperswitch_connectors/src/connectors/vgs/transformers.rs b/crates/hyperswitch_connectors/src/connectors/vgs/transformers.rs +index f30a455e..4915e2da 100644 +--- a/crates/hyperswitch_connectors/src/connectors/vgs/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/vgs/transformers.rs +@@ -1,23 +1,22 @@ +-use common_enums::enums; +-use common_utils::types::StringMinorUnit; ++use common_utils::{ ++ ext_traits::{Encode, StringExt}, ++ types::StringMinorUnit, ++}; ++use error_stack::ResultExt; + use hyperswitch_domain_models::{ +- payment_method_data::PaymentMethodData, + router_data::{ConnectorAuthType, RouterData}, +- router_flow_types::refunds::{Execute, RSync}, +- router_request_types::ResponseId, +- router_response_types::{PaymentsResponseData, RefundsResponseData}, +- types::{PaymentsAuthorizeRouterData, RefundsRouterData}, ++ router_flow_types::{ExternalVaultInsertFlow, ExternalVaultRetrieveFlow}, ++ router_request_types::VaultRequestData, ++ router_response_types::VaultResponseData, ++ types::VaultRouterData, ++ vault::PaymentMethodVaultingData, + }; + use hyperswitch_interfaces::errors; +-use masking::Secret; ++use masking::{ExposeInterface, Secret}; + use serde::{Deserialize, Serialize}; + +-use crate::{ +- types::{RefundsResponseRouterData, ResponseRouterData}, +- utils::PaymentsAuthorizeRequestData, +-}; ++use crate::types::ResponseRouterData; + +-//TODO: Fill the struct with respective fields + pub struct VgsRouterData { + pub amount: StringMinorUnit, // The type of amount that a connector accepts, for example, String, i64, f64, etc. + pub router_data: T, +@@ -25,7 +24,6 @@ pub struct VgsRouterData { + + impl From<(StringMinorUnit, T)> for VgsRouterData { + fn from((amount, item): (StringMinorUnit, T)) -> Self { +- //Todo : use utils to convert the amount to the type of amount that a connector accepts + Self { + amount, + router_data: item, +@@ -33,49 +31,48 @@ impl From<(StringMinorUnit, T)> for VgsRouterData { + } + } + +-//TODO: Fill the struct with respective fields ++const VGS_FORMAT: &str = "UUID"; ++const VGS_CLASSIFIER: &str = "data"; ++ + #[derive(Default, Debug, Serialize, PartialEq)] +-pub struct VgsPaymentsRequest { +- amount: StringMinorUnit, +- card: VgsCard, ++pub struct VgsTokenRequestItem { ++ value: Secret, ++ classifiers: Vec, ++ format: String, + } + +-#[derive(Default, Debug, Serialize, Eq, PartialEq)] +-pub struct VgsCard { +- number: cards::CardNumber, +- expiry_month: Secret, +- expiry_year: Secret, +- cvc: Secret, +- complete: bool, ++#[derive(Default, Debug, Serialize, PartialEq)] ++pub struct VgsInsertRequest { ++ data: Vec, + } + +-impl TryFrom<&VgsRouterData<&PaymentsAuthorizeRouterData>> for VgsPaymentsRequest { ++impl TryFrom<&VaultRouterData> for VgsInsertRequest { + type Error = error_stack::Report; +- fn try_from(item: &VgsRouterData<&PaymentsAuthorizeRouterData>) -> Result { +- match item.router_data.request.payment_method_data.clone() { +- PaymentMethodData::Card(req_card) => { +- let card = VgsCard { +- number: req_card.card_number, +- expiry_month: req_card.card_exp_month, +- expiry_year: req_card.card_exp_year, +- cvc: req_card.card_cvc, +- complete: item.router_data.request.is_auto_capture()?, +- }; ++ fn try_from(item: &VaultRouterData) -> Result { ++ match item.request.payment_method_vaulting_data.clone() { ++ Some(PaymentMethodVaultingData::Card(req_card)) => { ++ let stringified_card = req_card ++ .encode_to_string_of_json() ++ .change_context(errors::ConnectorError::RequestEncodingFailed)?; ++ + Ok(Self { +- amount: item.amount.clone(), +- card, ++ data: vec![VgsTokenRequestItem { ++ value: Secret::new(stringified_card), ++ classifiers: vec![VGS_CLASSIFIER.to_string()], ++ format: VGS_FORMAT.to_string(), ++ }], + }) + } +- _ => Err(errors::ConnectorError::NotImplemented("Payment method".to_string()).into()), ++ _ => Err(errors::ConnectorError::NotImplemented( ++ "Payment method apart from card".to_string(), ++ ) ++ .into()), + } + } + } + +-//TODO: Fill the struct with respective fields +-// Auth Struct + pub struct VgsAuthType { + pub(super) username: Secret, +- #[allow(dead_code)] + pub(super) password: Secret, + } + +@@ -83,7 +80,7 @@ impl TryFrom<&ConnectorAuthType> for VgsAuthType { + type Error = error_stack::Report; + fn try_from(auth_type: &ConnectorAuthType) -> Result { + match auth_type { +- ConnectorAuthType::SignatureKey { api_key, key1, .. } => Ok(Self { ++ ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self { + username: api_key.to_owned(), + password: key1.to_owned(), + }), +@@ -91,139 +88,120 @@ impl TryFrom<&ConnectorAuthType> for VgsAuthType { + } + } + } +-// PaymentsResponse +-//TODO: Append the remaining status flags +-#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)] +-#[serde(rename_all = "lowercase")] +-pub enum VgsPaymentStatus { +- Succeeded, +- Failed, +- #[default] +- Processing, ++ ++#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)] ++pub struct VgsAliasItem { ++ alias: String, ++ format: String, + } + +-impl From for common_enums::AttemptStatus { +- fn from(item: VgsPaymentStatus) -> Self { +- match item { +- VgsPaymentStatus::Succeeded => Self::Charged, +- VgsPaymentStatus::Failed => Self::Failure, +- VgsPaymentStatus::Processing => Self::Authorizing, +- } +- } ++#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)] ++pub struct VgsTokenResponseItem { ++ value: Secret, ++ classifiers: Vec, ++ aliases: Vec, ++ created_at: Option, ++ storage: String, + } + +-//TODO: Fill the struct with respective fields + #[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)] +-pub struct VgsPaymentsResponse { +- status: VgsPaymentStatus, +- id: String, ++pub struct VgsInsertResponse { ++ data: Vec, + } + +-impl TryFrom> +- for RouterData ++#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)] ++pub struct VgsRetrieveResponse { ++ data: Vec, ++} ++ ++impl ++ TryFrom< ++ ResponseRouterData< ++ ExternalVaultInsertFlow, ++ VgsInsertResponse, ++ VaultRequestData, ++ VaultResponseData, ++ >, ++ > for RouterData + { + type Error = error_stack::Report; + fn try_from( +- item: ResponseRouterData, ++ item: ResponseRouterData< ++ ExternalVaultInsertFlow, ++ VgsInsertResponse, ++ VaultRequestData, ++ VaultResponseData, ++ >, + ) -> Result { ++ let vgs_alias = item ++ .response ++ .data ++ .first() ++ .and_then(|val| val.aliases.first()) ++ .ok_or(errors::ConnectorError::ResponseHandlingFailed)?; ++ + Ok(Self { +- status: common_enums::AttemptStatus::from(item.response.status), +- response: Ok(PaymentsResponseData::TransactionResponse { +- resource_id: ResponseId::ConnectorTransactionId(item.response.id), +- redirection_data: Box::new(None), +- mandate_reference: Box::new(None), +- connector_metadata: None, +- network_txn_id: None, +- connector_response_reference_id: None, +- incremental_authorization_allowed: None, +- charges: None, ++ status: common_enums::AttemptStatus::Started, ++ response: Ok(VaultResponseData::ExternalVaultInsertResponse { ++ connector_vault_id: vgs_alias.alias.clone(), ++ fingerprint_id: vgs_alias.alias.clone(), + }), + ..item.data + }) + } + } + +-//TODO: Fill the struct with respective fields +-// REFUND : +-// Type definition for RefundRequest +-#[derive(Default, Debug, Serialize)] +-pub struct VgsRefundRequest { +- pub amount: StringMinorUnit, +-} +- +-impl TryFrom<&VgsRouterData<&RefundsRouterData>> for VgsRefundRequest { +- type Error = error_stack::Report; +- fn try_from(item: &VgsRouterData<&RefundsRouterData>) -> Result { +- Ok(Self { +- amount: item.amount.to_owned(), +- }) +- } +-} +- +-// Type definition for Refund Response +- +-#[allow(dead_code)] +-#[derive(Debug, Serialize, Default, Deserialize, Clone)] +-pub enum RefundStatus { +- Succeeded, +- Failed, +- #[default] +- Processing, +-} +- +-impl From for enums::RefundStatus { +- fn from(item: RefundStatus) -> Self { +- match item { +- RefundStatus::Succeeded => Self::Success, +- RefundStatus::Failed => Self::Failure, +- RefundStatus::Processing => Self::Pending, +- //TODO: Review mapping +- } +- } +-} +- +-//TODO: Fill the struct with respective fields +-#[derive(Default, Debug, Clone, Serialize, Deserialize)] +-pub struct RefundResponse { +- id: String, +- status: RefundStatus, +-} +- +-impl TryFrom> for RefundsRouterData { ++impl ++ TryFrom< ++ ResponseRouterData< ++ ExternalVaultRetrieveFlow, ++ VgsRetrieveResponse, ++ VaultRequestData, ++ VaultResponseData, ++ >, ++ > for RouterData ++{ + type Error = error_stack::Report; + fn try_from( +- item: RefundsResponseRouterData, ++ item: ResponseRouterData< ++ ExternalVaultRetrieveFlow, ++ VgsRetrieveResponse, ++ VaultRequestData, ++ VaultResponseData, ++ >, + ) -> Result { ++ let token_response_item = item ++ .response ++ .data ++ .first() ++ .ok_or(errors::ConnectorError::ResponseHandlingFailed)?; ++ ++ let card_detail: api_models::payment_methods::CardDetail = token_response_item ++ .value ++ .clone() ++ .expose() ++ .parse_struct("CardDetail") ++ .change_context(errors::ConnectorError::ParsingFailed)?; ++ + Ok(Self { +- response: Ok(RefundsResponseData { +- connector_refund_id: item.response.id.to_string(), +- refund_status: enums::RefundStatus::from(item.response.status), ++ status: common_enums::AttemptStatus::Started, ++ response: Ok(VaultResponseData::ExternalVaultRetrieveResponse { ++ vault_data: PaymentMethodVaultingData::Card(card_detail), + }), + ..item.data + }) + } + } + +-impl TryFrom> for RefundsRouterData { +- type Error = error_stack::Report; +- fn try_from( +- item: RefundsResponseRouterData, +- ) -> Result { +- Ok(Self { +- response: Ok(RefundsResponseData { +- connector_refund_id: item.response.id.to_string(), +- refund_status: enums::RefundStatus::from(item.response.status), +- }), +- ..item.data +- }) +- } ++#[derive(Default, Debug, Serialize, Deserialize, PartialEq)] ++pub struct VgsErrorItem { ++ pub status: u16, ++ pub code: String, ++ pub detail: Option, + } + +-//TODO: Fill the struct with respective fields + #[derive(Default, Debug, Serialize, Deserialize, PartialEq)] + pub struct VgsErrorResponse { +- pub status_code: u16, +- pub code: String, +- pub message: String, +- pub reason: Option, ++ pub errors: Vec, ++ pub trace_id: String, + } +diff --git a/crates/hyperswitch_connectors/src/default_implementations.rs b/crates/hyperswitch_connectors/src/default_implementations.rs +index 6b8b4948..f18b6591 100644 +--- a/crates/hyperswitch_connectors/src/default_implementations.rs ++++ b/crates/hyperswitch_connectors/src/default_implementations.rs +@@ -6975,7 +6975,6 @@ default_imp_for_external_vault!( + connectors::Worldpayxml, + connectors::Wellsfargo, + connectors::Wellsfargopayout, +- connectors::Vgs, + connectors::Volt, + connectors::Xendit, + connectors::Zen, +@@ -7118,7 +7117,6 @@ default_imp_for_external_vault_insert!( + connectors::Worldpayxml, + connectors::Wellsfargo, + connectors::Wellsfargopayout, +- connectors::Vgs, + connectors::Volt, + connectors::Xendit, + connectors::Zen, +@@ -7261,7 +7259,6 @@ default_imp_for_external_vault_retrieve!( + connectors::Worldpayxml, + connectors::Wellsfargo, + connectors::Wellsfargopayout, +- connectors::Vgs, + connectors::Volt, + connectors::Xendit, + connectors::Zen, +diff --git a/crates/router/src/core/payment_methods.rs b/crates/router/src/core/payment_methods.rs +index 1ea747d8..3a072e12 100644 +--- a/crates/router/src/core/payment_methods.rs ++++ b/crates/router/src/core/payment_methods.rs +@@ -1036,11 +1036,14 @@ pub async fn create_payment_method_card_core( + .await; + + let (response, payment_method) = match vaulting_result { +- Ok(pm_types::AddVaultResponse { +- vault_id, +- fingerprint_id, +- .. +- }) => { ++ Ok(( ++ pm_types::AddVaultResponse { ++ vault_id, ++ fingerprint_id, ++ .. ++ }, ++ external_vault_source, ++ )) => { + let pm_update = create_pm_additional_data_update( + Some(&payment_method_data), + state, +@@ -1052,7 +1055,7 @@ pub async fn create_payment_method_card_core( + network_tokenization_resp, + Some(req.payment_method_type), + Some(req.payment_method_subtype), +- None, ++ external_vault_source, + ) + .await + .attach_printable("unable to create payment method data")?; +@@ -2395,7 +2398,10 @@ pub async fn vault_payment_method( + profile: &domain::Profile, + existing_vault_id: Option, + customer_id: &id_type::GlobalCustomerId, +-) -> RouterResult { ++) -> RouterResult<( ++ pm_types::AddVaultResponse, ++ Option, ++)> { + let is_external_vault_enabled = profile.is_external_vault_enabled(); + + match is_external_vault_enabled { +@@ -2427,17 +2433,17 @@ pub async fn vault_payment_method( + merchant_connector_account, + ) + .await ++ .map(|value| (value, Some(external_vault_source))) + } +- false => { +- vault_payment_method_internal( +- state, +- pmd, +- merchant_context, +- existing_vault_id, +- customer_id, +- ) +- .await +- } ++ false => vault_payment_method_internal( ++ state, ++ pmd, ++ merchant_context, ++ existing_vault_id, ++ customer_id, ++ ) ++ .await ++ .map(|value| (value, None)), + } + } + +@@ -2812,20 +2818,20 @@ pub async fn update_payment_method_core( + // cannot use async map because of problems related to lifetimes + // to overcome this, we will have to use a move closure and add some clones + Some(ref vault_request_data) => { +- Some( +- vault_payment_method( +- state, +- vault_request_data, +- merchant_context, +- profile, +- // using current vault_id for now, +- // will have to refactor this to generate new one on each vaulting later on +- current_vault_id, +- &payment_method.customer_id, +- ) +- .await +- .attach_printable("Failed to add payment method in vault")?, ++ let (vault_response, _) = vault_payment_method( ++ state, ++ vault_request_data, ++ merchant_context, ++ profile, ++ // using current vault_id for now, ++ // will have to refactor this to generate new one on each vaulting later on ++ current_vault_id, ++ &payment_method.customer_id, + ) ++ .await ++ .attach_printable("Failed to add payment method in vault")?; ++ ++ Some(vault_response) + } + None => None, + }; +diff --git a/crates/router/src/types/api/connector_mapping.rs b/crates/router/src/types/api/connector_mapping.rs +index 1298296f..5611df58 100644 +--- a/crates/router/src/types/api/connector_mapping.rs ++++ b/crates/router/src/types/api/connector_mapping.rs +@@ -437,7 +437,7 @@ impl ConnectorData { + // enums::Connector::UnifiedAuthenticationService => Ok(ConnectorEnum::Old(Box::new( + // connector::UnifiedAuthenticationService, + // ))), +- enums::Connector::Vgs => Ok(ConnectorEnum::Old(Box::new(connector::Vgs::new()))), ++ enums::Connector::Vgs => Ok(ConnectorEnum::Old(Box::new(&connector::Vgs))), + enums::Connector::Volt => Ok(ConnectorEnum::Old(Box::new(connector::Volt::new()))), + enums::Connector::Wellsfargo => { + Ok(ConnectorEnum::Old(Box::new(connector::Wellsfargo::new()))) +diff --git a/crates/router/src/types/api/feature_matrix.rs b/crates/router/src/types/api/feature_matrix.rs +index 95150d98..5896e926 100644 +--- a/crates/router/src/types/api/feature_matrix.rs ++++ b/crates/router/src/types/api/feature_matrix.rs +@@ -357,7 +357,7 @@ impl FeatureMatrixConnectorData { + // enums::Connector::UnifiedAuthenticationService => Ok(ConnectorEnum::Old(Box::new( + // connector::UnifiedAuthenticationService, + // ))), +- enums::Connector::Vgs => Ok(ConnectorEnum::Old(Box::new(connector::Vgs::new()))), ++ enums::Connector::Vgs => Ok(ConnectorEnum::Old(Box::new(&connector::Vgs))), + enums::Connector::Volt => Ok(ConnectorEnum::Old(Box::new(connector::Volt::new()))), + enums::Connector::Wellsfargo => { + Ok(ConnectorEnum::Old(Box::new(connector::Wellsfargo::new()))) +diff --git a/crates/router/tests/connectors/vgs.rs b/crates/router/tests/connectors/vgs.rs +index fb9b6bb3..70ce1045 100644 +--- a/crates/router/tests/connectors/vgs.rs ++++ b/crates/router/tests/connectors/vgs.rs +@@ -11,7 +11,7 @@ impl utils::Connector for VgsTest { + fn get_data(&self) -> types::api::ConnectorData { + use router::connector::Vgs; + utils::construct_connector_data_old( +- Box::new(Vgs::new()), ++ Box::new(&Vgs), + types::Connector::Vgs, + types::api::GetToken::Connector, + None, +diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml +index c42a880f..9c0a2efd 100644 +--- a/loadtest/config/development.toml ++++ b/loadtest/config/development.toml +@@ -202,7 +202,7 @@ trustpayments.base_url = "https://webservices.securetrading.net/" + trustpay.base_url_bank_redirects = "https://aapi.trustpay.eu/" + tsys.base_url = "https://stagegw.transnox.com/" + unified_authentication_service.base_url = "http://localhost:8000" +-vgs.base_url = "https://sandbox.vault-api.verygoodvault.com" ++vgs.base_url = "https://api.sandbox.verygoodvault.com/" + volt.base_url = "https://api.sandbox.volt.io/" + wellsfargo.base_url = "https://apitest.cybersource.com/" + wellsfargopayout.base_url = "https://api-sandbox.wellsfargo.com/" + +----- END CHUNK ----- \ No newline at end of file diff --git a/raw/e0/e01db198c7324faeaba0e0d274ba7df7274d6b64.txt b/raw/e0/e01db198c7324faeaba0e0d274ba7df7274d6b64.txt new file mode 100644 index 0000000000000000000000000000000000000000..850e80ece82c7c846756ddd2ddba867f114f8c29 --- /dev/null +++ b/raw/e0/e01db198c7324faeaba0e0d274ba7df7274d6b64.txt @@ -0,0 +1,47 @@ +ROUTE: juspay/hyperswitch@e01db198c7324faeaba0e0d274ba7df7274d6b64 +REPO: https://github.com/juspay/hyperswitch +COMMIT: e01db198c7324faeaba0e0d274ba7df7274d6b64 +AUTHOR: github-actions <41898282+github-actions[bot]@users.noreply.github.com> +DATE: 2025-08-26T00:30:51 + +=== COMMIT === +SUBJECT: chore(version): 2025.08.26.0 + +=== FILES === +Summary: 1 files changed, +20 -0 +- CHANGELOG.md (+20 -0) + +=== PATCH === +diff --git a/CHANGELOG.md b/CHANGELOG.md +index d23f1141..43e9baac 100644 +--- a/CHANGELOG.md ++++ b/CHANGELOG.md +@@ -4,6 +4,26 @@ All notable changes to HyperSwitch will be documented here. + + - - - + ++## 2025.08.26.0 ++ ++### Features ++ ++- **connector:** ++ - Add VGS connector impls ([#7942](https://github.com/juspay/hyperswitch/pull/7942)) ([`ddf1a6a`](https://github.com/juspay/hyperswitch/commit/ddf1a6a5f36fcc8fd8e6a0497ee7f7ff7a5b98fa)) ++ - [Adyenplatform] process payouts using PSP tokens ([#9040](https://github.com/juspay/hyperswitch/pull/9040)) ([`b8c5bf3`](https://github.com/juspay/hyperswitch/commit/b8c5bf3f6d0809ba318694d69db1e4431b2c4c0b)) ++- **injector:** Add support for new crate - injector for external vault proxy ([#8959](https://github.com/juspay/hyperswitch/pull/8959)) ([`d18a941`](https://github.com/juspay/hyperswitch/commit/d18a94188ea93d07c4581888880088a9e676b1fd)) ++- **revenue_recovery:** ++ - Add redis-based payment processor token tracking for revenue recovery ([#8846](https://github.com/juspay/hyperswitch/pull/8846)) ([`0b59b90`](https://github.com/juspay/hyperswitch/commit/0b59b9086cd68eef346413a27d03fa61fb6bb1f7)) ++ - Introducing new calculate job for card switching and invoice queueing ([#8848](https://github.com/juspay/hyperswitch/pull/8848)) ([`5efe4d9`](https://github.com/juspay/hyperswitch/commit/5efe4d9751bd88861bbe3e609bb815983fca9778)) ++ ++### Bug Fixes ++ ++- **connector:** Add Support for CUSTOMERREQUEST Refund Reason in Adyen ([#9035](https://github.com/juspay/hyperswitch/pull/9035)) ([`2da681a`](https://github.com/juspay/hyperswitch/commit/2da681a265ef85e90f5282acda3140e78aa847d5)) ++ ++**Full Changelog:** [`2025.08.25.0...2025.08.26.0`](https://github.com/juspay/hyperswitch/compare/2025.08.25.0...2025.08.26.0) ++ ++- - - ++ + ## 2025.08.25.0 + + ### Features + +----- END CHUNK ----- \ No newline at end of file diff --git a/raw/e1/e1fc14135cc3527cfb5afeccd4934bad8386c7b1.txt b/raw/e1/e1fc14135cc3527cfb5afeccd4934bad8386c7b1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c179306f880e67d0fcf1b4a6fe970362052a813e --- /dev/null +++ b/raw/e1/e1fc14135cc3527cfb5afeccd4934bad8386c7b1.txt @@ -0,0 +1,8565 @@ +ROUTE: juspay/hyperswitch@e1fc14135cc3527cfb5afeccd4934bad8386c7b1 +REPO: https://github.com/juspay/hyperswitch +COMMIT: e1fc14135cc3527cfb5afeccd4934bad8386c7b1 +AUTHOR: Nithin N <57832822+Nithin1506200@users.noreply.github.com> +DATE: 2025-08-20T12:15:34 + +=== ISSUE_AND_PR === +[PR #8574] feat(connector): [CELERO] Integrate Card Payments (Alpha) +URL: https://github.com/juspay/hyperswitch/pull/8574 +BODY: +## Type of Change + + +- [ ] Bugfix +- [x] New feature +- [ ] Enhancement +- [ ] Refactoring +- [ ] Dependency updates +- [ ] Documentation +- [ ] CI/CD + +## Description + +Integrate celero commerce connector + +Doc : https://sandbox.gotnpgateway.com/docs/api/transactions +[x] Cards +[x] Avs + +### Additional Changes + +- [x] This PR modifies the API contract +- [ ] This PR modifies the database schema +- [ ] This PR modifies application configuration/environment variables + + + + +MOCK SERVER results + +Screenshot 2025-08-05 at 11 37 29 AM +Screenshot 2025-08-05 at 11 37 38 AM +Screenshot 2025-08-05 at 11 37 54 AM +![Uploading Screenshot 2025-08-06 at 3.00.16 PM.png…]() + + +## Motivation and Context + +https://github.com/juspay/hyperswitch/issues/8575 + +## How did you test it? + +No creds for testing + +## Checklist + + +- [x] I formatted the code `cargo +nightly fmt --all` +- [x] I addressed lints thrown by `cargo clippy` +- [x] I reviewed the submitted code +- [x] I added unit tests for my changes where possible +COMMENTS: +- semanticdiff-com[bot]: Review changes with  SemanticDiff +
+Changed Files +
+ +| File | Status | +| :--- | :--- | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8574/changes#cypress-tests/package.json)  [cypress\-tests/package\.json](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8574/changes#cypress-tests/package.json) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8574/changes#cypress-tests/package.json)  57% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8574/changes#.github/workflows/cypress-tests-runner.yml)  [\.github/workflows/cypress\-tests\-runner\.yml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8574/changes#.github/workflows/cypress-tests-runner.yml) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8574/changes#.github/workflows/cypress-tests-runner.yml)  49% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8574/changes#crates/hyperswitch_connectors/src/connectors/celero/transformers.rs)  [crates/hyperswitch\_connectors/src/connectors/celero/transformers\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8574/changes#crates/hyperswitch_connectors/src/connectors/celero/transformers.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8574/changes#crates/hyperswitch_connectors/src/connectors/celero/transformers.rs)  13% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8574/changes#crates/hyperswitch_connectors/src/connectors/celero.rs)  [crates/hyperswitch\_connectors/src/connectors/celero\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8574/changes#crates/hyperswitch_connectors/src/connectors/celero.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8574/changes#crates/hyperswitch_connectors/src/connectors/celero.rs)  5% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8574/changes#cypress-tests/eslint.config.js)  [cypress\-tests/eslint\.config\.js](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8574/changes#cypress-tests/eslint.config.js) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8574/changes#cypress-tests/eslint.config.js)  3% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8574/changes#cypress-tests/package-lock.json)  [cypress\-tests/package\-lock\.json](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8574/changes#cypress-tests/package-lock.json) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8574/changes#cypress-tests/package-lock.json)  2% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8574/changes#crates/connector_configs/toml/development.toml)  [crates/connector\_configs/toml/development\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8574/changes#crates/connector_configs/toml/development.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8574/changes#crates/connector_configs/toml/production.toml)  [crates/connector\_configs/toml/production\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8574/changes#crates/connector_configs/toml/production.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8574/changes#crates/connector_configs/toml/sandbox.toml)  [crates/connector\_configs/toml/sandbox\.toml](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8574/changes#crates/connector_configs/toml/sandbox.toml) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8574/changes#crates/payment_methods/src/configs/payment_connector_required_fields.rs)  [crates/payment\_methods/src/configs/payment\_connector\_required\_fields\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8574/changes#crates/payment_methods/src/configs/payment_connector_required_fields.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8574/changes#crates/payment_methods/src/configs/payment_connector_required_fields.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8574/changes#cypress-tests/README.md)  [cypress\-tests/README\.md](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8574/changes#cypress-tests/README.md) | Unsupported file format | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8574/changes#cypress-tests/cypress/e2e/configs/Payment/Celero.js)  [cypress\-tests/cypress/e2e/configs/Payment/Celero\.js](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8574/changes#cypress-tests/cypress/e2e/configs/Payment/Celero.js) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8574/changes#cypress-tests/cypress/e2e/configs/Payment/Celero.js)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8574/changes#cypress-tests/cypress/e2e/configs/Payment/Utils.js)  [cypress\-tests/cypress/e2e/configs/Payment/Utils\.js](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8574/changes#cypress-tests/cypress/e2e/configs/Payment/Utils.js) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8574/changes#cypress-tests/cypress/e2e/configs/Payment/Utils.js)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8574/changes#cypress-tests/cypress/e2e/configs/mock-server/Connectors/Celero.ts)  [cypress\-tests/cypress/e2e/configs/mock\-server/Connectors/Celero\.ts](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8574/changes#cypress-tests/cypress/e2e/configs/mock-server/Connectors/Celero.ts) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8574/changes#cypress-tests/cypress/e2e/configs/mock-server/Connectors/Celero.ts)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8574/changes#cypress-tests/cypress/e2e/configs/mock-server/Connectors/Silverflow.ts)  [cypress\-tests/cypress/e2e/configs/mock\-server/Connectors/Silverflow\.ts](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8574/changes#cypress-tests/cypress/e2e/configs/mock-server/Connectors/Silverflow.ts) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8574/changes#cypress-tests/cypress/e2e/configs/mock-server/Connectors/Silverflow.ts)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8574/changes#cypress-tests/cypress/e2e/configs/mock-server/Creds.json)  [cypress\-tests/cypress/e2e/configs/mock\-server/Creds\.json](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8574/changes#cypress-tests/cypress/e2e/configs/mock-server/Creds.json) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8574/changes#cypress-tests/cypress/e2e/configs/mock-server/Creds.json)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8574/changes#cypress-tests/cypress/e2e/configs/mock-server/Silverflow.js)  [cypress\-tests/cypress/e2e/configs/mock\-server/Silverflow\.js](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8574/changes#cypress-tests/cypress/e2e/configs/mock-server/Silverflow.js) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8574/changes#cypress-tests/cypress/e2e/configs/mock-server/Silverflow.js)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8574/changes#cypress-tests/cypress/e2e/configs/mock-server/mockserver.ts)  [cypress\-tests/cypress/e2e/configs/mock\-server/mockserver\.ts](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8574/changes#cypress-tests/cypress/e2e/configs/mock-server/mockserver.ts) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8574/changes#cypress-tests/cypress/e2e/configs/mock-server/mockserver.ts)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8574/changes#cypress-tests/cypress/e2e/configs/mock-server/router.ts)  [cypress\-tests/cypress/e2e/configs/mock\-server/router\.ts](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8574/changes#cypress-tests/cypress/e2e/configs/mock-server/router.ts) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8574/changes#cypress-tests/cypress/e2e/configs/mock-server/router.ts)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8574/changes#cypress-tests/tsconfig.json)  [cypress\-tests/tsconfig\.json](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8574/changes#cypress-tests/tsconfig.json) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8574/changes#cypress-tests/tsconfig.json)  0% smaller | + +
+- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/celero.rs:1]: Please add dashboard configs for celero in +crates/connector_configs/toml +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/celero/transformers.rs:56]: If we are not storing id in EncodedData then this change is not needed +Only get id from ConnectorTransactionId +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/celero/transformers.rs:121]: Use util functions like get_line1(), etc from crates/hyperswitch_connectors/src/utils.rs +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/celero/transformers.rs:197]: Use more meaningful variable names instead of e +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/celero/transformers.rs:299]: Please re-verify this status mapping. In case of auto capture should we mark approved as charged? +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/celero/transformers.rs:544]: Use get instead of post if void request has no body. +Remove the the get_request_body function. +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/celero/transformers.rs:121]: Add mandatory fields like card no, first name, expiry etcetera to crates/payment_methods/src/configs/payment_connector_required_fields.rs +- Nithin1506200 [crates/hyperswitch_connectors/src/connectors/celero/transformers.rs:299]: For authorized its always approved. in case of auto capture it should return `Charged` directly. +- deepanshu-iiitu [crates/hyperswitch_connectors/src/connectors/celero/transformers.rs:353]: Why are these fields mentioned as optional if these fields are included in `crates/payment_methods/src/configs/payment_connector_required_fields.rs`? +- Nithin1506200 [crates/hyperswitch_connectors/src/connectors/celero/transformers.rs:353]: Fair.. i looked into doc again and no where mentioned this was requied for cards atleast. So removing billing, name,email from `payment_connector_required_fields.rs` as of now. keeping only basic card details as required +- pixincreate [.github/workflows/cypress-tests-runner.yml:17]: ```suggestion + ALPHA_PAYMENTS_CONNECTORS: "celero silverflow" +``` +- pixincreate [cypress-tests/cypress/e2e/configs/mock-server/Celero.js:444]: if the connector takes headker key, can you add a validation for this? check silverflow server for reference. +- pixincreate [cypress-tests/cypress/e2e/configs/mock-server/Celero.js:415]: are these statuses verified with connector docs? +- pixincreate [cypress-tests/cypress/e2e/configs/mock-server/Celero.js:284]: same, are these verified with connector docs? +- pixincreate [cypress-tests/cypress/e2e/configs/mock-server/Celero.js:67]: this is not needed i guess. +- pixincreate [cypress-tests/cypress/e2e/configs/mock-server/Celero.js:48]: i do not see any api key validation being done, but the message at the end it only accepts limited api keys. +- pixincreate [cypress-tests/cypress/e2e/configs/Payment/Celero.js:1]: haven't gone through the file yet, but 1077 lines addition itself says that this has a ton of redundant configs. ai generated? + +fyi, just before the test is run, connector config is merged with commons, so you do not need to copy paste the entire configs. just have the configs that celero expects to work / supports. +- pixincreate [cypress-tests/cypress/e2e/configs/Payment/Celero.js:30]: only one is enough, no need for amex card. +- pixincreate [crates/payment_methods/src/configs/payment_connector_required_fields.rs:1259]: ```suggestion + (Connector::Celero, fields(vec![], vec![], card_basic())), +``` +- pixincreate [.github/workflows/cypress-tests-runner.yml:195]: i'll be raising a pr that makes this change redundant going forward for alpha connectors. it's just too much of pain for everyone. + +=== COMMIT === +SUBJECT: feat(connector): [CELERO] Integrate Card Payments (Alpha) (#8574) +BODY: +Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> +Co-authored-by: Pa1NarK <69745008+pixincreate@users.noreply.github.com> + +=== FILES === +Summary: 20 files changed, +6224 -1069 +- .github/workflows/cypress-tests-runner.yml (+28 -58) +- crates/connector_configs/toml/development.toml (+29 -0) +- crates/connector_configs/toml/production.toml (+28 -0) +- crates/connector_configs/toml/sandbox.toml (+29 -0) +- crates/hyperswitch_connectors/src/connectors/celero.rs (+266 -40) +- crates/hyperswitch_connectors/src/connectors/celero/transformers.rs (+769 -123) +- crates/payment_methods/src/configs/payment_connector_required_fields.rs (+1 -0) +- cypress-tests/README.md (+49 -0) +- cypress-tests/cypress/e2e/configs/Payment/Celero.js (+1069 -0) +- cypress-tests/cypress/e2e/configs/Payment/Utils.js (+2 -1) +- cypress-tests/cypress/e2e/configs/mock-server/Connectors/Celero.ts (+502 -0) +- cypress-tests/cypress/e2e/configs/mock-server/Connectors/Silverflow.ts (+706 -0) +- cypress-tests/cypress/e2e/configs/mock-server/Creds.json (+16 -0) +- cypress-tests/cypress/e2e/configs/mock-server/Silverflow.js (+0 -665) +- cypress-tests/cypress/e2e/configs/mock-server/mockserver.ts (+62 -0) +- cypress-tests/cypress/e2e/configs/mock-server/router.ts (+89 -0) +- cypress-tests/eslint.config.js (+17 -3) +- cypress-tests/package-lock.json (+2529 -173) +- cypress-tests/package.json (+15 -6) +- cypress-tests/tsconfig.json (+18 -0) + +=== PATCH === +diff --git a/.github/workflows/cypress-tests-runner.yml b/.github/workflows/cypress-tests-runner.yml +index 8e901525..363ca6d9 100644 +--- a/.github/workflows/cypress-tests-runner.yml ++++ b/.github/workflows/cypress-tests-runner.yml +@@ -14,7 +14,7 @@ env: + CARGO_INCREMENTAL: 0 + CARGO_NET_RETRY: 10 + PAYMENTS_CONNECTORS: "cybersource stripe" +- ALPHA_PAYMENTS_CONNECTORS: "silverflow" ++ ALPHA_PAYMENTS_CONNECTORS: "celero silverflow" + RUST_BACKTRACE: short + RUSTUP_MAX_RETRIES: 10 + RUN_TESTS: ${{ ((github.event_name == 'pull_request') && (github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name)) || (github.event_name == 'merge_group')}} +@@ -50,7 +50,7 @@ jobs: + - name: Install Node.js + uses: actions/setup-node@v4 + with: +- node-version: "20" ++ node-version: "24" + + - name: Install Cypress and dependencies + run: | +@@ -233,7 +233,7 @@ jobs: + if: ${{ env.RUN_TESTS == 'true' }} + uses: actions/setup-node@v4 + with: +- node-version: "20" ++ node-version: "24" + + - name: Install Cypress and dependencies + if: ${{ env.RUN_TESTS == 'true' }} +@@ -349,28 +349,11 @@ jobs: + if: ${{ env.RUN_TESTS == 'true' }} + run: chmod +x target/debug/router + +- - name: Download Encrypted JSON from S3 and Decrypt +- if: ${{ env.RUN_TESTS == 'true' }} +- env: +- AWS_ACCESS_KEY_ID: ${{ secrets.CONNECTOR_CREDS_AWS_ACCESS_KEY_ID }} +- AWS_REGION: ${{ secrets.CONNECTOR_CREDS_AWS_REGION }} +- AWS_SECRET_ACCESS_KEY: ${{ secrets.CONNECTOR_CREDS_AWS_SECRET_ACCESS_KEY }} +- CONNECTOR_AUTH_PASSPHRASE: ${{ secrets.CONNECTOR_AUTH_PASSPHRASE }} +- CONNECTOR_CREDS_S3_BUCKET_URI: ${{ secrets.CONNECTOR_CREDS_S3_BUCKET_URI}} +- DESTINATION_FILE_NAME: "creds.json.gpg" +- S3_SOURCE_FILE_NAME: "6859bf7e-735b-4589-979a-ac057ed50425.json.gpg" +- shell: bash +- run: | +- mkdir -p ".github/secrets" ".github/test" +- +- aws s3 cp "${CONNECTOR_CREDS_S3_BUCKET_URI}/${S3_SOURCE_FILE_NAME}" ".github/secrets/${DESTINATION_FILE_NAME}" +- gpg --quiet --batch --yes --decrypt --passphrase="${CONNECTOR_AUTH_PASSPHRASE}" --output ".github/test/creds.json" ".github/secrets/${DESTINATION_FILE_NAME}" +- + - name: Set paths in env + if: ${{ env.RUN_TESTS == 'true' }} + shell: bash + run: | +- echo "CYPRESS_CONNECTOR_AUTH_FILE_PATH=${{ github.workspace }}/.github/test/creds.json" >> $GITHUB_ENV ++ echo "CYPRESS_CONNECTOR_AUTH_FILE_PATH=${{ github.workspace }}/cypress-tests/cypress/e2e/configs/mock-server/Creds.json" >> $GITHUB_ENV + + - name: Fetch keys + if: ${{ env.RUN_TESTS == 'true' }} +@@ -399,7 +382,7 @@ jobs: + if: ${{ env.RUN_TESTS == 'true' }} + uses: actions/setup-node@v4 + with: +- node-version: "20" ++ node-version: "24" + + - name: Install Cypress and dependencies + if: ${{ env.RUN_TESTS == 'true' }} +@@ -421,33 +404,27 @@ jobs: + - name: Start mock servers for alpha connectors + if: ${{ env.RUN_TESTS == 'true' }} + run: | +- # Start mock servers for each alpha connector +- for connector in ${{ env.ALPHA_PAYMENTS_CONNECTORS }}; do +- pascal_case_connector="$(echo "$connector" | sed -E 's/(^|_)([a-z])/\U\2/g')" +- if [ -f "cypress-tests/cypress/e2e/configs/mock-server/${pascal_case_connector}.js" ]; then +- echo "Starting mock server for ${connector}" +- cd cypress-tests +- +- node "cypress/e2e/configs/mock-server/${pascal_case_connector}.js" & +- +- MOCK_PID=$! +- echo "MOCK_${connector^^}_PID=${MOCK_PID}" >> $GITHUB_ENV +- cd .. +- +- # Wait for mock server to be ready +- COUNT=0 +- while ! nc -z localhost 3010; do +- if [ $COUNT -gt 6 ]; then # Wait for up to 1 minute (6 * 10 seconds) +- echo "Mock server for ${connector} did not start within a reasonable time." +- exit 1 +- else +- COUNT=$((COUNT+1)) +- sleep 10 +- fi +- done +- echo "Mock server for ${connector} is ready" ++ echo "Starting mock server for ${connector}" ++ cd cypress-tests ++ ++ npm run mockserver & ++ ++ MOCK_PID=$! ++ echo "MOCK_PID=${MOCK_PID}" >> $GITHUB_ENV ++ cd .. ++ ++ # Wait for mock server to be ready ++ COUNT=0 ++ while ! nc -z localhost 3010; do ++ if [ $COUNT -gt 6 ]; then # Wait for up to 1 minute (6 * 10 seconds) ++ echo "Mock server for ${connector} did not start within a reasonable time." ++ exit 1 ++ else ++ COUNT=$((COUNT+1)) ++ sleep 10 + fi + done ++ echo "Mock server for ${connector} is ready" + + - name: Setup Local Server with Alpha Connector Configs + if: ${{ env.RUN_TESTS == 'true' }} +@@ -460,8 +437,8 @@ jobs: + # Set base URLs for alpha connectors to point to mock servers + for connector in ${{ env.ALPHA_PAYMENTS_CONNECTORS }}; do + CONNECTOR_ENV_VAR="ROUTER__CONNECTORS__$(echo ${connector} | tr '[:lower:]' '[:upper:]')__BASE_URL" +- export ${CONNECTOR_ENV_VAR}="http://localhost:3010" +- echo "${CONNECTOR_ENV_VAR}=http://localhost:3010" >> $GITHUB_ENV ++ export ${CONNECTOR_ENV_VAR}="http://localhost:3010/${connector}" ++ echo "${CONNECTOR_ENV_VAR}=http://localhost:3010/${connector}" >> $GITHUB_ENV + done + + # Start the server in the background +@@ -496,14 +473,7 @@ jobs: + + # Cleanup + kill "${{ env.PID }}" +- +- # Kill mock servers +- for connector in ${{ env.ALPHA_PAYMENTS_CONNECTORS }}; do +- VAR_NAME="MOCK_${connector^^}_PID" +- if [ -n "${!VAR_NAME:-}" ]; then +- kill "${!VAR_NAME}" || true +- fi +- done ++ kill "${{ env.MOCK_PID }}" + + - name: Upload Cypress test results for Alpha Connectors + if: env.RUN_TESTS == 'true' && failure() +@@ -631,7 +601,7 @@ jobs: + if: ${{ env.RUN_TESTS == 'true' }} + uses: actions/setup-node@v4 + with: +- node-version: "20" ++ node-version: "24" + + - name: Install Cypress and dependencies + if: ${{ env.RUN_TESTS == 'true' }} +diff --git a/crates/connector_configs/toml/development.toml b/crates/connector_configs/toml/development.toml +index 83544e40..160a29aa 100644 +--- a/crates/connector_configs/toml/development.toml ++++ b/crates/connector_configs/toml/development.toml +@@ -1446,6 +1446,35 @@ merchant_id_evoucher="MerchantId Evoucher" + [cashtocode.connector_webhook_details] + merchant_secret="Source verification key" + ++[celero] ++[[celero.credit]] ++ payment_method_type = "AmericanExpress" ++[[celero.credit]] ++ payment_method_type = "Discover" ++[[celero.credit]] ++ payment_method_type = "DinersClub" ++[[celero.credit]] ++ payment_method_type = "JCB" ++[[celero.credit]] ++ payment_method_type = "Mastercard" ++[[celero.credit]] ++ payment_method_type = "Visa" ++[[celero.debit]] ++ payment_method_type = "AmericanExpress" ++[[celero.debit]] ++ payment_method_type = "Discover" ++[[celero.debit]] ++ payment_method_type = "DinersClub" ++[[celero.debit]] ++ payment_method_type = "JCB" ++[[celero.debit]] ++ payment_method_type = "Mastercard" ++[[celero.debit]] ++ payment_method_type = "Visa" ++[celero.connector_auth.HeaderKey] ++api_key="Celero API Key" ++ ++ + [checkbook] + [[checkbook.bank_transfer]] + payment_method_type = "ach" +diff --git a/crates/connector_configs/toml/production.toml b/crates/connector_configs/toml/production.toml +index 019d842b..47aff66d 100644 +--- a/crates/connector_configs/toml/production.toml ++++ b/crates/connector_configs/toml/production.toml +@@ -1212,6 +1212,34 @@ key1 = "Secret Key" + [cryptopay.connector_webhook_details] + merchant_secret = "Source verification key" + ++[celero] ++[[celero.credit]] ++ payment_method_type = "AmericanExpress" ++[[celero.credit]] ++ payment_method_type = "Discover" ++[[celero.credit]] ++ payment_method_type = "DinersClub" ++[[celero.credit]] ++ payment_method_type = "JCB" ++[[celero.credit]] ++ payment_method_type = "Mastercard" ++[[celero.credit]] ++ payment_method_type = "Visa" ++[[celero.debit]] ++ payment_method_type = "AmericanExpress" ++[[celero.debit]] ++ payment_method_type = "Discover" ++[[celero.debit]] ++ payment_method_type = "DinersClub" ++[[celero.debit]] ++ payment_method_type = "JCB" ++[[celero.debit]] ++ payment_method_type = "Mastercard" ++[[celero.debit]] ++ payment_method_type = "Visa" ++[celero.connector_auth.HeaderKey] ++api_key="Celero API Key" ++ + [checkbook] + [[checkbook.bank_transfer]] + payment_method_type = "ach" +diff --git a/crates/connector_configs/toml/sandbox.toml b/crates/connector_configs/toml/sandbox.toml +index 85713150..d1ea6ba6 100644 +--- a/crates/connector_configs/toml/sandbox.toml ++++ b/crates/connector_configs/toml/sandbox.toml +@@ -1445,6 +1445,35 @@ merchant_id_evoucher = "MerchantId Evoucher" + [cashtocode.connector_webhook_details] + merchant_secret = "Source verification key" + ++[celero] ++[[celero.credit]] ++ payment_method_type = "AmericanExpress" ++[[celero.credit]] ++ payment_method_type = "Discover" ++[[celero.credit]] ++ payment_method_type = "DinersClub" ++[[celero.credit]] ++ payment_method_type = "JCB" ++[[celero.credit]] ++ payment_method_type = "Mastercard" ++[[celero.credit]] ++ payment_method_type = "Visa" ++[[celero.debit]] ++ payment_method_type = "AmericanExpress" ++[[celero.debit]] ++ payment_method_type = "Discover" ++[[celero.debit]] ++ payment_method_type = "DinersClub" ++[[celero.debit]] ++ payment_method_type = "JCB" ++[[celero.debit]] ++ payment_method_type = "Mastercard" ++[[celero.debit]] ++ payment_method_type = "Visa" ++[celero.connector_auth.HeaderKey] ++api_key="Celero API Key" ++ ++ + [checkbook] + [[checkbook.bank_transfer]] + payment_method_type = "ach" +diff --git a/crates/hyperswitch_connectors/src/connectors/celero.rs b/crates/hyperswitch_connectors/src/connectors/celero.rs +index 9db111a1..726791a7 100644 +--- a/crates/hyperswitch_connectors/src/connectors/celero.rs ++++ b/crates/hyperswitch_connectors/src/connectors/celero.rs +@@ -1,10 +1,13 @@ + pub mod transformers; + ++use std::sync::LazyLock; ++ ++use common_enums::enums; + use common_utils::{ + errors::CustomResult, + ext_traits::BytesExt, + request::{Method, Request, RequestBuilder, RequestContent}, +- types::{AmountConvertor, StringMinorUnit, StringMinorUnitForConnector}, ++ types::{AmountConvertor, MinorUnit, MinorUnitForConnector}, + }; + use error_stack::{report, ResultExt}; + use hyperswitch_domain_models::{ +@@ -19,7 +22,10 @@ use hyperswitch_domain_models::{ + PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData, + RefundsData, SetupMandateRequestData, + }, +- router_response_types::{PaymentsResponseData, RefundsResponseData}, ++ router_response_types::{ ++ ConnectorInfo, PaymentMethodDetails, PaymentsResponseData, RefundsResponseData, ++ SupportedPaymentMethods, SupportedPaymentMethodsExt, ++ }, + types::{ + PaymentsAuthorizeRouterData, PaymentsCaptureRouterData, PaymentsSyncRouterData, + RefundSyncRouterData, RefundsRouterData, +@@ -43,13 +49,13 @@ use crate::{constants::headers, types::ResponseRouterData, utils}; + + #[derive(Clone)] + pub struct Celero { +- amount_converter: &'static (dyn AmountConvertor + Sync), ++ amount_converter: &'static (dyn AmountConvertor + Sync), + } + + impl Celero { + pub fn new() -> &'static Self { + &Self { +- amount_converter: &StringMinorUnitForConnector, ++ amount_converter: &MinorUnitForConnector, + } + } + } +@@ -98,10 +104,7 @@ impl ConnectorCommon for Celero { + } + + fn get_currency_unit(&self) -> api::CurrencyUnit { +- api::CurrencyUnit::Base +- // TODO! Check connector documentation, on which unit they are processing the currency. +- // If the connector accepts amount in lower unit ( i.e cents for USD) then return api::CurrencyUnit::Minor, +- // if connector accepts amount in base unit (i.e dollars for USD) then return api::CurrencyUnit::Base ++ api::CurrencyUnit::Minor + } + + fn common_get_content_type(&self) -> &'static str { +@@ -137,23 +140,53 @@ impl ConnectorCommon for Celero { + event_builder.map(|i| i.set_response_body(&response)); + router_env::logger::info!(connector_response=?response); + ++ // Extract error details from the response ++ let error_details = celero::CeleroErrorDetails::from(response); ++ + Ok(ErrorResponse { + status_code: res.status_code, +- code: response.code, +- message: response.message, +- reason: response.reason, ++ code: error_details ++ .error_code ++ .unwrap_or_else(|| "UNKNOWN_ERROR".to_string()), ++ message: error_details.error_message, ++ reason: error_details.decline_reason, + attempt_status: None, + connector_transaction_id: None, +- network_decline_code: None, ++ network_decline_code: error_details.processor_response_code.clone(), + network_advice_code: None, +- network_error_message: None, ++ network_error_message: error_details.processor_response_code, + connector_metadata: None, + }) + } + } + + impl ConnectorValidation for Celero { +- //TODO: implement functions when support enabled ++ fn validate_connector_against_payment_request( ++ &self, ++ capture_method: Option, ++ _payment_method: enums::PaymentMethod, ++ _pmt: Option, ++ ) -> CustomResult<(), errors::ConnectorError> { ++ let capture_method = capture_method.unwrap_or_default(); ++ ++ // CeleroCommerce supports both automatic (sale) and manual (authorize + capture) flows ++ let is_capture_method_supported = matches!( ++ capture_method, ++ enums::CaptureMethod::Automatic ++ | enums::CaptureMethod::Manual ++ | enums::CaptureMethod::SequentialAutomatic ++ ); ++ ++ if is_capture_method_supported { ++ Ok(()) ++ } else { ++ Err(errors::ConnectorError::NotSupported { ++ message: capture_method.to_string(), ++ connector: self.id(), ++ } ++ .into()) ++ } ++ } + } + + impl ConnectorIntegration for Celero { +@@ -180,9 +213,9 @@ impl ConnectorIntegration CustomResult { +- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into()) ++ Ok(format!("{}/api/transaction", self.base_url(connectors))) + } + + fn get_request_body( +@@ -196,7 +229,7 @@ impl ConnectorIntegration for Cel + fn get_url( + &self, + _req: &PaymentsSyncRouterData, +- _connectors: &Connectors, ++ connectors: &Connectors, + ) -> CustomResult { +- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into()) ++ // CeleroCommerce uses search API for payment sync ++ Ok(format!( ++ "{}/api/transaction/search", ++ self.base_url(connectors) ++ )) ++ } ++ ++ fn get_request_body( ++ &self, ++ req: &PaymentsSyncRouterData, ++ _connectors: &Connectors, ++ ) -> CustomResult { ++ let connector_req = celero::CeleroSearchRequest::try_from(req)?; ++ Ok(RequestContent::Json(Box::new(connector_req))) + } + + fn build_request( +@@ -279,10 +325,13 @@ impl ConnectorIntegration for Cel + ) -> CustomResult, errors::ConnectorError> { + Ok(Some( + RequestBuilder::new() +- .method(Method::Get) ++ .method(Method::Post) + .url(&types::PaymentsSyncType::get_url(self, req, connectors)?) + .attach_default_headers() + .headers(types::PaymentsSyncType::get_headers(self, req, connectors)?) ++ .set_body(types::PaymentsSyncType::get_request_body( ++ self, req, connectors, ++ )?) + .build(), + )) + } +@@ -330,18 +379,31 @@ impl ConnectorIntegration fo + + fn get_url( + &self, +- _req: &PaymentsCaptureRouterData, +- _connectors: &Connectors, ++ req: &PaymentsCaptureRouterData, ++ connectors: &Connectors, + ) -> CustomResult { +- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into()) ++ let connector_payment_id = req.request.connector_transaction_id.clone(); ++ Ok(format!( ++ "{}/api/transaction/{}/capture", ++ self.base_url(connectors), ++ connector_payment_id ++ )) + } + + fn get_request_body( + &self, +- _req: &PaymentsCaptureRouterData, ++ req: &PaymentsCaptureRouterData, + _connectors: &Connectors, + ) -> CustomResult { +- Err(errors::ConnectorError::NotImplemented("get_request_body method".to_string()).into()) ++ let amount = utils::convert_amount( ++ self.amount_converter, ++ req.request.minor_amount_to_capture, ++ req.request.currency, ++ )?; ++ ++ let connector_router_data = celero::CeleroRouterData::try_from((amount, req))?; ++ let connector_req = celero::CeleroCaptureRequest::try_from(&connector_router_data)?; ++ Ok(RequestContent::Json(Box::new(connector_req))) + } + + fn build_request( +@@ -370,7 +432,7 @@ impl ConnectorIntegration fo + event_builder: Option<&mut ConnectorEvent>, + res: Response, + ) -> CustomResult { +- let response: celero::CeleroPaymentsResponse = res ++ let response: celero::CeleroCaptureResponse = res + .response + .parse_struct("Celero PaymentsCaptureResponse") + .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; +@@ -392,7 +454,77 @@ impl ConnectorIntegration fo + } + } + +-impl ConnectorIntegration for Celero {} ++impl ConnectorIntegration for Celero { ++ fn get_headers( ++ &self, ++ req: &RouterData, ++ connectors: &Connectors, ++ ) -> CustomResult)>, errors::ConnectorError> { ++ self.build_headers(req, connectors) ++ } ++ ++ fn get_content_type(&self) -> &'static str { ++ self.common_get_content_type() ++ } ++ ++ fn get_url( ++ &self, ++ req: &RouterData, ++ connectors: &Connectors, ++ ) -> CustomResult { ++ let connector_payment_id = req.request.connector_transaction_id.clone(); ++ Ok(format!( ++ "{}/api/transaction/{}/void", ++ self.base_url(connectors), ++ connector_payment_id ++ )) ++ } ++ ++ fn build_request( ++ &self, ++ req: &RouterData, ++ connectors: &Connectors, ++ ) -> CustomResult, errors::ConnectorError> { ++ Ok(Some( ++ RequestBuilder::new() ++ .method(Method::Post) ++ .url(&types::PaymentsVoidType::get_url(self, req, connectors)?) ++ .attach_default_headers() ++ .headers(types::PaymentsVoidType::get_headers(self, req, connectors)?) ++ .build(), ++ )) ++ } ++ ++ fn handle_response( ++ &self, ++ data: &RouterData, ++ event_builder: Option<&mut ConnectorEvent>, ++ res: Response, ++ ) -> CustomResult< ++ RouterData, ++ errors::ConnectorError, ++ > { ++ let response: celero::CeleroVoidResponse = res ++ .response ++ .parse_struct("Celero PaymentsVoidResponse") ++ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; ++ event_builder.map(|i| i.set_response_body(&response)); ++ router_env::logger::info!(connector_response=?response); ++ RouterData::try_from(ResponseRouterData { ++ response, ++ data: data.clone(), ++ http_code: res.status_code, ++ }) ++ } ++ ++ fn get_error_response( ++ &self, ++ res: Response, ++ event_builder: Option<&mut ConnectorEvent>, ++ ) -> CustomResult { ++ self.build_error_response(res, event_builder) ++ } ++} + + impl ConnectorIntegration for Celero { + fn get_headers( +@@ -409,10 +541,15 @@ impl ConnectorIntegration for Celero + + fn get_url( + &self, +- _req: &RefundsRouterData, +- _connectors: &Connectors, ++ req: &RefundsRouterData, ++ connectors: &Connectors, + ) -> CustomResult { +- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into()) ++ let connector_payment_id = req.request.connector_transaction_id.clone(); ++ Ok(format!( ++ "{}/api/transaction/{}/refund", ++ self.base_url(connectors), ++ connector_payment_id ++ )) + } + + fn get_request_body( +@@ -426,7 +563,7 @@ impl ConnectorIntegration for Celero + req.request.currency, + )?; + +- let connector_router_data = celero::CeleroRouterData::from((refund_amount, req)); ++ let connector_router_data = celero::CeleroRouterData::try_from((refund_amount, req))?; + let connector_req = celero::CeleroRefundRequest::try_from(&connector_router_data)?; + Ok(RequestContent::Json(Box::new(connector_req))) + } +@@ -456,10 +593,10 @@ impl ConnectorIntegration for Celero + event_builder: Option<&mut ConnectorEvent>, + res: Response, + ) -> CustomResult, errors::ConnectorError> { +- let response: celero::RefundResponse = +- res.response +- .parse_struct("celero RefundResponse") +- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; ++ let response: celero::CeleroRefundResponse = res ++ .response ++ .parse_struct("celero RefundResponse") ++ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; + event_builder.map(|i| i.set_response_body(&response)); + router_env::logger::info!(connector_response=?response); + RouterData::try_from(ResponseRouterData { +@@ -494,9 +631,22 @@ impl ConnectorIntegration for Celero { + fn get_url( + &self, + _req: &RefundSyncRouterData, +- _connectors: &Connectors, ++ connectors: &Connectors, + ) -> CustomResult { +- Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into()) ++ // CeleroCommerce uses search API for refund sync ++ Ok(format!( ++ "{}/api/transaction/search", ++ self.base_url(connectors) ++ )) ++ } ++ ++ fn get_request_body( ++ &self, ++ req: &RefundSyncRouterData, ++ _connectors: &Connectors, ++ ) -> CustomResult { ++ let connector_req = celero::CeleroSearchRequest::try_from(req)?; ++ Ok(RequestContent::Json(Box::new(connector_req))) + } + + fn build_request( +@@ -506,7 +656,7 @@ impl ConnectorIntegration for Celero { + ) -> CustomResult, errors::ConnectorError> { + Ok(Some( + RequestBuilder::new() +- .method(Method::Get) ++ .method(Method::Post) + .url(&types::RefundSyncType::get_url(self, req, connectors)?) + .attach_default_headers() + .headers(types::RefundSyncType::get_headers(self, req, connectors)?) +@@ -523,7 +673,7 @@ impl ConnectorIntegration for Celero { + event_builder: Option<&mut ConnectorEvent>, + res: Response, + ) -> CustomResult { +- let response: celero::RefundResponse = res ++ let response: celero::CeleroRefundResponse = res + .response + .parse_struct("celero RefundSyncResponse") + .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; +@@ -569,4 +719,80 @@ impl webhooks::IncomingWebhook for Celero { + } + } + +-impl ConnectorSpecifications for Celero {} ++static CELERO_SUPPORTED_PAYMENT_METHODS: LazyLock = LazyLock::new(|| { ++ let supported_capture_methods = vec![ ++ enums::CaptureMethod::Automatic, ++ enums::CaptureMethod::Manual, ++ enums::CaptureMethod::SequentialAutomatic, ++ ]; ++ let supported_card_network = vec![ ++ common_enums::CardNetwork::AmericanExpress, ++ common_enums::CardNetwork::Discover, ++ common_enums::CardNetwork::DinersClub, ++ common_enums::CardNetwork::JCB, ++ common_enums::CardNetwork::Mastercard, ++ common_enums::CardNetwork::Visa, ++ ]; ++ ++ let mut celero_supported_payment_methods = SupportedPaymentMethods::new(); ++ ++ celero_supported_payment_methods.add( ++ enums::PaymentMethod::Card, ++ enums::PaymentMethodType::Credit, ++ PaymentMethodDetails { ++ mandates: enums::FeatureStatus::NotSupported, ++ refunds: enums::FeatureStatus::Supported, ++ supported_capture_methods: supported_capture_methods.clone(), ++ specific_features: Some( ++ api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({ ++ api_models::feature_matrix::CardSpecificFeatures { ++ three_ds: common_enums::FeatureStatus::NotSupported, ++ no_three_ds: common_enums::FeatureStatus::Supported, ++ supported_card_networks: supported_card_network.clone(), ++ } ++ }), ++ ), ++ }, ++ ); ++ ++ celero_supported_payment_methods.add( ++ enums::PaymentMethod::Card, ++ enums::PaymentMethodType::Debit, ++ PaymentMethodDetails { ++ mandates: enums::FeatureStatus::NotSupported, ++ refunds: enums::FeatureStatus::Supported, ++ supported_capture_methods: supported_capture_methods.clone(), ++ specific_features: Some( ++ api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({ ++ api_models::feature_matrix::CardSpecificFeatures { ++ three_ds: common_enums::FeatureStatus::NotSupported, ++ no_three_ds: common_enums::FeatureStatus::Supported, ++ supported_card_networks: supported_card_network.clone(), ++ } ++ }), ++ ), ++ }, ++ ); ++ ++ celero_supported_payment_methods ++}); ++ ++static CELERO_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { ++ display_name: "Celero", ++ description: "Celero is your trusted provider for payment processing technology and solutions, with a commitment to helping small to mid-sized businesses thrive", ++ connector_type: enums::PaymentConnectorCategory::PaymentGateway, ++}; ++ ++impl ConnectorSpecifications for Celero { ++ fn get_connector_about(&self) -> Option<&'static ConnectorInfo> { ++ Some(&CELERO_CONNECTOR_INFO) ++ } ++ ++ fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> { ++ Some(&*CELERO_SUPPORTED_PAYMENT_METHODS) ++ } ++ ++ fn get_supported_webhook_flows(&self) -> Option<&'static [enums::EventClass]> { ++ None ++ } ++} +diff --git a/crates/hyperswitch_connectors/src/connectors/celero/transformers.rs b/crates/hyperswitch_connectors/src/connectors/celero/transformers.rs +index 2579c81a..76990260 100644 +--- a/crates/hyperswitch_connectors/src/connectors/celero/transformers.rs ++++ b/crates/hyperswitch_connectors/src/connectors/celero/transformers.rs +@@ -1,80 +1,260 @@ +-use common_enums::enums; +-use common_utils::types::StringMinorUnit; ++use common_enums::{enums, Currency}; ++use common_utils::{pii::Email, types::MinorUnit}; + use hyperswitch_domain_models::{ ++ address::Address as DomainAddress, + payment_method_data::PaymentMethodData, +- router_data::{ConnectorAuthType, RouterData}, +- router_flow_types::refunds::{Execute, RSync}, +- router_request_types::ResponseId, ++ router_data::{ ++ AdditionalPaymentMethodConnectorResponse, ConnectorAuthType, ConnectorResponseData, ++ RouterData, ++ }, ++ router_flow_types::{ ++ payments::Capture, ++ refunds::{Execute, RSync}, ++ }, ++ router_request_types::{PaymentsCaptureData, ResponseId}, + router_response_types::{PaymentsResponseData, RefundsResponseData}, +- types::{PaymentsAuthorizeRouterData, RefundsRouterData}, ++ types::{ ++ PaymentsAuthorizeRouterData, PaymentsCaptureRouterData, PaymentsSyncRouterData, ++ RefundSyncRouterData, RefundsRouterData, ++ }, + }; +-use hyperswitch_interfaces::errors; +-use masking::Secret; ++use hyperswitch_interfaces::{consts, errors}; ++use masking::{PeekInterface, Secret}; + use serde::{Deserialize, Serialize}; + + use crate::{ + types::{RefundsResponseRouterData, ResponseRouterData}, +- utils::PaymentsAuthorizeRequestData, ++ utils::{ ++ AddressDetailsData, PaymentsAuthorizeRequestData, RefundsRequestData, RouterData as _, ++ }, + }; + + //TODO: Fill the struct with respective fields + pub struct CeleroRouterData { +- pub amount: StringMinorUnit, // The type of amount that a connector accepts, for example, String, i64, f64, etc. ++ pub amount: MinorUnit, // CeleroCommerce expects integer cents + pub router_data: T, + } + +-impl From<(StringMinorUnit, T)> for CeleroRouterData { +- fn from((amount, item): (StringMinorUnit, T)) -> Self { +- //Todo : use utils to convert the amount to the type of amount that a connector accepts +- Self { ++impl TryFrom<(MinorUnit, T)> for CeleroRouterData { ++ type Error = error_stack::Report; ++ fn try_from((amount, item): (MinorUnit, T)) -> Result { ++ Ok(Self { + amount, + router_data: item, +- } ++ }) + } + } ++// CeleroCommerce Search Request for sync operations - POST /api/transaction/search ++#[derive(Debug, Serialize, PartialEq)] ++pub struct CeleroSearchRequest { ++ transaction_id: String, ++} + +-//TODO: Fill the struct with respective fields +-#[derive(Default, Debug, Serialize, PartialEq)] ++impl TryFrom<&PaymentsSyncRouterData> for CeleroSearchRequest { ++ type Error = error_stack::Report; ++ fn try_from(item: &PaymentsSyncRouterData) -> Result { ++ let transaction_id = match &item.request.connector_transaction_id { ++ ResponseId::ConnectorTransactionId(id) => id.clone(), ++ _ => { ++ return Err(errors::ConnectorError::MissingConnectorTransactionID.into()); ++ } ++ }; ++ Ok(Self { transaction_id }) ++ } ++} ++ ++impl TryFrom<&RefundSyncRouterData> for CeleroSearchRequest { ++ type Error = error_stack::Report; ++ fn try_from(item: &RefundSyncRouterData) -> Result { ++ Ok(Self { ++ transaction_id: item.request.get_connector_refund_id()?, ++ }) ++ } ++} ++ ++// CeleroCommerce Payment Request according to API specs ++#[derive(Debug, Serialize, PartialEq)] + pub struct CeleroPaymentsRequest { +- amount: StringMinorUnit, +- card: CeleroCard, ++ idempotency_key: String, ++ #[serde(rename = "type")] ++ transaction_type: TransactionType, ++ amount: MinorUnit, // CeleroCommerce expects integer cents ++ currency: Currency, ++ payment_method: CeleroPaymentMethod, ++ #[serde(skip_serializing_if = "Option::is_none")] ++ billing_address: Option, ++ #[serde(skip_serializing_if = "Option::is_none")] ++ shipping_address: Option, ++ #[serde(skip_serializing_if = "Option::is_none")] ++ create_vault_record: Option, ++} ++ ++#[derive(Debug, Serialize, PartialEq)] ++pub struct CeleroAddress { ++ first_name: Option>, ++ last_name: Option>, ++ address_line_1: Option>, ++ address_line_2: Option>, ++ city: Option, ++ state: Option>, ++ postal_code: Option>, ++ country: Option, ++ phone: Option>, ++ email: Option, + } + +-#[derive(Default, Debug, Serialize, Eq, PartialEq)] ++impl TryFrom<&DomainAddress> for CeleroAddress { ++ type Error = error_stack::Report; ++ fn try_from(address: &DomainAddress) -> Result { ++ let address_details = address.address.as_ref(); ++ match address_details { ++ Some(address_details) => Ok(Self { ++ first_name: address_details.get_optional_first_name(), ++ last_name: address_details.get_optional_last_name(), ++ address_line_1: address_details.get_optional_line1(), ++ address_line_2: address_details.get_optional_line2(), ++ city: address_details.get_optional_city(), ++ state: address_details.get_optional_state(), ++ postal_code: address_details.get_optional_zip(), ++ country: address_details.get_optional_country(), ++ phone: address ++ .phone ++ .as_ref() ++ .and_then(|phone| phone.number.clone()), ++ email: address.email.clone(), ++ }), ++ None => Err(errors::ConnectorError::MissingRequiredField { ++ field_name: "address_details", ++ } ++ .into()), ++ } ++ } ++} ++ ++#[derive(Debug, Serialize, PartialEq)] ++#[serde(rename_all = "lowercase")] ++pub enum CeleroPaymentMethod { ++ Card(CeleroCard), ++} ++ ++#[derive(Debug, Serialize, PartialEq, Clone, Copy)] ++#[serde(rename_all = "lowercase")] ++pub enum CeleroEntryType { ++ Keyed, ++} ++ ++#[derive(Debug, Serialize, PartialEq)] + pub struct CeleroCard { ++ entry_type: CeleroEntryType, + number: cards::CardNumber, +- expiry_month: Secret, +- expiry_year: Secret, ++ expiration_date: Secret, + cvc: Secret, +- complete: bool, + } + +-impl TryFrom<&CeleroRouterData<&PaymentsAuthorizeRouterData>> for CeleroPaymentsRequest { ++impl TryFrom<&PaymentMethodData> for CeleroPaymentMethod { + type Error = error_stack::Report; +- fn try_from( +- item: &CeleroRouterData<&PaymentsAuthorizeRouterData>, +- ) -> Result { +- match item.router_data.request.payment_method_data.clone() { ++ fn try_from(item: &PaymentMethodData) -> Result { ++ match item { + PaymentMethodData::Card(req_card) => { + let card = CeleroCard { +- number: req_card.card_number, +- expiry_month: req_card.card_exp_month, +- expiry_year: req_card.card_exp_year, +- cvc: req_card.card_cvc, +- complete: item.router_data.request.is_auto_capture()?, ++ entry_type: CeleroEntryType::Keyed, ++ number: req_card.card_number.clone(), ++ expiration_date: Secret::new(format!( ++ "{}/{}", ++ req_card.card_exp_month.peek(), ++ req_card.card_exp_year.peek() ++ )), ++ cvc: req_card.card_cvc.clone(), + }; +- Ok(Self { +- amount: item.amount.clone(), +- card, +- }) ++ Ok(Self::Card(card)) + } +- _ => Err(errors::ConnectorError::NotImplemented("Payment method".to_string()).into()), ++ PaymentMethodData::CardDetailsForNetworkTransactionId(_) ++ | PaymentMethodData::CardRedirect(_) ++ | PaymentMethodData::Wallet(_) ++ | PaymentMethodData::PayLater(_) ++ | PaymentMethodData::BankRedirect(_) ++ | PaymentMethodData::BankDebit(_) ++ | PaymentMethodData::BankTransfer(_) ++ | PaymentMethodData::Crypto(_) ++ | PaymentMethodData::MandatePayment ++ | PaymentMethodData::Reward ++ | PaymentMethodData::RealTimePayment(_) ++ | PaymentMethodData::Upi(_) ++ | PaymentMethodData::Voucher(_) ++ | PaymentMethodData::GiftCard(_) ++ | PaymentMethodData::CardToken(_) ++ | PaymentMethodData::OpenBanking(_) ++ | PaymentMethodData::NetworkToken(_) ++ | PaymentMethodData::MobilePayment(_) => Err(errors::ConnectorError::NotImplemented( ++ "Selected payment method through celero".to_string(), ++ ) ++ .into()), + } + } + } + +-//TODO: Fill the struct with respective fields +-// Auth Struct ++// Implementation for handling 3DS specifically ++impl TryFrom<(&PaymentMethodData, bool)> for CeleroPaymentMethod { ++ type Error = error_stack::Report; ++ fn try_from((item, is_three_ds): (&PaymentMethodData, bool)) -> Result { ++ // If 3DS is requested, return an error ++ if is_three_ds { ++ return Err(errors::ConnectorError::NotSupported { ++ message: "Cards 3DS".to_string(), ++ connector: "celero", ++ } ++ .into()); ++ } ++ ++ // Otherwise, delegate to the standard implementation ++ Self::try_from(item) ++ } ++} ++ ++impl TryFrom<&CeleroRouterData<&PaymentsAuthorizeRouterData>> for CeleroPaymentsRequest { ++ type Error = error_stack::Report; ++ fn try_from( ++ item: &CeleroRouterData<&PaymentsAuthorizeRouterData>, ++ ) -> Result { ++ let is_auto_capture = item.router_data.request.is_auto_capture()?; ++ let transaction_type = if is_auto_capture { ++ TransactionType::Sale ++ } else { ++ TransactionType::Authorize ++ }; ++ ++ let billing_address: Option = item ++ .router_data ++ .get_optional_billing() ++ .and_then(|address| address.try_into().ok()); ++ ++ let shipping_address: Option = item ++ .router_data ++ .get_optional_shipping() ++ .and_then(|address| address.try_into().ok()); ++ ++ // Check if 3DS is requested ++ let is_three_ds = item.router_data.is_three_ds(); ++ ++ let request = Self { ++ idempotency_key: item.router_data.connector_request_reference_id.clone(), ++ transaction_type, ++ amount: item.amount, ++ currency: item.router_data.request.currency, ++ payment_method: CeleroPaymentMethod::try_from(( ++ &item.router_data.request.payment_method_data, ++ is_three_ds, ++ ))?, ++ billing_address, ++ shipping_address, ++ create_vault_record: Some(false), ++ }; ++ ++ Ok(request) ++ } ++} ++ ++// Auth Struct for CeleroCommerce API key authentication + pub struct CeleroAuthType { + pub(super) api_key: Secret, + } +@@ -84,38 +264,100 @@ impl TryFrom<&ConnectorAuthType> for CeleroAuthType { + fn try_from(auth_type: &ConnectorAuthType) -> Result { + match auth_type { + ConnectorAuthType::HeaderKey { api_key } => Ok(Self { +- api_key: api_key.to_owned(), ++ api_key: api_key.clone(), + }), + _ => Err(errors::ConnectorError::FailedToObtainAuthType.into()), + } + } + } +-// PaymentsResponse +-//TODO: Append the remaining status flags +-#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)] +-#[serde(rename_all = "lowercase")] +-pub enum CeleroPaymentStatus { +- Succeeded, +- Failed, +- #[default] +- Processing, ++// CeleroCommerce API Response Structures ++#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] ++pub enum CeleroResponseStatus { ++ #[serde(alias = "success", alias = "Success", alias = "SUCCESS")] ++ Success, ++ #[serde(alias = "error", alias = "Error", alias = "ERROR")] ++ Error, + } + +-impl From for common_enums::AttemptStatus { +- fn from(item: CeleroPaymentStatus) -> Self { ++#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq)] ++#[serde(rename_all = "snake_case")] ++pub enum CeleroTransactionStatus { ++ Approved, ++ Declined, ++ Error, ++ Pending, ++ PendingSettlement, ++ Settled, ++ Voided, ++ Reversed, ++} ++ ++impl From for common_enums::AttemptStatus { ++ fn from(item: CeleroTransactionStatus) -> Self { + match item { +- CeleroPaymentStatus::Succeeded => Self::Charged, +- CeleroPaymentStatus::Failed => Self::Failure, +- CeleroPaymentStatus::Processing => Self::Authorizing, ++ CeleroTransactionStatus::Approved => Self::Authorized, ++ CeleroTransactionStatus::Settled => Self::Charged, ++ CeleroTransactionStatus::Declined | CeleroTransactionStatus::Error => Self::Failure, ++ CeleroTransactionStatus::Pending | CeleroTransactionStatus::PendingSettlement => { ++ Self::Pending ++ } ++ CeleroTransactionStatus::Voided | CeleroTransactionStatus::Reversed => Self::Voided, + } + } + } ++#[serde_with::skip_serializing_none] ++#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] ++pub struct CeleroCardResponse { ++ pub status: CeleroTransactionStatus, ++ pub auth_code: Option, ++ pub processor_response_code: Option, ++ pub avs_response_code: Option, ++} + +-//TODO: Fill the struct with respective fields +-#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)] ++#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] ++#[serde(rename_all = "lowercase")] ++pub enum CeleroPaymentMethodResponse { ++ Card(CeleroCardResponse), ++} ++ ++#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] ++#[serde(rename_all = "lowercase")] ++pub enum TransactionType { ++ Sale, ++ Authorize, ++} ++#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)] ++#[serde_with::skip_serializing_none] ++pub struct CeleroTransactionResponseData { ++ pub id: String, ++ #[serde(rename = "type")] ++ pub transaction_type: TransactionType, ++ pub amount: i64, ++ pub currency: String, ++ pub response: CeleroPaymentMethodResponse, ++ pub billing_address: Option, ++ pub shipping_address: Option, ++} ++ ++#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)] ++pub struct CeleroAddressResponse { ++ first_name: Option>, ++ last_name: Option>, ++ address_line_1: Option>, ++ address_line_2: Option>, ++ city: Option, ++ state: Option>, ++ postal_code: Option>, ++ country: Option, ++ phone: Option>, ++ email: Option>, ++} ++ ++#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)] + pub struct CeleroPaymentsResponse { +- status: CeleroPaymentStatus, +- id: String, ++ pub status: CeleroResponseStatus, ++ pub msg: String, ++ pub data: Option, + } + + impl TryFrom> +@@ -125,104 +367,508 @@ impl TryFrom, + ) -> Result { +- Ok(Self { +- status: common_enums::AttemptStatus::from(item.response.status), +- response: Ok(PaymentsResponseData::TransactionResponse { +- resource_id: ResponseId::ConnectorTransactionId(item.response.id), +- redirection_data: Box::new(None), +- mandate_reference: Box::new(None), +- connector_metadata: None, +- network_txn_id: None, +- connector_response_reference_id: None, +- incremental_authorization_allowed: None, +- charges: None, +- }), +- ..item.data +- }) ++ match item.response.status { ++ CeleroResponseStatus::Success => { ++ if let Some(data) = item.response.data { ++ let CeleroPaymentMethodResponse::Card(response) = &data.response; ++ // Check if transaction itself failed despite successful API call ++ match response.status { ++ CeleroTransactionStatus::Declined | CeleroTransactionStatus::Error => { ++ // Transaction failed - create error response with transaction details ++ let error_details = CeleroErrorDetails::from_transaction_response( ++ response, ++ item.response.msg, ++ ); ++ ++ Ok(Self { ++ status: common_enums::AttemptStatus::Failure, ++ response: Err( ++ hyperswitch_domain_models::router_data::ErrorResponse { ++ code: error_details ++ .error_code ++ .unwrap_or_else(|| "TRANSACTION_FAILED".to_string()), ++ message: error_details.error_message, ++ reason: error_details.decline_reason, ++ status_code: item.http_code, ++ attempt_status: None, ++ connector_transaction_id: Some(data.id), ++ network_decline_code: None, ++ network_advice_code: None, ++ network_error_message: None, ++ connector_metadata: None, ++ }, ++ ), ++ ..item.data ++ }) ++ } ++ _ => { ++ let connector_response_data = ++ convert_to_additional_payment_method_connector_response( ++ response.avs_response_code.clone(), ++ ) ++ .map(ConnectorResponseData::with_additional_payment_method_data); ++ let final_status: enums::AttemptStatus = response.status.into(); ++ Ok(Self { ++ status: final_status, ++ response: Ok(PaymentsResponseData::TransactionResponse { ++ resource_id: ResponseId::ConnectorTransactionId(data.id), ++ redirection_data: Box::new(None), ++ mandate_reference: Box::new(None), ++ connector_metadata: None, ++ network_txn_id: None, ++ connector_response_reference_id: response.auth_code.clone(), ++ incremental_authorization_allowed: None, ++ charges: None, ++ }), ++ connector_response: connector_response_data, ++ ..item.data ++ }) ++ } ++ } ++ } else { ++ // No transaction data in successful response ++ Ok(Self { ++ status: common_enums::AttemptStatus::Failure, ++ response: Err(hyperswitch_domain_models::router_data::ErrorResponse { ++ code: "MISSING_DATA".to_string(), ++ message: "No transaction data in response".to_string(), ++ reason: Some(item.response.msg), ++ status_code: item.http_code, ++ attempt_status: None, ++ connector_transaction_id: None, ++ network_decline_code: None, ++ network_advice_code: None, ++ network_error_message: None, ++ connector_metadata: None, ++ }), ++ ..item.data ++ }) ++ } ++ } ++ CeleroResponseStatus::Error => { ++ // Top-level API error ++ let error_details = ++ CeleroErrorDetails::from_top_level_error(item.response.msg.clone()); ++ ++ Ok(Self { ++ status: common_enums::AttemptStatus::Failure, ++ response: Err(hyperswitch_domain_models::router_data::ErrorResponse { ++ code: error_details ++ .error_code ++ .unwrap_or_else(|| "API_ERROR".to_string()), ++ message: error_details.error_message, ++ reason: error_details.decline_reason, ++ status_code: item.http_code, ++ attempt_status: None, ++ connector_transaction_id: None, ++ network_decline_code: None, ++ network_advice_code: None, ++ network_error_message: None, ++ connector_metadata: None, ++ }), ++ ..item.data ++ }) ++ } ++ } + } + } + +-//TODO: Fill the struct with respective fields +-// REFUND : +-// Type definition for RefundRequest ++// CAPTURE: ++// Type definition for CaptureRequest + #[derive(Default, Debug, Serialize)] +-pub struct CeleroRefundRequest { +- pub amount: StringMinorUnit, ++pub struct CeleroCaptureRequest { ++ pub amount: MinorUnit, ++ #[serde(skip_serializing_if = "Option::is_none")] ++ pub order_id: Option, + } + +-impl TryFrom<&CeleroRouterData<&RefundsRouterData>> for CeleroRefundRequest { ++impl TryFrom<&CeleroRouterData<&PaymentsCaptureRouterData>> for CeleroCaptureRequest { + type Error = error_stack::Report; +- fn try_from(item: &CeleroRouterData<&RefundsRouterData>) -> Result { ++ fn try_from(item: &CeleroRouterData<&PaymentsCaptureRouterData>) -> Result { + Ok(Self { +- amount: item.amount.to_owned(), ++ amount: item.amount, ++ order_id: Some(item.router_data.payment_id.clone()), + }) + } + } + +-// Type definition for Refund Response +- +-#[allow(dead_code)] +-#[derive(Debug, Serialize, Default, Deserialize, Clone)] +-pub enum RefundStatus { +- Succeeded, +- Failed, +- #[default] +- Processing, ++// CeleroCommerce Capture Response ++#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] ++pub struct CeleroCaptureResponse { ++ pub status: CeleroResponseStatus, ++ pub msg: Option, ++ pub data: Option, // Usually null for capture responses + } + +-impl From for enums::RefundStatus { +- fn from(item: RefundStatus) -> Self { +- match item { +- RefundStatus::Succeeded => Self::Success, +- RefundStatus::Failed => Self::Failure, +- RefundStatus::Processing => Self::Pending, +- //TODO: Review mapping ++impl ++ TryFrom< ++ ResponseRouterData< ++ Capture, ++ CeleroCaptureResponse, ++ PaymentsCaptureData, ++ PaymentsResponseData, ++ >, ++ > for RouterData ++{ ++ type Error = error_stack::Report; ++ fn try_from( ++ item: ResponseRouterData< ++ Capture, ++ CeleroCaptureResponse, ++ PaymentsCaptureData, ++ PaymentsResponseData, ++ >, ++ ) -> Result { ++ match item.response.status { ++ CeleroResponseStatus::Success => Ok(Self { ++ status: common_enums::AttemptStatus::Charged, ++ response: Ok(PaymentsResponseData::TransactionResponse { ++ resource_id: ResponseId::ConnectorTransactionId( ++ item.data.request.connector_transaction_id.clone(), ++ ), ++ redirection_data: Box::new(None), ++ mandate_reference: Box::new(None), ++ connector_metadata: None, ++ network_txn_id: None, ++ connector_response_reference_id: None, ++ incremental_authorization_allowed: None, ++ charges: None, ++ }), ++ ..item.data ++ }), ++ CeleroResponseStatus::Error => Ok(Self { ++ status: common_enums::AttemptStatus::Failure, ++ response: Err(hyperswitch_domain_models::router_data::ErrorResponse { ++ code: "CAPTURE_FAILED".to_string(), ++ message: item ++ .response ++ .msg ++ .clone() ++ .unwrap_or(consts::NO_ERROR_MESSAGE.to_string()), ++ reason: None, ++ status_code: item.http_code, ++ attempt_status: None, ++ connector_transaction_id: Some( ++ item.data.request.connector_transaction_id.clone(), ++ ), ++ network_decline_code: None, ++ network_advice_code: None, ++ network_error_message: None, ++ connector_metadata: None, ++ }), ++ ..item.data ++ }), + } + } + } + +-//TODO: Fill the struct with respective fields +-#[derive(Default, Debug, Clone, Serialize, Deserialize)] +-pub struct RefundResponse { +- id: String, +- status: RefundStatus, ++// CeleroCommerce Void Response - matches API spec format ++#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] ++pub struct CeleroVoidResponse { ++ pub status: CeleroResponseStatus, ++ pub msg: String, ++ pub data: Option, // Usually null for void responses + } + +-impl TryFrom> for RefundsRouterData { ++impl ++ TryFrom< ++ ResponseRouterData< ++ hyperswitch_domain_models::router_flow_types::payments::Void, ++ CeleroVoidResponse, ++ hyperswitch_domain_models::router_request_types::PaymentsCancelData, ++ PaymentsResponseData, ++ >, ++ > ++ for RouterData< ++ hyperswitch_domain_models::router_flow_types::payments::Void, ++ hyperswitch_domain_models::router_request_types::PaymentsCancelData, ++ PaymentsResponseData, ++ > ++{ + type Error = error_stack::Report; + fn try_from( +- item: RefundsResponseRouterData, ++ item: ResponseRouterData< ++ hyperswitch_domain_models::router_flow_types::payments::Void, ++ CeleroVoidResponse, ++ hyperswitch_domain_models::router_request_types::PaymentsCancelData, ++ PaymentsResponseData, ++ >, + ) -> Result { +- Ok(Self { +- response: Ok(RefundsResponseData { +- connector_refund_id: item.response.id.to_string(), +- refund_status: enums::RefundStatus::from(item.response.status), ++ match item.response.status { ++ CeleroResponseStatus::Success => Ok(Self { ++ status: common_enums::AttemptStatus::Voided, ++ response: Ok(PaymentsResponseData::TransactionResponse { ++ resource_id: ResponseId::ConnectorTransactionId( ++ item.data.request.connector_transaction_id.clone(), ++ ), ++ redirection_data: Box::new(None), ++ mandate_reference: Box::new(None), ++ connector_metadata: None, ++ network_txn_id: None, ++ connector_response_reference_id: None, ++ incremental_authorization_allowed: None, ++ charges: None, ++ }), ++ ..item.data ++ }), ++ CeleroResponseStatus::Error => Ok(Self { ++ status: common_enums::AttemptStatus::Failure, ++ response: Err(hyperswitch_domain_models::router_data::ErrorResponse { ++ code: "VOID_FAILED".to_string(), ++ message: item.response.msg.clone(), ++ reason: Some(item.response.msg), ++ status_code: item.http_code, ++ attempt_status: None, ++ connector_transaction_id: Some( ++ item.data.request.connector_transaction_id.clone(), ++ ), ++ network_decline_code: None, ++ network_advice_code: None, ++ network_error_message: None, ++ connector_metadata: None, ++ }), ++ ..item.data + }), +- ..item.data ++ } ++ } ++} ++#[derive(Default, Debug, Serialize)] ++pub struct CeleroRefundRequest { ++ pub amount: MinorUnit, ++ pub surcharge: MinorUnit, // Required field as per API specification ++} ++ ++impl TryFrom<&CeleroRouterData<&RefundsRouterData>> for CeleroRefundRequest { ++ type Error = error_stack::Report; ++ fn try_from(item: &CeleroRouterData<&RefundsRouterData>) -> Result { ++ Ok(Self { ++ amount: item.amount, ++ surcharge: MinorUnit::zero(), // Default to 0 as per API specification + }) + } + } + +-impl TryFrom> for RefundsRouterData { ++// CeleroCommerce Refund Response - matches API spec format ++#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] ++pub struct CeleroRefundResponse { ++ pub status: CeleroResponseStatus, ++ pub msg: String, ++ pub data: Option, // Usually null for refund responses ++} ++ ++impl TryFrom> ++ for RefundsRouterData ++{ + type Error = error_stack::Report; + fn try_from( +- item: RefundsResponseRouterData, ++ item: RefundsResponseRouterData, + ) -> Result { +- Ok(Self { +- response: Ok(RefundsResponseData { +- connector_refund_id: item.response.id.to_string(), +- refund_status: enums::RefundStatus::from(item.response.status), ++ match item.response.status { ++ CeleroResponseStatus::Success => Ok(Self { ++ response: Ok(RefundsResponseData { ++ connector_refund_id: item.data.request.refund_id.clone(), ++ refund_status: enums::RefundStatus::Success, ++ }), ++ ..item.data + }), +- ..item.data +- }) ++ CeleroResponseStatus::Error => Ok(Self { ++ response: Err(hyperswitch_domain_models::router_data::ErrorResponse { ++ code: "REFUND_FAILED".to_string(), ++ message: item.response.msg.clone(), ++ reason: Some(item.response.msg), ++ status_code: item.http_code, ++ attempt_status: None, ++ connector_transaction_id: Some( ++ item.data.request.connector_transaction_id.clone(), ++ ), ++ network_decline_code: None, ++ network_advice_code: None, ++ network_error_message: None, ++ connector_metadata: None, ++ }), ++ ..item.data ++ }), ++ } + } + } + +-//TODO: Fill the struct with respective fields +-#[derive(Default, Debug, Serialize, Deserialize, PartialEq)] ++impl TryFrom> for RefundsRouterData { ++ type Error = error_stack::Report; ++ fn try_from( ++ item: RefundsResponseRouterData, ++ ) -> Result { ++ match item.response.status { ++ CeleroResponseStatus::Success => Ok(Self { ++ response: Ok(RefundsResponseData { ++ connector_refund_id: item.data.request.refund_id.clone(), ++ refund_status: enums::RefundStatus::Success, ++ }), ++ ..item.data ++ }), ++ CeleroResponseStatus::Error => Ok(Self { ++ response: Err(hyperswitch_domain_models::router_data::ErrorResponse { ++ code: "REFUND_SYNC_FAILED".to_string(), ++ message: item.response.msg.clone(), ++ reason: Some(item.response.msg), ++ status_code: item.http_code, ++ attempt_status: None, ++ connector_transaction_id: Some( ++ item.data.request.connector_transaction_id.clone(), ++ ), ++ network_decline_code: None, ++ network_advice_code: None, ++ network_error_message: None, ++ connector_metadata: None, ++ }), ++ ..item.data ++ }), ++ } ++ } ++} ++ ++// CeleroCommerce Error Response Structures ++ ++// Main error response structure - matches API spec format ++#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] + pub struct CeleroErrorResponse { +- pub status_code: u16, +- pub code: String, +- pub message: String, +- pub reason: Option, ++ pub status: CeleroResponseStatus, ++ pub msg: String, ++ #[serde(skip_serializing_if = "Option::is_none")] ++ pub data: Option, ++} ++ ++// Error details that can be extracted from various response fields ++#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] ++pub struct CeleroErrorDetails { ++ pub error_code: Option, ++ pub error_message: String, ++ pub processor_response_code: Option, ++ pub decline_reason: Option, ++} ++ ++impl From for CeleroErrorDetails { ++ fn from(error_response: CeleroErrorResponse) -> Self { ++ Self { ++ error_code: Some("API_ERROR".to_string()), ++ error_message: error_response.msg, ++ processor_response_code: None, ++ decline_reason: None, ++ } ++ } ++} ++ ++// Function to extract error details from transaction response data ++impl CeleroErrorDetails { ++ pub fn from_transaction_response(response: &CeleroCardResponse, msg: String) -> Self { ++ // Map specific error codes based on common response patterns ++ let decline_reason = Self::map_processor_error(&response.processor_response_code, &msg); ++ ++ Self { ++ error_code: None, ++ error_message: msg, ++ processor_response_code: response.processor_response_code.clone(), ++ decline_reason, ++ } ++ } ++ ++ pub fn from_top_level_error(msg: String) -> Self { ++ // Map specific error codes from top-level API errors ++ ++ Self { ++ error_code: None, ++ error_message: msg, ++ processor_response_code: None, ++ decline_reason: None, ++ } ++ } ++ ++ /// Map processor response codes and messages to specific Hyperswitch error codes ++ fn map_processor_error(processor_code: &Option, message: &str) -> Option { ++ let message_lower = message.to_lowercase(); ++ // Check processor response codes if available ++ if let Some(code) = processor_code { ++ match code.as_str() { ++ "05" => Some("TRANSACTION_DECLINED".to_string()), ++ "14" => Some("INVALID_CARD_DATA".to_string()), ++ "51" => Some("INSUFFICIENT_FUNDS".to_string()), ++ "54" => Some("EXPIRED_CARD".to_string()), ++ "55" => Some("INCORRECT_CVC".to_string()), ++ "61" => Some("Exceeds withdrawal amount limit".to_string()), ++ "62" => Some("TRANSACTION_DECLINED".to_string()), ++ "65" => Some("Exceeds withdrawal frequency limit".to_string()), ++ "78" => Some("INVALID_CARD_DATA".to_string()), ++ "91" => Some("PROCESSING_ERROR".to_string()), ++ "96" => Some("PROCESSING_ERROR".to_string()), ++ _ => { ++ router_env::logger::info!( ++ "Celero response error code ({:?}) is not mapped to any error state ", ++ code ++ ); ++ Some("Transaction failed".to_string()) ++ } ++ } ++ } else { ++ Some(message_lower) ++ } ++ } ++} ++ ++pub fn get_avs_definition(code: &str) -> Option<&'static str> { ++ match code { ++ "0" => Some("AVS Not Available"), ++ "A" => Some("Address match only"), ++ "B" => Some("Address matches, ZIP not verified"), ++ "C" => Some("Incompatible format"), ++ "D" => Some("Exact match"), ++ "F" => Some("Exact match, UK-issued cards"), ++ "G" => Some("Non-U.S. Issuer does not participate"), ++ "I" => Some("Not verified"), ++ "M" => Some("Exact match"), ++ "N" => Some("No address or ZIP match"), ++ "P" => Some("Postal Code match"), ++ "R" => Some("Issuer system unavailable"), ++ "S" => Some("Service not supported"), ++ "U" => Some("Address unavailable"), ++ "W" => Some("9-character numeric ZIP match only"), ++ "X" => Some("Exact match, 9-character numeric ZIP"), ++ "Y" => Some("Exact match, 5-character numeric ZIP"), ++ "Z" => Some("5-character ZIP match only"), ++ "L" => Some("Partial match, Name and billing postal code match"), ++ "1" => Some("Cardholder name and ZIP match"), ++ "2" => Some("Cardholder name, address and ZIP match"), ++ "3" => Some("Cardholder name and address match"), ++ "4" => Some("Cardholder name matches"), ++ "5" => Some("Cardholder name incorrect, ZIP matches"), ++ "6" => Some("Cardholder name incorrect, address and zip match"), ++ "7" => Some("Cardholder name incorrect, address matches"), ++ "8" => Some("Cardholder name, address, and ZIP do not match"), ++ _ => { ++ router_env::logger::info!( ++ "Celero avs response code ({:?}) is not mapped to any defination.", ++ code ++ ); ++ ++ None ++ } // No definition found for the given code ++ } ++} ++fn convert_to_additional_payment_method_connector_response( ++ response_code: Option, ++) -> Option { ++ match response_code { ++ None => None, ++ Some(code) => { ++ let description = get_avs_definition(&code); ++ let payment_checks = serde_json::json!({ ++ "avs_result_code": code, ++ "description": description ++ }); ++ Some(AdditionalPaymentMethodConnectorResponse::Card { ++ authentication_data: None, ++ payment_checks: Some(payment_checks), ++ card_network: None, ++ domestic_network: None, ++ }) ++ } ++ } + } +diff --git a/crates/payment_methods/src/configs/payment_connector_required_fields.rs b/crates/payment_methods/src/configs/payment_connector_required_fields.rs +index 5ce306c5..15a4ef90 100644 +--- a/crates/payment_methods/src/configs/payment_connector_required_fields.rs ++++ b/crates/payment_methods/src/configs/payment_connector_required_fields.rs +@@ -1305,6 +1305,7 @@ fn get_cards_required_fields() -> HashMap { + ), + (Connector::Boku, fields(vec![], vec![], card_basic())), + (Connector::Braintree, fields(vec![], vec![], card_basic())), ++ (Connector::Celero, fields(vec![], vec![], card_basic())), + (Connector::Checkout, fields(vec![], card_basic(), vec![])), + ( + Connector::Coinbase, +diff --git a/cypress-tests/README.md b/cypress-tests/README.md +index 82e8c22c..0518a271 100644 +--- a/cypress-tests/README.md ++++ b/cypress-tests/README.md +@@ -374,6 +374,55 @@ npm run lint -- --fix + 8. Use custom commands for repetitive tasks + 9. Use `cy.log` for debugging and do not use `console.log` + ++## Mock Server ++ ++The cypress-tests directory includes a mock server for simulating payment processor APIs during testing. ++ ++### Architecture ++ ++The mock server follows a router-based architecture: ++ ++- `mockserver.js` - Main entry point that starts the Express server ++- `router.js` - Central router that forwards requests to connector-specific routers ++- Connector implementations (e.g., `Silverflow.js`) - Individual router implementations for each payment processor ++ ++Each connector exports an Express router that is imported by the main router. This modular approach allows for easy addition of new connectors and simplified maintenance. ++ ++### Running the Mock Server ++ ++To start the mock server: ++ ++```bash ++npm run mockserver ++``` ++ ++By default, the server runs on port 3010. You can change this by setting the `MOCKSERVER_PORT` environment variable: ++ ++```bash ++MOCKSERVER_PORT=3010 npm run mockserver ++``` ++ ++### Testing with cURL ++ ++Example curl command for testing the Silverflow API: ++ ++```bash ++curl -X POST "http://localhost:3010/silverflow/charges" \ ++-H "Content-Type: application/json" \ ++-H "Authorization: Basic YXBrLXRlc3RrZXkxMjM6dGVzdHNlY3JldDQ1Ng==" \ ++-d '{"merchantAcceptorResolver":"merchant123","card":{"number":"4111111111111111","expMonth":12,"expYear":2025,"cvc":"123"},"amount":{"value":1000,"currency":"USD"},"type":"authorization","clearingMode":"auto"}' ++``` ++ ++### Using with Hyperswitch ++ ++To use the mock server with Hyperswitch, you need to redirect the base URL for the Silverflow connector to the mock server. Run Hyperswitch with the following environment variable: ++ ++```bash ++ROUTER__CONNECTORS__SILVERFLOW__BASE_URL=http://localhost:3010/silverflow cargo r ++``` ++ ++This will redirect all Silverflow API calls from Hyperswitch to your local mock server instead of the actual Silverflow API. ++ + ## Additional Resources + + - [Cypress Documentation](https://docs.cypress.io/) +diff --git a/cypress-tests/cypress/e2e/configs/Payment/Celero.js b/cypress-tests/cypress/e2e/configs/Payment/Celero.js +new file mode 100644 +index 00000000..8f908f68 +--- /dev/null ++++ b/cypress-tests/cypress/e2e/configs/Payment/Celero.js +@@ -0,0 +1,1069 @@ ++import { cardRequiredField, customerAcceptance } from "./Commons"; ++import { getCustomExchange } from "./Modifiers"; ++ ++// ============================================================================ ++// CELERO CYPRESS TEST CONFIGURATION ++// ============================================================================ ++// Core functionality based on Celero API specification: ++// - Non-3DS card payments (auto/manual capture) ++// - Refund operations (full/partial/sync) ++// - Void operations ++// - Basic failure scenarios ++// ============================================================================ ++ ++// ===== TEST CARD DATA ===== ++ ++const successfulNo3DSCardDetails = { ++ card_number: "4111111111111111", // Visa test card ++ card_exp_month: "12", ++ card_exp_year: "30", ++ card_holder_name: "Test User", ++ card_cvc: "123", ++}; ++ ++const failedCardDetails = { ++ card_number: "4000000000000002", // Generic declined card ++ card_exp_month: "12", ++ card_exp_year: "30", ++ card_holder_name: "Test User", ++ card_cvc: "123", ++}; ++ ++// ===== BILLING INFORMATION ===== ++ ++const billingAddress = { ++ address: { ++ line1: "1467 Harrison Street", ++ line2: "Apt 12", ++ city: "San Francisco", ++ state: "California", ++ zip: "94122", ++ country: "US", ++ first_name: "Test", ++ last_name: "User", ++ }, ++ phone: { ++ number: "4155551234", ++ country_code: "+1", ++ }, ++}; ++ ++// ===== PAYMENT METHOD DATA ===== ++ ++const payment_method_data_amex = { ++ card: { ++ last4: "0005", ++ card_type: "CREDIT", ++ card_network: "AmericanExpress", ++ card_issuer: null, ++ card_issuing_country: null, ++ card_isin: "378282", ++ card_extended_bin: null, ++ card_exp_month: "12", ++ card_exp_year: "30", ++ card_holder_name: "Test User", ++ payment_checks: null, ++ authentication_data: null, ++ }, ++ billing: null, ++}; ++ ++const payment_method_data_failed = { ++ card: { ++ last4: "0002", ++ card_type: "CREDIT", ++ card_network: "Visa", ++ card_issuer: "INTL HDQTRS-CENTER OWNED", ++ card_issuing_country: "UNITEDSTATES", ++ card_isin: "400000", ++ card_extended_bin: null, ++ card_exp_month: "12", ++ card_exp_year: "30", ++ card_holder_name: "Test User", ++ payment_checks: null, ++ authentication_data: null, ++ }, ++ billing: null, ++}; ++ ++// ===== REQUIRED FIELDS ===== ++ ++const requiredFields = { ++ payment_methods: [ ++ { ++ payment_method: "card", ++ payment_method_types: [ ++ { ++ payment_method_type: "credit", ++ card_networks: [ ++ { ++ eligible_connectors: ["celero"], ++ }, ++ ], ++ required_fields: cardRequiredField, ++ }, ++ { ++ payment_method_type: "debit", ++ card_networks: [ ++ { ++ eligible_connectors: ["celero"], ++ }, ++ ], ++ required_fields: cardRequiredField, ++ }, ++ ], ++ }, ++ ], ++}; ++ ++// ===== MAIN CONNECTOR DETAILS ===== ++ ++export const connectorDetails = { ++ card_pm: { ++ // Basic payment intent ++ PaymentIntent: { ++ Request: { ++ currency: "USD", ++ customer_acceptance: null, ++ setup_future_usage: null, ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "requires_payment_method", ++ setup_future_usage: null, ++ }, ++ }, ++ }, ++ ++ // Successful automatic capture ++ No3DSAutoCapture: { ++ Request: { ++ payment_method: "card", ++ payment_method_data: { ++ card: successfulNo3DSCardDetails, ++ }, ++ billing: billingAddress, ++ currency: "USD", ++ customer_acceptance: null, ++ setup_future_usage: null, ++ capture_method: "automatic", ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "succeeded", ++ payment_method: "card", ++ attempt_count: 1, ++ }, ++ }, ++ }, ++ ++ // Successful manual capture (requires capture) ++ No3DSManualCapture: { ++ Request: { ++ payment_method: "card", ++ payment_method_data: { ++ card: successfulNo3DSCardDetails, ++ }, ++ billing: billingAddress, ++ currency: "USD", ++ customer_acceptance: null, ++ setup_future_usage: null, ++ capture_method: "manual", ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "requires_capture", ++ payment_method: "card", ++ attempt_count: 1, ++ }, ++ }, ++ }, ++ ++ // Failed payment ++ No3DSFailPayment: { ++ Request: { ++ payment_method: "card", ++ payment_method_data: { ++ card: failedCardDetails, ++ }, ++ billing: billingAddress, ++ customer_acceptance: null, ++ setup_future_usage: null, ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "failed", ++ error_code: "TRANSACTION_FAILED", ++ error_message: "TRANSACTION_DECLINED", ++ payment_method: "card", ++ attempt_count: 1, ++ payment_method_data: payment_method_data_failed, ++ }, ++ }, ++ }, ++ ++ // Capture operation ++ Capture: { ++ Request: { ++ amount_to_capture: 6000, ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "succeeded", ++ amount: 6000, ++ amount_capturable: 0, ++ amount_received: 6000, ++ }, ++ }, ++ }, ++ ++ // Partial capture ++ PartialCapture: { ++ Request: { ++ amount_to_capture: 3000, ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "partially_captured", ++ amount: 6000, ++ amount_capturable: 0, ++ amount_received: 3000, ++ }, ++ }, ++ }, ++ ++ // Void payment (cancel authorized payment) ++ Void: { ++ Request: { ++ cancellation_reason: "requested_by_customer", ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "cancelled", ++ payment_method: null, ++ attempt_count: 1, ++ }, ++ }, ++ }, ++ ++ // Full refund ++ Refund: { ++ Request: { ++ amount: 6000, ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "succeeded", ++ }, ++ }, ++ }, ++ ++ // Partial refund ++ PartialRefund: { ++ Request: { ++ amount: 2000, ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "succeeded", ++ }, ++ }, ++ }, ++ ++ // Refund sync ++ SyncRefund: { ++ Response: { ++ status: 200, ++ body: { ++ status: "succeeded", ++ }, ++ }, ++ }, ++ ++ // Manual payment refund ++ manualPaymentRefund: { ++ Request: { ++ amount: 6000, ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "succeeded", ++ }, ++ }, ++ }, ++ ++ // Manual payment partial refund ++ manualPaymentPartialRefund: { ++ Request: { ++ amount: 3000, ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "succeeded", ++ }, ++ }, ++ }, ++ ++ // Payment sync ++ SyncPayment: { ++ Response: { ++ status: 200, ++ body: { ++ status: "succeeded", ++ payment_method: "card", ++ }, ++ }, ++ }, ++ ++ // Payment with shipping cost ++ PaymentIntentWithShippingCost: { ++ Request: { ++ currency: "USD", ++ shipping_cost: 50, ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "requires_payment_method", ++ shipping_cost: 50, ++ amount: 6000, ++ }, ++ }, ++ }, ++ ++ PaymentConfirmWithShippingCost: { ++ Request: { ++ payment_method: "card", ++ payment_method_data: { ++ card: successfulNo3DSCardDetails, ++ }, ++ billing: billingAddress, ++ customer_acceptance: null, ++ setup_future_usage: null, ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "succeeded", ++ payment_method: "card", ++ shipping_cost: 50, ++ amount_received: 6050, ++ amount: 6000, ++ net_amount: 6050, ++ }, ++ }, ++ }, ++ ++ // American Express card test ++ AmexCardPayment: { ++ Request: { ++ payment_method: "card", ++ payment_method_data: { ++ card: successfulNo3DSCardDetails, ++ }, ++ billing: billingAddress, ++ currency: "USD", ++ customer_acceptance: null, ++ setup_future_usage: null, ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "succeeded", ++ payment_method: "card", ++ attempt_count: 1, ++ payment_method_data: payment_method_data_amex, ++ }, ++ }, ++ }, ++ ++ // Celero doesn't support 3DS, mandates, save card, etc. ++ ++ "3DSManualCapture": getCustomExchange({ ++ Configs: { ++ TRIGGER_SKIP: true, // Skip - 3DS not implemented ++ }, ++ Request: { ++ payment_method: "card", ++ payment_method_data: { ++ card: successfulNo3DSCardDetails, ++ }, ++ }, ++ Response: { ++ status: 400, ++ body: { ++ error: { ++ type: "invalid_request", ++ }, ++ }, ++ }, ++ }), ++ ++ MandateSingleUseNo3DSAutoCapture: getCustomExchange({ ++ Configs: { ++ TRIGGER_SKIP: true, // Mandates not supported ++ }, ++ Request: { ++ payment_method: "card", ++ payment_method_data: { ++ card: successfulNo3DSCardDetails, ++ }, ++ currency: "USD", ++ mandate_data: { ++ customer_acceptance: customerAcceptance, ++ mandate_type: { ++ single_use: { ++ amount: 8000, ++ currency: "USD", ++ }, ++ }, ++ }, ++ }, ++ Response: { ++ status: 400, ++ body: {}, ++ }, ++ }), ++ ++ MandateSingleUseNo3DSManualCapture: getCustomExchange({ ++ Configs: { ++ TRIGGER_SKIP: true, // Mandates not supported ++ }, ++ Request: { ++ payment_method: "card", ++ payment_method_data: { ++ card: successfulNo3DSCardDetails, ++ }, ++ currency: "USD", ++ mandate_data: { ++ customer_acceptance: customerAcceptance, ++ mandate_type: { ++ single_use: { ++ amount: 8000, ++ currency: "USD", ++ }, ++ }, ++ }, ++ capture_method: "manual", ++ }, ++ Response: { ++ status: 400, ++ body: {}, ++ }, ++ }), ++ ++ MandateMultiUseNo3DSAutoCapture: getCustomExchange({ ++ Configs: { ++ TRIGGER_SKIP: true, // Mandates not supported ++ }, ++ Request: { ++ payment_method: "card", ++ payment_method_data: { ++ card: successfulNo3DSCardDetails, ++ }, ++ currency: "USD", ++ mandate_data: { ++ customer_acceptance: customerAcceptance, ++ mandate_type: { ++ multi_use: { ++ amount: 8000, ++ currency: "USD", ++ }, ++ }, ++ }, ++ }, ++ Response: { ++ status: 400, ++ body: {}, ++ }, ++ }), ++ ++ MandateMultiUseNo3DSManualCapture: getCustomExchange({ ++ Configs: { ++ TRIGGER_SKIP: true, // Mandates not supported ++ }, ++ Request: { ++ payment_method: "card", ++ payment_method_data: { ++ card: successfulNo3DSCardDetails, ++ }, ++ currency: "USD", ++ mandate_data: { ++ customer_acceptance: customerAcceptance, ++ mandate_type: { ++ multi_use: { ++ amount: 8000, ++ currency: "USD", ++ }, ++ }, ++ }, ++ capture_method: "manual", ++ }, ++ Response: { ++ status: 400, ++ body: {}, ++ }, ++ }), ++ ++ SaveCardUseNo3DSAutoCapture: getCustomExchange({ ++ Configs: { ++ TRIGGER_SKIP: true, // Skip if Celero doesn't support save card ++ }, ++ Request: { ++ payment_method: "card", ++ payment_method_data: { ++ card: successfulNo3DSCardDetails, ++ }, ++ currency: "USD", ++ setup_future_usage: "on_session", ++ customer_acceptance: customerAcceptance, ++ }, ++ Response: { ++ status: 400, ++ body: { ++ status: "succeeded", ++ }, ++ }, ++ }), ++ ++ SaveCardUseNo3DSManualCapture: getCustomExchange({ ++ Configs: { ++ TRIGGER_SKIP: true, // Skip if Celero doesn't support save card ++ }, ++ Request: { ++ payment_method: "card", ++ payment_method_data: { ++ card: successfulNo3DSCardDetails, ++ }, ++ currency: "USD", ++ setup_future_usage: "on_session", ++ customer_acceptance: customerAcceptance, ++ capture_method: "manual", ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "requires_capture", ++ }, ++ }, ++ }), ++ ++ // ===== 3DS SAVE CARD SCENARIOS ===== ++ // Note: Celero doesn't support 3DS or save card, marked as TRIGGER_SKIP ++ ++ SaveCardUse3DSAutoCapture: getCustomExchange({ ++ Configs: { ++ TRIGGER_SKIP: true, // Skip - 3DS and save card not implemented ++ }, ++ Request: { ++ payment_method: "card", ++ payment_method_data: { ++ card: successfulNo3DSCardDetails, ++ }, ++ currency: "USD", ++ setup_future_usage: "on_session", ++ customer_acceptance: customerAcceptance, ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "requires_customer_action", ++ }, ++ }, ++ }), ++ ++ SaveCardUse3DSManualCapture: getCustomExchange({ ++ Configs: { ++ TRIGGER_SKIP: true, // Skip - 3DS and save card not implemented ++ }, ++ Request: { ++ payment_method: "card", ++ payment_method_data: { ++ card: successfulNo3DSCardDetails, ++ }, ++ currency: "USD", ++ setup_future_usage: "on_session", ++ customer_acceptance: customerAcceptance, ++ capture_method: "manual", ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "requires_customer_action", ++ }, ++ }, ++ }), ++ ++ // ===== OFF-SESSION SAVE CARD SCENARIOS ===== ++ // Note: Celero doesn't support off-session or save card, marked as TRIGGER_SKIP ++ ++ SaveCardUseNo3DSAutoCaptureOffSession: getCustomExchange({ ++ Configs: { ++ TRIGGER_SKIP: true, // Skip if Celero doesn't support off-session save card ++ }, ++ Request: { ++ payment_method: "card", ++ payment_method_data: { ++ card: successfulNo3DSCardDetails, ++ }, ++ setup_future_usage: "off_session", ++ customer_acceptance: customerAcceptance, ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "succeeded", ++ }, ++ }, ++ }), ++ ++ SaveCardUse3DSAutoCaptureOffSession: getCustomExchange({ ++ Configs: { ++ TRIGGER_SKIP: true, // Skip - 3DS and off-session save card not supported ++ }, ++ Request: { ++ payment_method: "card", ++ payment_method_data: { ++ card: successfulNo3DSCardDetails, ++ }, ++ setup_future_usage: "off_session", ++ customer_acceptance: customerAcceptance, ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "requires_customer_action", ++ }, ++ }, ++ }), ++ ++ SaveCardUseNo3DSManualCaptureOffSession: getCustomExchange({ ++ Configs: { ++ TRIGGER_SKIP: true, // Skip if Celero doesn't support off-session save card ++ }, ++ Request: { ++ payment_method: "card", ++ payment_method_data: { ++ card: successfulNo3DSCardDetails, ++ }, ++ setup_future_usage: "off_session", ++ customer_acceptance: customerAcceptance, ++ capture_method: "manual", ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "requires_capture", ++ }, ++ }, ++ }), ++ ++ SaveCardConfirmAutoCaptureOffSession: getCustomExchange({ ++ Configs: { ++ TRIGGER_SKIP: true, // Skip if Celero doesn't support off-session save card ++ }, ++ Request: { ++ setup_future_usage: "off_session", ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "succeeded", ++ }, ++ }, ++ }), ++ ++ SaveCardConfirmManualCaptureOffSession: getCustomExchange({ ++ Configs: { ++ TRIGGER_SKIP: true, // Skip if Celero doesn't support off-session save card ++ }, ++ Request: { ++ setup_future_usage: "off_session", ++ capture_method: "manual", ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "requires_capture", ++ }, ++ }, ++ }), ++ ++ SaveCardConfirmAutoCaptureOffSessionWithoutBilling: getCustomExchange({ ++ Configs: { ++ TRIGGER_SKIP: true, // Skip if Celero doesn't support off-session save card ++ }, ++ Request: { ++ setup_future_usage: "off_session", ++ billing: null, ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "succeeded", ++ billing: null, ++ }, ++ }, ++ }), ++ ++ ZeroAuthPaymentIntent: getCustomExchange({ ++ Configs: { ++ TRIGGER_SKIP: true, // Zero auth not supported ++ }, ++ Request: { ++ amount: 0, ++ setup_future_usage: "off_session", ++ currency: "USD", ++ payment_type: "setup_mandate", ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "requires_payment_method", ++ }, ++ }, ++ }), ++ ++ ZeroAuthConfirmPayment: getCustomExchange({ ++ Configs: { ++ TRIGGER_SKIP: true, // Zero auth not supported ++ }, ++ Request: { ++ payment_type: "setup_mandate", ++ payment_method: "card", ++ payment_method_data: { ++ card: successfulNo3DSCardDetails, ++ }, ++ }, ++ Response: { ++ status: 400, ++ body: { ++ error: { ++ type: "invalid_request_error", ++ code: "feature_not_supported", ++ message: "Zero auth is not supported", ++ }, ++ }, ++ }, ++ }), ++ ++ ZeroAuthMandate: getCustomExchange({ ++ Configs: { ++ TRIGGER_SKIP: true, // Zero auth not supported ++ }, ++ Request: { ++ payment_method: "card", ++ payment_method_data: { ++ card: successfulNo3DSCardDetails, ++ }, ++ currency: "USD", ++ mandate_data: { ++ customer_acceptance: customerAcceptance, ++ mandate_type: { ++ single_use: { ++ amount: 8000, ++ currency: "USD", ++ }, ++ }, ++ }, ++ }, ++ Response: { ++ status: 400, ++ body: {}, ++ }, ++ }), ++ ++ MITAutoCapture: getCustomExchange({ ++ Configs: { ++ TRIGGER_SKIP: true, // Skip if Celero doesn't support MIT ++ }, ++ Request: {}, ++ Response: { ++ status: 200, ++ body: { ++ status: "succeeded", ++ }, ++ }, ++ }), ++ ++ MITWithoutBillingAddress: getCustomExchange({ ++ Configs: { ++ TRIGGER_SKIP: true, // Skip if Celero doesn't support MIT ++ }, ++ Request: { ++ billing: null, ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "succeeded", ++ }, ++ }, ++ }), ++ ++ // ===== 3DS MANDATE SCENARIOS ===== ++ // Note: Celero doesn't support 3DS or mandates, marked as TRIGGER_SKIP ++ ++ MandateSingleUse3DSAutoCapture: getCustomExchange({ ++ Configs: { ++ TRIGGER_SKIP: true, // Skip - 3DS not implemented ++ }, ++ Request: { ++ payment_method: "card", ++ payment_method_data: { ++ card: successfulNo3DSCardDetails, ++ }, ++ currency: "USD", ++ mandate_data: { ++ customer_acceptance: customerAcceptance, ++ mandate_type: { ++ single_use: { ++ amount: 8000, ++ currency: "USD", ++ }, ++ }, ++ }, ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "requires_customer_action", ++ }, ++ }, ++ }), ++ ++ MandateSingleUse3DSManualCapture: getCustomExchange({ ++ Configs: { ++ TRIGGER_SKIP: true, // Skip - 3DS not implemented ++ }, ++ Request: { ++ payment_method: "card", ++ payment_method_data: { ++ card: successfulNo3DSCardDetails, ++ }, ++ currency: "USD", ++ mandate_data: { ++ customer_acceptance: customerAcceptance, ++ mandate_type: { ++ single_use: { ++ amount: 8000, ++ currency: "USD", ++ }, ++ }, ++ }, ++ capture_method: "manual", ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "requires_customer_action", ++ }, ++ }, ++ }), ++ ++ MandateMultiUse3DSAutoCapture: getCustomExchange({ ++ Configs: { ++ TRIGGER_SKIP: true, // Skip - 3DS not implemented ++ }, ++ Request: { ++ payment_method: "card", ++ payment_method_data: { ++ card: successfulNo3DSCardDetails, ++ }, ++ currency: "USD", ++ mandate_data: { ++ customer_acceptance: customerAcceptance, ++ mandate_type: { ++ multi_use: { ++ amount: 8000, ++ currency: "USD", ++ }, ++ }, ++ }, ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "requires_customer_action", ++ }, ++ }, ++ }), ++ ++ MandateMultiUse3DSManualCapture: getCustomExchange({ ++ Configs: { ++ TRIGGER_SKIP: true, // Skip - 3DS not implemented ++ }, ++ Request: { ++ payment_method: "card", ++ payment_method_data: { ++ card: successfulNo3DSCardDetails, ++ }, ++ currency: "USD", ++ mandate_data: { ++ customer_acceptance: customerAcceptance, ++ mandate_type: { ++ multi_use: { ++ amount: 8000, ++ currency: "USD", ++ }, ++ }, ++ }, ++ capture_method: "manual", ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "requires_customer_action", ++ }, ++ }, ++ }), ++ ++ // ===== PAYMENT METHOD SCENARIOS ===== ++ // Note: These may not be supported by Celero, marked as TRIGGER_SKIP ++ ++ PaymentMethodIdMandateNo3DSAutoCapture: getCustomExchange({ ++ Configs: { ++ TRIGGER_SKIP: true, // Skip if Celero doesn't support payment method ID mandates ++ }, ++ Request: { ++ payment_method: "card", ++ payment_method_data: { ++ card: successfulNo3DSCardDetails, ++ }, ++ currency: "USD", ++ mandate_data: null, ++ customer_acceptance: customerAcceptance, ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "succeeded", ++ }, ++ }, ++ }), ++ ++ PaymentMethodIdMandateNo3DSManualCapture: getCustomExchange({ ++ Configs: { ++ TRIGGER_SKIP: true, // Skip if Celero doesn't support payment method ID mandates ++ }, ++ Request: { ++ payment_method: "card", ++ payment_method_data: { ++ card: successfulNo3DSCardDetails, ++ }, ++ currency: "USD", ++ mandate_data: null, ++ customer_acceptance: customerAcceptance, ++ capture_method: "manual", ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "requires_capture", ++ }, ++ }, ++ }), ++ ++ // ===== VOID SCENARIOS ===== ++ ++ VoidPaymentFailure: { ++ Request: { ++ cancellation_reason: "merchant_request", ++ }, ++ Response: { ++ status: 400, ++ body: { ++ error: { ++ type: "invalid_request_error", ++ code: "processing_error", ++ message: ++ "You cannot cancel this PaymentIntent because it has a status of succeeded.", ++ }, ++ }, ++ }, ++ }, ++ ++ VoidAfterConfirm: { ++ Request: { ++ cancellation_reason: "customer_request", ++ }, ++ Response: { ++ status: 200, ++ body: { ++ status: "cancelled", ++ payment_method: "card", ++ attempt_count: 1, ++ }, ++ }, ++ }, ++ ++ PaymentIntentOffSession: getCustomExchange({ ++ Configs: { ++ TRIGGER_SKIP: true, // Off-session not supported ++ }, ++ Request: { ++ currency: "USD", ++ setup_future_usage: "off_session", ++ }, ++ Response: { ++ status: 200, ++ body: {}, ++ }, ++ }), ++ ++ SessionToken: getCustomExchange({ ++ Configs: { ++ TRIGGER_SKIP: true, // Session tokens not supported ++ }, ++ Response: { ++ status: 200, ++ body: { ++ session_token: [], ++ }, ++ }, ++ }), ++ ++ PaymentMethod: getCustomExchange({ ++ Configs: { ++ TRIGGER_SKIP: true, // Payment method creation not supported ++ }, ++ Request: { ++ payment_method: "card", ++ payment_method_type: "credit", ++ card: successfulNo3DSCardDetails, ++ }, ++ Response: { ++ status: 400, ++ body: { ++ error: { ++ type: "invalid_request_error", ++ code: "feature_not_supported", ++ message: "Payment method creation is not supported", ++ }, ++ }, ++ }, ++ }), ++ }, ++ pm_list: { ++ PmListResponse: { ++ PmListNull: { ++ payment_methods: [], ++ }, ++ pmListDynamicFieldWithoutBilling: requiredFields, ++ pmListDynamicFieldWithBilling: requiredFields, ++ pmListDynamicFieldWithNames: requiredFields, ++ pmListDynamicFieldWithEmail: requiredFields, ++ }, ++ }, ++}; +diff --git a/cypress-tests/cypress/e2e/configs/Payment/Utils.js b/cypress-tests/cypress/e2e/configs/Payment/Utils.js +index b73d8f24..689a6eed 100644 +--- a/cypress-tests/cypress/e2e/configs/Payment/Utils.js ++++ b/cypress-tests/cypress/e2e/configs/Payment/Utils.js +@@ -59,7 +59,7 @@ import { connectorDetails as worldpayConnectorDetails } from "./WorldPay.js"; + import { connectorDetails as worldpayvantivConnectorDetails } from "./Worldpayvantiv.js"; + import { connectorDetails as worldpayxmlConnectorDetails } from "./Worldpayxml.js"; + import { connectorDetails as xenditConnectorDetails } from "./Xendit.js"; +- ++import { connectorDetails as celeroConnectorDetails } from "./Celero.js"; + const connectorDetails = { + aci: aciConnectorDetails, + adyen: adyenConnectorDetails, +@@ -73,6 +73,7 @@ const connectorDetails = { + billwerk: billwerkConnectorDetails, + bluesnap: bluesnapConnectorDetails, + braintree: braintreeConnectorDetails, ++ celero: celeroConnectorDetails, + checkout: checkoutConnectorDetails, + checkbook: checkbookConnectorDetails, + commons: commonConnectorDetails, +diff --git a/cypress-tests/cypress/e2e/configs/mock-server/Connectors/Celero.ts b/cypress-tests/cypress/e2e/configs/mock-server/Connectors/Celero.ts +new file mode 100644 +index 00000000..f1b005be +--- /dev/null ++++ b/cypress-tests/cypress/e2e/configs/mock-server/Connectors/Celero.ts +@@ -0,0 +1,502 @@ ++/* eslint-disable no-console */ ++import * as express from "express"; ++import type { NextFunction, Request, Response, Router } from "express"; ++import cors from "cors"; ++ ++const router: Router = express.default.Router(); ++const PORT = process.env.PORT || 3010; ++ ++// Middleware ++router.use(cors()); ++router.use(express.default.json()); ++router.use(express.default.urlencoded({ extended: true })); ++ ++// Mock data storage ++interface MockData { ++ transactions: Record; ++ refunds: Record; ++} ++ ++const mockData: MockData = { ++ transactions: {}, ++ refunds: {}, ++}; ++ ++// Valid API keys ++const validApiKeys: string[] = [ ++ "celero-test-api-key-123", ++ "celero-api-key-456", ++ "api-celero-test", ++ "alpha-test-api-key-123", ++]; ++ ++// Helper functions ++function generateId(prefix: string): string { ++ return `${prefix}_${Math.random().toString(36).substr(2, 10)}`; ++} ++ ++function generateAuthCode(): string { ++ return Math.floor(100000 + Math.random() * 900000).toString(); ++} ++ ++function getCurrentTimestamp(): string { ++ return new Date().toISOString(); ++} ++ ++// Authentication middleware ++function authenticateApiKey( ++ req: Request, ++ res: Response, ++ next: NextFunction ++): void { ++ const authHeader = req.headers.authorization; ++ ++ if (!authHeader) { ++ res.status(401).json({ ++ status: "error", ++ msg: "Missing Authorization header", ++ }); ++ return; ++ } ++ ++ // Check if the API key is valid ++ const apiKey = authHeader; ++ ++ if (!validApiKeys.includes(apiKey)) { ++ res.status(401).json({ ++ status: "error", ++ msg: "Invalid API key", ++ }); ++ return; ++ } ++ ++ (req as any).apiKey = apiKey; ++ next(); ++} ++ ++// Logging middleware ++router.use((req: Request, res: Response, next: NextFunction): void => { ++ console.log(`${new Date().toISOString()} - ${req.method} ${req.path}`); ++ console.log("Headers:", JSON.stringify(req.headers, null, 2)); ++ if (req.body && Object.keys(req.body).length > 0) { ++ console.log("Body:", JSON.stringify(req.body, null, 2)); ++ } ++ next(); ++}); ++ ++// Health check endpoint ++router.get("/health", (req: Request, res: Response): void => { ++ res.json({ ++ status: "success", ++ msg: "Celero Mock Server is running", ++ timestamp: getCurrentTimestamp(), ++ }); ++}); ++ ++// 1. POST /api/transaction - Create payment (authorize or sale) ++router.post( ++ "/api/transaction", ++ authenticateApiKey, ++ (req: Request, res: Response): void => { ++ try { ++ const { ++ idempotency_key, ++ type: transaction_type, ++ amount, ++ currency, ++ payment_method, ++ } = req.body; ++ ++ // Basic validation ++ if ( ++ !idempotency_key || ++ !transaction_type || ++ !amount || ++ !currency || ++ !payment_method ++ ) { ++ res.status(400).json({ ++ status: "error", ++ msg: "Missing required fields: idempotency_key, type, amount, currency, payment_method", ++ }); ++ return; ++ } ++ ++ // Check if payment method is card ++ if (!payment_method.card) { ++ res.status(400).json({ ++ status: "error", ++ msg: "Only card payment method is supported", ++ }); ++ return; ++ } ++ ++ // Check for fail card - reject payment if fail card is used ++ const failCard = "4000000000000002"; ++ if (payment_method.card.number === failCard) { ++ res.status(200).json({ ++ status: "success", ++ msg: "Transaction processed", ++ data: { ++ id: generateId("txn"), ++ type: transaction_type, ++ amount, ++ currency, ++ response: { ++ card: { ++ status: "declined", ++ processor_response_code: "05", ++ avs_response_code: "N", ++ }, ++ }, ++ billing_address: req.body.billing_address, ++ shipping_address: req.body.shipping_address, ++ }, ++ }); ++ return; ++ } ++ ++ // Process the transaction ++ const transactionId = generateId("txn"); ++ const authCode = generateAuthCode(); ++ const now = getCurrentTimestamp(); ++ ++ const transaction = { ++ id: transactionId, ++ type: transaction_type, ++ amount, ++ currency, ++ response: { ++ card: { ++ status: transaction_type === "sale" ? "settled" : "approved", ++ auth_code: authCode, ++ processor_response_code: "00", ++ avs_response_code: "Y", ++ }, ++ }, ++ billing_address: req.body.billing_address, ++ shipping_address: req.body.shipping_address, ++ created_at: now, ++ updated_at: now, ++ }; ++ ++ // Store the transaction ++ mockData.transactions[transactionId] = transaction; ++ ++ res.status(200).json({ ++ status: "success", ++ msg: "Transaction processed", ++ data: transaction, ++ }); ++ } catch (error: any) { ++ console.error("Error processing transaction:", error); ++ res.status(500).json({ ++ status: "error", ++ msg: `Internal server error: ${error.message}`, ++ }); ++ } ++ } ++); ++ ++// 2. POST /api/transaction/search - Search for transactions (used for payment sync and refund sync) ++router.post( ++ "/api/transaction/search", ++ authenticateApiKey, ++ (req: Request, res: Response): void => { ++ try { ++ const { transaction_id } = req.body; ++ ++ if (!transaction_id) { ++ res.status(400).json({ ++ status: "error", ++ msg: "Missing required field: transaction_id", ++ }); ++ return; ++ } ++ ++ // Check if it's a transaction ID or refund ID ++ if (transaction_id.startsWith("txn_")) { ++ // It's a transaction ID ++ const transaction = mockData.transactions[transaction_id]; ++ if (!transaction) { ++ res.status(404).json({ ++ status: "error", ++ msg: "Transaction not found", ++ }); ++ return; ++ } ++ ++ res.status(200).json({ ++ status: "success", ++ msg: "Transaction found", ++ data: transaction, ++ }); ++ } else if (transaction_id.startsWith("ref_")) { ++ // It's a refund ID ++ const refund = mockData.refunds[transaction_id]; ++ if (!refund) { ++ res.status(404).json({ ++ status: "error", ++ msg: "Refund not found", ++ }); ++ return; ++ } ++ ++ res.status(200).json({ ++ status: "success", ++ msg: "Refund found", ++ data: refund, ++ }); ++ } else { ++ res.status(404).json({ ++ status: "error", ++ msg: "Invalid transaction_id format", ++ }); ++ } ++ } catch (error: any) { ++ console.error("Error searching transaction:", error); ++ res.status(500).json({ ++ status: "error", ++ msg: `Internal server error: ${error.message}`, ++ }); ++ } ++ } ++); ++ ++// 3. POST /api/transaction/:transactionId/capture - Capture an authorized payment ++router.post( ++ "/api/transaction/:transactionId/capture", ++ authenticateApiKey, ++ (req: Request, res: Response): void => { ++ try { ++ const { transactionId } = req.params; ++ const { amount, order_id } = req.body; ++ ++ // Validate transaction exists ++ const transaction = mockData.transactions[transactionId]; ++ if (!transaction) { ++ res.status(404).json({ ++ status: "error", ++ msg: "Transaction not found", ++ }); ++ return; ++ } ++ ++ // Validate transaction is authorized ++ if ( ++ transaction.type !== "authorize" || ++ transaction.response.card.status !== "approved" ++ ) { ++ res.status(400).json({ ++ status: "error", ++ msg: "Transaction cannot be captured (not an approved authorization)", ++ }); ++ return; ++ } ++ ++ // Validate amount ++ if (!amount || amount <= 0) { ++ res.status(400).json({ ++ status: "error", ++ msg: "Invalid amount for capture", ++ }); ++ return; ++ } ++ ++ // Update transaction status ++ transaction.response.card.status = "settled"; ++ transaction.updated_at = getCurrentTimestamp(); ++ ++ // If amount is different from original, update it ++ if (amount !== transaction.amount) { ++ transaction.amount = amount; ++ } ++ ++ // Add order_id if provided ++ if (order_id) { ++ transaction.order_id = order_id; ++ } ++ ++ res.status(200).json({ ++ status: "success", ++ msg: "Transaction captured successfully", ++ }); ++ } catch (error: any) { ++ console.error("Error capturing transaction:", error); ++ res.status(500).json({ ++ status: "error", ++ msg: `Internal server error: ${error.message}`, ++ }); ++ } ++ } ++); ++ ++// 4. POST /api/transaction/:transactionId/void - Void a transaction ++router.post( ++ "/api/transaction/:transactionId/void", ++ authenticateApiKey, ++ (req: Request, res: Response): void => { ++ try { ++ const { transactionId } = req.params; ++ ++ // Validate transaction exists ++ const transaction = mockData.transactions[transactionId]; ++ if (!transaction) { ++ res.status(404).json({ ++ status: "error", ++ msg: "Transaction not found", ++ }); ++ return; ++ } ++ ++ // Validate transaction can be voided (not settled) ++ if (transaction.response.card.status === "settled") { ++ res.status(400).json({ ++ status: "error", ++ msg: "Transaction cannot be voided (already settled)", ++ }); ++ return; ++ } ++ ++ // Update transaction status ++ transaction.response.card.status = "voided"; ++ transaction.updated_at = getCurrentTimestamp(); ++ ++ res.status(200).json({ ++ status: "success", ++ msg: "Transaction voided successfully", ++ }); ++ } catch (error: any) { ++ console.error("Error voiding transaction:", error); ++ res.status(500).json({ ++ status: "error", ++ msg: `Internal server error: ${error.message}`, ++ }); ++ } ++ } ++); ++ ++// 5. POST /api/transaction/:transactionId/refund - Refund a transaction ++router.post( ++ "/api/transaction/:transactionId/refund", ++ authenticateApiKey, ++ (req: Request, res: Response): void => { ++ try { ++ const { transactionId } = req.params; ++ const { amount, surcharge } = req.body; ++ ++ // Validate transaction exists ++ const transaction = mockData.transactions[transactionId]; ++ // if (!transaction) { ++ // return res.status(404).json({ ++ // status: "error", ++ // msg: "Transaction not found", ++ // }); ++ // } ++ ++ // Validate transaction can be refunded (must be settled) ++ ++ // Validate amount ++ if (!amount || amount <= 0) { ++ res.status(400).json({ ++ status: "error", ++ msg: "Invalid amount for refund", ++ }); ++ return; ++ } ++ ++ // Validate amount doesn't exceed original transaction ++ if (amount > transaction.amount) { ++ res.status(400).json({ ++ status: "error", ++ msg: "Refund amount exceeds original transaction amount", ++ }); ++ return; ++ } ++ ++ // Create refund record ++ const refundId = generateId("ref"); ++ const refund = { ++ id: refundId, ++ transaction_id: transactionId, ++ amount, ++ surcharge: surcharge || 0, ++ currency: transaction.currency, ++ status: "success", ++ created_at: getCurrentTimestamp(), ++ }; ++ ++ // Store the refund ++ mockData.refunds[refundId] = refund; ++ ++ // If full refund, update transaction status ++ if (amount === transaction.amount) { ++ transaction.response.card.status = "refunded"; ++ transaction.updated_at = getCurrentTimestamp(); ++ } else { ++ transaction.response.card.status = "partially_refunded"; ++ transaction.updated_at = getCurrentTimestamp(); ++ } ++ ++ res.status(200).json({ ++ status: "success", ++ msg: "Transaction refunded successfully", ++ data: null, ++ }); ++ } catch (error: any) { ++ console.error("Error refunding transaction:", error); ++ res.status(500).json({ ++ status: "error", ++ msg: `Internal server error: ${error.message}`, ++ }); ++ } ++ } ++); ++ ++// Error handling middleware ++ ++router.use( ++ (err: Error, req: Request, res: Response, _next: NextFunction): void => { ++ console.error("Error:", err); ++ res.status(500).json({ ++ status: "error", ++ msg: "An unexpected error occurred", ++ }); ++ } ++); ++ ++// 404 handler ++router.use((req: Request, res: Response): void => { ++ res.status(404).json({ ++ status: "error", ++ msg: `Endpoint ${req.method} ${req.originalUrl} not found`, ++ }); ++}); ++ ++// Create Express app and use the router ++ ++console.log(`🚀 Celero Mock Server running on port ${PORT}`); ++console.log(`📍 Server URL: http://localhost:${PORT}`); ++console.log("\n📋 Available Endpoints:"); ++console.log(" GET /health - Health check"); ++console.log( ++ " POST celero/api/transaction - Create payment (authorize or sale)" ++); ++console.log(" POST celero/api/transaction/search - Search for transactions"); ++console.log( ++ " POST /api/transaction/{id}/capture - Capture an authorized payment" ++); ++console.log(" POST celero/api/transaction/{id}/void - Void a transaction"); ++console.log(" POST celero/api/transaction/{id}/refund - Refund a transaction"); ++console.log("\n🔐 Authentication:"); ++console.log(" API Key in Authorization header"); ++console.log(" Valid API Keys:"); ++console.log(" - celero-test-api-key-123"); ++console.log(" - celero-api-key-456"); ++console.log(" - api-celero-test"); ++console.log(" - alpha-test-api-key-123"); ++console.log( ++ "\n💡 Note: Celero mock server is designed to work with the Hyperswitch Celero connector" ++); ++ ++export default router; +diff --git a/cypress-tests/cypress/e2e/configs/mock-server/Connectors/Silverflow.ts b/cypress-tests/cypress/e2e/configs/mock-server/Connectors/Silverflow.ts +new file mode 100644 +index 00000000..74cf2ccb +--- /dev/null ++++ b/cypress-tests/cypress/e2e/configs/mock-server/Connectors/Silverflow.ts +@@ -0,0 +1,706 @@ ++/* eslint-disable no-console */ ++import * as express from "express"; ++import type { NextFunction, Request, Response, Router } from "express"; ++ ++const router: Router = express.default.Router(); ++ ++// Mock data storage ++interface MockData { ++ charges: Record; ++ processorTokens: Record; ++} ++ ++const mockData: MockData = { ++ charges: {}, ++ processorTokens: {}, ++}; ++ ++// Mock API credentials ++const validCredentials: Record = { ++ "apk-1wtRxni5IsPsSpBLWpwr": "FWtnOOHAjbD6rNxWWEeVOCj7JXSEPGJQ", ++ "apk-testkey123": "testsecret456", ++ "api-silverflow": "depends_on_mockserver", ++}; ++ ++// Helper functions ++function generateId(prefix: string): string { ++ return `${prefix}-${Math.random().toString(36).substr(2, 16)}`; ++} ++ ++function generateAuthCode(): string { ++ return Math.floor(100000 + Math.random() * 900000).toString(); ++} ++ ++function getCurrentTimestamp(): string { ++ return new Date().toISOString(); ++} ++ ++// Authentication middleware ++function authenticateBasic( ++ req: Request, ++ res: Response, ++ next: NextFunction ++): void { ++ const authHeader = req.headers.authorization; ++ ++ if (!authHeader || !authHeader.startsWith("Basic ")) { ++ res.status(401).json({ ++ error: { ++ code: "AUTHENTICATION_REQUIRED", ++ message: "Missing or invalid Authorization header", ++ }, ++ }); ++ return; ++ } ++ ++ try { ++ const base64Credentials = authHeader.split(" ")[1]; ++ const credentials = Buffer.from(base64Credentials, "base64").toString( ++ "ascii" ++ ); ++ const [apiKey, apiSecret] = credentials.split(":"); ++ ++ if (!validCredentials[apiKey] || validCredentials[apiKey] !== apiSecret) { ++ res.status(401).json({ ++ error: { ++ code: "INVALID_CREDENTIALS", ++ message: "Invalid API key or secret", ++ }, ++ }); ++ return; ++ } ++ ++ (req as any).apiKey = apiKey; ++ next(); ++ } catch (error: any) { ++ res.status(401).json({ ++ error: { ++ code: "AUTHENTICATION_ERROR", ++ message: `Invalid authorization format: ${error.message}`, ++ }, ++ }); ++ return; ++ } ++} ++ ++// Logging middleware ++router.use((req: Request, res: Response, next: NextFunction): void => { ++ console.log(`${new Date().toISOString()} - ${req.method} ${req.path}`); ++ console.log("Headers:", JSON.stringify(req.headers, null, 2)); ++ if (req.body && Object.keys(req.body).length > 0) { ++ console.log("Body:", JSON.stringify(req.body, null, 2)); ++ } ++ next(); ++}); ++ ++// Health check endpoint ++router.get("/health", (req: Request, res: Response): void => { ++ res.json({ status: "OK", timestamp: getCurrentTimestamp() }); ++}); ++ ++// 1. POST /charges - Create payment authorization ++router.post( ++ "/charges", ++ authenticateBasic, ++ (req: Request, res: Response): void => { ++ try { ++ const { merchantAcceptorResolver, card, amount, type, clearingMode } = ++ req.body; ++ ++ // Basic validation ++ if (!merchantAcceptorResolver || !card || !amount || !type) { ++ res.status(400).json({ ++ error: { ++ code: "BAD_REQUEST", ++ message: ++ "Missing required fields: merchantAcceptorResolver, card, amount, type", ++ }, ++ }); ++ return; ++ } ++ ++ // Check for fail card - reject payment if fail card is used ++ const failCard = "4000000000000002"; ++ if (card.number === failCard) { ++ const chargeKey = generateId("chg"); ++ const now = getCurrentTimestamp(); ++ ++ const failedCharge = { ++ key: chargeKey, ++ merchantAcceptorRef: { ++ key: generateId("mac"), ++ version: 1, ++ }, ++ card: { ++ maskedNumber: `${card.number.substring(0, 6)}****${card.number.substring(card.number.length - 4)}`, ++ }, ++ amount, ++ type, ++ clearingMode: clearingMode || "auto", ++ status: { ++ authentication: "none", ++ authorization: "declined", ++ clearing: "failed", ++ }, ++ authentication: { ++ sca: { ++ compliance: "out-of-scope", ++ complianceReason: "moto", ++ method: "none", ++ }, ++ cvc: "match", ++ avs: "none", ++ }, ++ localTransactionDateTime: now, ++ fraudLiability: "acquirer", ++ authorizationIsoFields: { ++ responseCode: "05", ++ responseCodeDescription: "Do not honor", ++ authorizationCode: "", ++ networkCode: "0005", ++ systemTraceAuditNumber: Math.floor( ++ 100000 + Math.random() * 900000 ++ ).toString(), ++ retrievalReferenceNumber: Math.floor( ++ 100000000000 + Math.random() * 900000000000 ++ ).toString(), ++ eci: "01", ++ networkSpecificFields: { ++ transactionIdentifier: Math.floor( ++ 100000000000000 + Math.random() * 900000000000000 ++ ).toString(), ++ cvv2ResultCode: "M", ++ }, ++ }, ++ created: now, ++ version: 1, ++ actions: [], ++ }; ++ ++ mockData.charges[chargeKey] = failedCharge; ++ ++ res.status(201).json(failedCharge); ++ return; ++ } ++ ++ // Idempotency key is accepted but not enforced in mock server ++ ++ const chargeKey = generateId("chg"); ++ const authCode = generateAuthCode(); ++ ++ const now = getCurrentTimestamp(); ++ const charge = { ++ key: chargeKey, ++ merchantAcceptorRef: { ++ key: generateId("mac"), ++ version: 1, ++ }, ++ card: { ++ maskedNumber: `${card.number.substring(0, 6)}****${card.number.substring(card.number.length - 4)}`, ++ }, ++ amount, ++ type, ++ clearingMode: clearingMode || "auto", ++ status: { ++ authentication: "none", ++ authorization: "approved", ++ clearing: clearingMode === "manual" ? "pending" : "cleared", ++ }, ++ authentication: { ++ sca: { ++ compliance: "out-of-scope", ++ complianceReason: "moto", ++ method: "none", ++ }, ++ cvc: "match", ++ avs: "none", ++ }, ++ localTransactionDateTime: now, ++ fraudLiability: "acquirer", ++ authorizationIsoFields: { ++ responseCode: "00", ++ responseCodeDescription: "Approved", ++ authorizationCode: authCode, ++ networkCode: "0000", ++ systemTraceAuditNumber: Math.floor( ++ 100000 + Math.random() * 900000 ++ ).toString(), ++ retrievalReferenceNumber: Math.floor( ++ 100000000000 + Math.random() * 900000000000 ++ ).toString(), ++ eci: "01", ++ networkSpecificFields: { ++ transactionIdentifier: Math.floor( ++ 100000000000000 + Math.random() * 900000000000000 ++ ).toString(), ++ cvv2ResultCode: "M", ++ }, ++ }, ++ created: now, ++ version: 1, ++ actions: [], ++ }; ++ ++ mockData.charges[chargeKey] = charge; ++ ++ res.status(201).json(charge); ++ } catch (error: any) { ++ res.status(500).json({ ++ error: { ++ code: "INTERNAL_SERVER_ERROR", ++ message: error.message, ++ }, ++ }); ++ } ++ } ++); ++ ++// 2. POST /charges/:chargeKey/clear - Manually clear charge ++router.post( ++ "/charges/:chargeKey/clear", ++ authenticateBasic, ++ (req: Request, res: Response): void => { ++ try { ++ const { chargeKey } = req.params; ++ const { amount, closeCharge, clearAfter, reference } = req.body; ++ ++ const charge = mockData.charges[chargeKey]; ++ if (!charge) { ++ res.status(404).json({ ++ error: { ++ code: "NOT_FOUND", ++ message: "Charge not found", ++ }, ++ }); ++ return; ++ } ++ ++ // Validate amount if provided ++ if ( ++ amount && ++ (typeof amount !== "number" || amount < 1 || amount > 999999999999) ++ ) { ++ res.status(400).json({ ++ error: { ++ code: "BAD_REQUEST", ++ message: ++ "Invalid amount: must be integer between 1 and 999999999999", ++ }, ++ }); ++ return; ++ } ++ ++ // Determine clearing amount - if not provided, use full charge amount ++ const clearingAmount = amount || charge.amount.value; ++ ++ // Check if charge is too old (6 months) - mock validation ++ const chargeDate = new Date(charge.created); ++ const sixMonthsAgo = new Date(); ++ sixMonthsAgo.setMonth(sixMonthsAgo.getMonth() - 6); ++ ++ if (chargeDate < sixMonthsAgo) { ++ res.status(409).json({ ++ error: { ++ code: "CONFLICT", ++ message: "Charge is too old to be manually cleared", ++ details: { ++ field: "charge", ++ issue: "too-old", ++ }, ++ }, ++ }); ++ return; ++ } ++ ++ const actionKey = generateId("act"); ++ const clearAction = { ++ type: "clearing", ++ key: actionKey, ++ chargeKey, ++ status: "completed", ++ reference, ++ amount: { ++ value: clearingAmount, ++ currency: charge.amount.currency, ++ }, ++ closeCharge: closeCharge || false, ++ clearAfter: clearAfter || null, ++ created: getCurrentTimestamp(), ++ lastModified: getCurrentTimestamp(), ++ version: 1, ++ }; ++ ++ // Update charge status if fully cleared or closeCharge is true ++ if (closeCharge || clearingAmount >= charge.amount.value) { ++ charge.status.clearing = "cleared"; ++ } else { ++ charge.status.clearing = "partially_cleared"; ++ } ++ ++ charge.actions.push(clearAction); ++ charge.version += 1; ++ ++ res.status(201).json(clearAction); ++ } catch (error: any) { ++ res.status(500).json({ ++ error: { ++ code: "INTERNAL_SERVER_ERROR", ++ message: error.message, ++ }, ++ }); ++ } ++ } ++); ++ ++// 3. POST /charges/:chargeKey/refund - Process refunds ++router.post( ++ "/charges/:chargeKey/refund", ++ authenticateBasic, ++ (req: Request, res: Response): void => { ++ try { ++ const { chargeKey } = req.params; ++ const { refundAmount, reference, clearAfter, dynamicDescriptor } = ++ req.body; ++ ++ const charge = mockData.charges[chargeKey]; ++ if (!charge) { ++ res.status(404).json({ ++ error: { ++ code: "NOT_FOUND", ++ message: "Charge not found", ++ }, ++ }); ++ return; ++ } ++ ++ // If refundAmount not provided, refund the full charge amount ++ const refundAmountValue = refundAmount || charge.amount.value; ++ ++ // Validate refundAmount if provided ++ if ( ++ refundAmount && ++ (typeof refundAmount !== "number" || ++ refundAmount < 1 || ++ refundAmount > 999999999999) ++ ) { ++ res.status(400).json({ ++ error: { ++ code: "BAD_REQUEST", ++ message: ++ "Invalid refundAmount: must be integer between 1 and 999999999999", ++ }, ++ }); ++ return; ++ } ++ ++ const actionKey = generateId("act"); ++ ++ // Mock network response ++ const networks = ["visa", "mastercard", "american-express", "discover"]; ++ const network = networks[Math.floor(Math.random() * networks.length)]; ++ ++ const refundAction = { ++ type: "refund", ++ key: actionKey, ++ chargeKey, ++ reference, ++ amount: { ++ value: refundAmountValue, ++ currency: charge.amount.currency, ++ }, ++ status: "success", ++ clearAfter: clearAfter || null, ++ authorizationResponse: { ++ network, ++ responseCode: "00", ++ responseCodeDescription: "Approved", ++ }, ++ dynamicDescriptor: dynamicDescriptor || null, ++ created: getCurrentTimestamp(), ++ lastModified: getCurrentTimestamp(), ++ version: 1, ++ }; ++ ++ charge.actions.push(refundAction); ++ charge.version += 1; ++ ++ res.status(201).json(refundAction); ++ } catch (error: any) { ++ res.status(500).json({ ++ error: { ++ code: "INTERNAL_SERVER_ERROR", ++ message: error.message, ++ }, ++ }); ++ } ++ } ++); ++ ++// 4. POST /charges/:chargeKey/reverse - Reverse charge (void) ++router.post( ++ "/charges/:chargeKey/reverse", ++ authenticateBasic, ++ (req: Request, res: Response): void => { ++ try { ++ const { chargeKey } = req.params; ++ const { replacementAmount = 0, reference } = req.body; ++ ++ const charge = mockData.charges[chargeKey]; ++ if (!charge) { ++ res.status(404).json({ ++ error: { ++ code: "NOT_FOUND", ++ message: "Charge not found", ++ }, ++ }); ++ return; ++ } ++ ++ // Validate replacementAmount if provided ++ if ( ++ replacementAmount && ++ (typeof replacementAmount !== "number" || ++ replacementAmount < 0 || ++ replacementAmount > 999999999999) ++ ) { ++ res.status(400).json({ ++ error: { ++ code: "BAD_REQUEST", ++ message: ++ "Invalid replacementAmount: must be integer between 0 and 999999999999", ++ }, ++ }); ++ return; ++ } ++ ++ const actionKey = generateId("act"); ++ ++ // Mock network response ++ const networks = ["visa", "mastercard", "american-express", "discover"]; ++ const network = networks[Math.floor(Math.random() * networks.length)]; ++ ++ const reversalAction = { ++ type: "reversal", ++ key: actionKey, ++ chargeKey, ++ reference, ++ replacementAmount: { ++ value: replacementAmount, ++ currency: charge.amount.currency, ++ }, ++ status: { ++ authorization: "approved", ++ }, ++ authorizationResponse: { ++ network, ++ responseCode: "00", ++ responseCodeDescription: "Approved", ++ }, ++ created: getCurrentTimestamp(), ++ lastModified: getCurrentTimestamp(), ++ version: 1, ++ }; ++ ++ // Update charge status based on replacement amount ++ if (replacementAmount === 0) { ++ charge.status.authorization = "reversed"; ++ } else { ++ charge.status.authorization = "partially_reversed"; ++ charge.amount.value = replacementAmount; // Update to replacement amount ++ } ++ ++ charge.actions.push(reversalAction); ++ charge.version += 1; ++ ++ res.status(201).json(reversalAction); ++ } catch (error: any) { ++ res.status(500).json({ ++ error: { ++ code: "INTERNAL_SERVER_ERROR", ++ message: error.message, ++ }, ++ }); ++ } ++ } ++); ++ ++// 5. GET /charges/:chargeKey - Get charge status (sync) ++router.get( ++ "/charges/:chargeKey", ++ authenticateBasic, ++ (req: Request, res: Response): void => { ++ try { ++ const { chargeKey } = req.params; ++ ++ const charge = mockData.charges[chargeKey]; ++ if (!charge) { ++ res.status(404).json({ ++ error: { ++ code: "NOT_FOUND", ++ message: "Charge not found", ++ }, ++ }); ++ return; ++ } ++ ++ res.json(charge); ++ } catch (error: any) { ++ res.status(500).json({ ++ error: { ++ code: "INTERNAL_SERVER_ERROR", ++ message: error.message, ++ }, ++ }); ++ } ++ } ++); ++ ++// 5a. GET /charges/:chargeKey/actions/:actionKey - Get action status (refund sync) ++router.get( ++ "/charges/:chargeKey/actions/:actionKey", ++ authenticateBasic, ++ (req: Request, res: Response): void => { ++ try { ++ const { chargeKey, actionKey } = req.params; ++ ++ const charge = mockData.charges[chargeKey]; ++ if (!charge) { ++ res.status(404).json({ ++ error: { ++ code: "NOT_FOUND", ++ message: "Charge not found", ++ }, ++ }); ++ return; ++ } ++ ++ const action = charge.actions.find((a: any) => a.key === actionKey); ++ if (!action) { ++ res.status(404).json({ ++ error: { ++ code: "NOT_FOUND", ++ message: "Action not found", ++ }, ++ }); ++ return; ++ } ++ ++ res.json(action); ++ } catch (error: any) { ++ res.status(500).json({ ++ error: { ++ code: "INTERNAL_SERVER_ERROR", ++ message: error.message, ++ }, ++ }); ++ } ++ } ++); ++ ++// 6. POST /processorTokens - Create processor tokens for vaulting ++router.post( ++ "/processorTokens", ++ authenticateBasic, ++ (req: Request, res: Response): void => { ++ try { ++ const { reference, cardData } = req.body; ++ ++ if (!cardData || !cardData.number) { ++ res.status(400).json({ ++ error: { ++ code: "BAD_REQUEST", ++ message: "Missing cardData or number", ++ }, ++ }); ++ return; ++ } ++ ++ const processorTokenKey = generateId("ptk"); ++ const cardNumber = cardData.number.toString(); ++ ++ // Determine card network based on first digits ++ let network = "unknown"; ++ if (cardNumber.startsWith("4")) network = "visa"; ++ else if (cardNumber.startsWith("5") || cardNumber.startsWith("2")) ++ network = "mastercard"; ++ else if (cardNumber.startsWith("3")) network = "amex"; ++ else if (cardNumber.startsWith("6")) network = "discover"; ++ ++ const processorToken = { ++ key: processorTokenKey, ++ agentKey: generateId("agt"), ++ last4: cardNumber.substring(cardNumber.length - 4), ++ status: "active", ++ reference, ++ cardInfo: [ ++ { ++ infoSource: "card", ++ network, ++ primaryNetwork: true, ++ }, ++ ], ++ created: getCurrentTimestamp(), ++ cvcPresent: !!cardData.cvc, ++ version: 1, ++ }; ++ ++ mockData.processorTokens[processorTokenKey] = processorToken; ++ ++ res.status(201).json(processorToken); ++ } catch (error: any) { ++ res.status(500).json({ ++ error: { ++ code: "INTERNAL_SERVER_ERROR", ++ message: error.message, ++ }, ++ }); ++ } ++ } ++); ++ ++// Error handling middleware ++router.use( ++ (err: Error, req: Request, res: Response, _next: NextFunction): void => { ++ console.error("Error:", err); ++ res.status(500).json({ ++ error: { ++ code: "INTERNAL_SERVER_ERROR", ++ message: "An unexpected error occurred", ++ }, ++ }); ++ } ++); ++ ++// 404 handler ++router.use((req: Request, res: Response): void => { ++ res.status(404).json({ ++ error: { ++ code: "NOT_FOUND", ++ message: `Endpoint ${req.method} ${req.originalUrl} not found`, ++ }, ++ }); ++}); ++ ++// Log available endpoints for debugging purposes ++console.log("\n📋 Silverflow Mock API Endpoints:"); ++console.log(" GET /health - Health check"); ++console.log(" POST /charges - Create payment authorization"); ++console.log(" POST /charges/{chargeKey}/clear - Manually clear charges"); ++console.log(" POST /charges/{chargeKey}/refund - Process refunds"); ++console.log(" POST /charges/{chargeKey}/reverse - Reverse charge (void)"); ++console.log(" GET /charges/{chargeKey} - Get charge status"); ++console.log( ++ " GET /charges/{chargeKey}/actions/{actionKey} - Get action status" ++); ++console.log(" POST /processorTokens - Create processor tokens"); ++console.log("\n🔐 Authentication (SignatureKey format):"); ++console.log(" auth_type: SignatureKey"); ++console.log(" api_key: apk-testkey123"); ++console.log(" key1: testsecret456 (merchant_acceptor_key)"); ++console.log(" api_secret: testsecret456"); ++console.log("\n📖 Use Basic Auth with base64 encoded api_key:api_secret"); ++console.log( ++ " Example: Authorization: Basic " ++); ++ ++export default router; +diff --git a/cypress-tests/cypress/e2e/configs/mock-server/Creds.json b/cypress-tests/cypress/e2e/configs/mock-server/Creds.json +new file mode 100644 +index 00000000..dbe1719f +--- /dev/null ++++ b/cypress-tests/cypress/e2e/configs/mock-server/Creds.json +@@ -0,0 +1,16 @@ ++{ ++ "celero": { ++ "connector_account_details": { ++ "auth_type": "HeaderKey", ++ "api_key": "celero-test-api-key-123" ++ } ++ }, ++ "silverflow": { ++ "connector_account_details": { ++ "auth_type": "SignatureKey", ++ "api_key": "apk-testkey123", ++ "key1": "testsecret456", ++ "api_secret": "testsecret456" ++ } ++ } ++} +diff --git a/cypress-tests/cypress/e2e/configs/mock-server/Silverflow.js b/cypress-tests/cypress/e2e/configs/mock-server/Silverflow.js +deleted file mode 100644 +index 5fe6ef19..00000000 +--- a/cypress-tests/cypress/e2e/configs/mock-server/Silverflow.js ++++ /dev/null +@@ -1,665 +0,0 @@ +-/* eslint-disable no-console */ +-import express from "express"; +-import cors from "cors"; +- +-const app = express(); +-const PORT = process.env.PORT || 3010; +- +-// Middleware +-app.use(cors()); +-app.use(express.json()); +-app.use(express.urlencoded({ extended: true })); +- +-// Mock data storage +-const mockData = { +- charges: {}, +- processorTokens: {}, +-}; +- +-// Mock API credentials +-const validCredentials = { +- "apk-1wtRxni5IsPsSpBLWpwr": "FWtnOOHAjbD6rNxWWEeVOCj7JXSEPGJQ", +- "apk-testkey123": "testsecret456", +- "api-silverflow": "depends_on_mockserver", +-}; +- +-// Helper functions +-function generateId(prefix) { +- return `${prefix}-${Math.random().toString(36).substr(2, 16)}`; +-} +- +-function generateAuthCode() { +- return Math.floor(100000 + Math.random() * 900000).toString(); +-} +- +-function getCurrentTimestamp() { +- return new Date().toISOString(); +-} +- +-// Authentication middleware +-function authenticateBasic(req, res, next) { +- const authHeader = req.headers.authorization; +- +- if (!authHeader || !authHeader.startsWith("Basic ")) { +- return res.status(401).json({ +- error: { +- code: "AUTHENTICATION_REQUIRED", +- message: "Missing or invalid Authorization header", +- }, +- }); +- } +- +- try { +- const base64Credentials = authHeader.split(" ")[1]; +- const credentials = Buffer.from(base64Credentials, "base64").toString( +- "ascii" +- ); +- const [apiKey, apiSecret] = credentials.split(":"); +- +- if (!validCredentials[apiKey] || validCredentials[apiKey] !== apiSecret) { +- return res.status(401).json({ +- error: { +- code: "INVALID_CREDENTIALS", +- message: "Invalid API key or secret", +- }, +- }); +- } +- +- req.apiKey = apiKey; +- next(); +- } catch (error) { +- return res.status(401).json({ +- error: { +- code: "AUTHENTICATION_ERROR", +- message: `Invalid authorization format: ${error}`, +- }, +- }); +- } +-} +- +-// Logging middleware +-app.use((req, res, next) => { +- console.log(`${new Date().toISOString()} - ${req.method} ${req.path}`); +- console.log("Headers:", JSON.stringify(req.headers, null, 2)); +- if (req.body && Object.keys(req.body).length > 0) { +- console.log("Body:", JSON.stringify(req.body, null, 2)); +- } +- next(); +-}); +- +-// Health check endpoint +-app.get("/health", (req, res) => { +- res.json({ status: "OK", timestamp: getCurrentTimestamp() }); +-}); +- +-// 1. POST /charges - Create payment authorization +-app.post("/charges", authenticateBasic, (req, res) => { +- try { +- const { merchantAcceptorResolver, card, amount, type, clearingMode } = +- req.body; +- +- // Basic validation +- if (!merchantAcceptorResolver || !card || !amount || !type) { +- return res.status(400).json({ +- error: { +- code: "BAD_REQUEST", +- message: +- "Missing required fields: merchantAcceptorResolver, card, amount, type", +- }, +- }); +- } +- +- // Check for fail card - reject payment if fail card is used +- const failCard = "4000000000000002"; +- if (card.number === failCard) { +- const chargeKey = generateId("chg"); +- const now = getCurrentTimestamp(); +- +- const failedCharge = { +- key: chargeKey, +- merchantAcceptorRef: { +- key: generateId("mac"), +- version: 1, +- }, +- card: { +- maskedNumber: `${card.number.substring(0, 6)}****${card.number.substring(card.number.length - 4)}`, +- }, +- amount, +- type, +- clearingMode: clearingMode || "auto", +- status: { +- authentication: "none", +- authorization: "declined", +- clearing: "failed", +- }, +- authentication: { +- sca: { +- compliance: "out-of-scope", +- complianceReason: "moto", +- method: "none", +- }, +- cvc: "match", +- avs: "none", +- }, +- localTransactionDateTime: now, +- fraudLiability: "acquirer", +- authorizationIsoFields: { +- responseCode: "05", +- responseCodeDescription: "Do not honor", +- authorizationCode: "", +- networkCode: "0005", +- systemTraceAuditNumber: Math.floor( +- 100000 + Math.random() * 900000 +- ).toString(), +- retrievalReferenceNumber: Math.floor( +- 100000000000 + Math.random() * 900000000000 +- ).toString(), +- eci: "01", +- networkSpecificFields: { +- transactionIdentifier: Math.floor( +- 100000000000000 + Math.random() * 900000000000000 +- ).toString(), +- cvv2ResultCode: "M", +- }, +- }, +- created: now, +- version: 1, +- actions: [], +- }; +- +- mockData.charges[chargeKey] = failedCharge; +- +- return res.status(201).json(failedCharge); +- } +- +- // Idempotency key is accepted but not enforced in mock server +- +- const chargeKey = generateId("chg"); +- const authCode = generateAuthCode(); +- +- const now = getCurrentTimestamp(); +- const charge = { +- key: chargeKey, +- merchantAcceptorRef: { +- key: generateId("mac"), +- version: 1, +- }, +- card: { +- maskedNumber: `${card.number.substring(0, 6)}****${card.number.substring(card.number.length - 4)}`, +- }, +- amount, +- type, +- clearingMode: clearingMode || "auto", +- status: { +- authentication: "none", +- authorization: "approved", +- clearing: clearingMode === "manual" ? "pending" : "cleared", +- }, +- authentication: { +- sca: { +- compliance: "out-of-scope", +- complianceReason: "moto", +- method: "none", +- }, +- cvc: "match", +- avs: "none", +- }, +- localTransactionDateTime: now, +- fraudLiability: "acquirer", +- authorizationIsoFields: { +- responseCode: "00", +- responseCodeDescription: "Approved", +- authorizationCode: authCode, +- networkCode: "0000", +- systemTraceAuditNumber: Math.floor( +- 100000 + Math.random() * 900000 +- ).toString(), +- retrievalReferenceNumber: Math.floor( +- 100000000000 + Math.random() * 900000000000 +- ).toString(), +- eci: "01", +- networkSpecificFields: { +- transactionIdentifier: Math.floor( +- 100000000000000 + Math.random() * 900000000000000 +- ).toString(), +- cvv2ResultCode: "M", +- }, +- }, +- created: now, +- version: 1, +- actions: [], +- }; +- +- mockData.charges[chargeKey] = charge; +- +- res.status(201).json(charge); +- } catch (error) { +- res.status(500).json({ +- error: { +- code: "INTERNAL_SERVER_ERROR", +- message: error.message, +- }, +- }); +- } +-}); +- +-// 2. POST /charges/:chargeKey/clear - Manually clear charge +-app.post("/charges/:chargeKey/clear", authenticateBasic, (req, res) => { +- try { +- const { chargeKey } = req.params; +- const { amount, closeCharge, clearAfter, reference } = req.body; +- +- const charge = mockData.charges[chargeKey]; +- if (!charge) { +- return res.status(404).json({ +- error: { +- code: "NOT_FOUND", +- message: "Charge not found", +- }, +- }); +- } +- +- // Validate amount if provided +- if ( +- amount && +- (typeof amount !== "number" || amount < 1 || amount > 999999999999) +- ) { +- return res.status(400).json({ +- error: { +- code: "BAD_REQUEST", +- message: "Invalid amount: must be integer between 1 and 999999999999", +- }, +- }); +- } +- +- // Determine clearing amount - if not provided, use full charge amount +- const clearingAmount = amount || charge.amount.value; +- +- // Check if charge is too old (6 months) - mock validation +- const chargeDate = new Date(charge.created); +- const sixMonthsAgo = new Date(); +- sixMonthsAgo.setMonth(sixMonthsAgo.getMonth() - 6); +- +- if (chargeDate < sixMonthsAgo) { +- return res.status(409).json({ +- error: { +- code: "CONFLICT", +- message: "Charge is too old to be manually cleared", +- details: { +- field: "charge", +- issue: "too-old", +- }, +- }, +- }); +- } +- +- const actionKey = generateId("act"); +- const clearAction = { +- type: "clearing", +- key: actionKey, +- chargeKey, +- status: "completed", +- reference, +- amount: { +- value: clearingAmount, +- currency: charge.amount.currency, +- }, +- closeCharge: closeCharge || false, +- clearAfter: clearAfter || null, +- created: getCurrentTimestamp(), +- lastModified: getCurrentTimestamp(), +- version: 1, +- }; +- +- // Update charge status if fully cleared or closeCharge is true +- if (closeCharge || clearingAmount >= charge.amount.value) { +- charge.status.clearing = "cleared"; +- } else { +- charge.status.clearing = "partially_cleared"; +- } +- +- charge.actions.push(clearAction); +- charge.version += 1; +- +- res.status(201).json(clearAction); +- } catch (error) { +- res.status(500).json({ +- error: { +- code: "INTERNAL_SERVER_ERROR", +- message: error.message, +- }, +- }); +- } +-}); +- +-// 3. POST /charges/:chargeKey/refund - Process refunds +-app.post("/charges/:chargeKey/refund", authenticateBasic, (req, res) => { +- try { +- const { chargeKey } = req.params; +- const { refundAmount, reference, clearAfter, dynamicDescriptor } = req.body; +- +- const charge = mockData.charges[chargeKey]; +- if (!charge) { +- return res.status(404).json({ +- error: { +- code: "NOT_FOUND", +- message: "Charge not found", +- }, +- }); +- } +- +- // If refundAmount not provided, refund the full charge amount +- const refundAmountValue = refundAmount || charge.amount.value; +- +- // Validate refundAmount if provided +- if ( +- refundAmount && +- (typeof refundAmount !== "number" || +- refundAmount < 1 || +- refundAmount > 999999999999) +- ) { +- return res.status(400).json({ +- error: { +- code: "BAD_REQUEST", +- message: +- "Invalid refundAmount: must be integer between 1 and 999999999999", +- }, +- }); +- } +- +- const actionKey = generateId("act"); +- +- // Mock network response +- const networks = ["visa", "mastercard", "american-express", "discover"]; +- const network = networks[Math.floor(Math.random() * networks.length)]; +- +- const refundAction = { +- type: "refund", +- key: actionKey, +- chargeKey, +- reference, +- amount: { +- value: refundAmountValue, +- currency: charge.amount.currency, +- }, +- status: "success", +- clearAfter: clearAfter || null, +- authorizationResponse: { +- network, +- responseCode: "00", +- responseCodeDescription: "Approved", +- }, +- dynamicDescriptor: dynamicDescriptor || null, +- created: getCurrentTimestamp(), +- lastModified: getCurrentTimestamp(), +- version: 1, +- }; +- +- charge.actions.push(refundAction); +- charge.version += 1; +- +- res.status(201).json(refundAction); +- } catch (error) { +- res.status(500).json({ +- error: { +- code: "INTERNAL_SERVER_ERROR", +- message: error.message, +- }, +- }); +- } +-}); +- +-// 4. POST /charges/:chargeKey/reverse - Reverse charge (void) +-app.post("/charges/:chargeKey/reverse", authenticateBasic, (req, res) => { +- try { +- const { chargeKey } = req.params; +- const { replacementAmount = 0, reference } = req.body; +- +- const charge = mockData.charges[chargeKey]; +- if (!charge) { +- return res.status(404).json({ +- error: { +- code: "NOT_FOUND", +- message: "Charge not found", +- }, +- }); +- } +- +- // Validate replacementAmount if provided +- if ( +- replacementAmount && +- (typeof replacementAmount !== "number" || +- replacementAmount < 0 || +- replacementAmount > 999999999999) +- ) { +- return res.status(400).json({ +- error: { +- code: "BAD_REQUEST", +- message: +- "Invalid replacementAmount: must be integer between 0 and 999999999999", +- }, +- }); +- } +- +- const actionKey = generateId("act"); +- +- // Mock network response +- const networks = ["visa", "mastercard", "american-express", "discover"]; +- const network = networks[Math.floor(Math.random() * networks.length)]; +- +- const reversalAction = { +- type: "reversal", +- key: actionKey, +- chargeKey, +- reference, +- replacementAmount: { +- value: replacementAmount, +- currency: charge.amount.currency, +- }, +- status: { +- authorization: "approved", +- }, +- authorizationResponse: { +- network, +- responseCode: "00", +- responseCodeDescription: "Approved", +- }, +- created: getCurrentTimestamp(), +- lastModified: getCurrentTimestamp(), +- version: 1, +- }; +- +- // Update charge status based on replacement amount +- if (replacementAmount === 0) { +- charge.status.authorization = "reversed"; +- } else { +- charge.status.authorization = "partially_reversed"; +- charge.amount.value = replacementAmount; // Update to replacement amount +- } +- +- charge.actions.push(reversalAction); +- charge.version += 1; +- +- res.status(201).json(reversalAction); +- } catch (error) { +- res.status(500).json({ +- error: { +- code: "INTERNAL_SERVER_ERROR", +- message: error.message, +- }, +- }); +- } +-}); +- +-// 5. GET /charges/:chargeKey - Get charge status (sync) +-app.get("/charges/:chargeKey", authenticateBasic, (req, res) => { +- try { +- const { chargeKey } = req.params; +- +- const charge = mockData.charges[chargeKey]; +- if (!charge) { +- return res.status(404).json({ +- error: { +- code: "NOT_FOUND", +- message: "Charge not found", +- }, +- }); +- } +- +- res.json(charge); +- } catch (error) { +- res.status(500).json({ +- error: { +- code: "INTERNAL_SERVER_ERROR", +- message: error.message, +- }, +- }); +- } +-}); +- +-// 5a. GET /charges/:chargeKey/actions/:actionKey - Get action status (refund sync) +-app.get( +- "/charges/:chargeKey/actions/:actionKey", +- authenticateBasic, +- (req, res) => { +- try { +- const { chargeKey, actionKey } = req.params; +- +- const charge = mockData.charges[chargeKey]; +- if (!charge) { +- return res.status(404).json({ +- error: { +- code: "NOT_FOUND", +- message: "Charge not found", +- }, +- }); +- } +- +- const action = charge.actions.find((a) => a.key === actionKey); +- if (!action) { +- return res.status(404).json({ +- error: { +- code: "NOT_FOUND", +- message: "Action not found", +- }, +- }); +- } +- +- res.json(action); +- } catch (error) { +- res.status(500).json({ +- error: { +- code: "INTERNAL_SERVER_ERROR", +- message: error.message, +- }, +- }); +- } +- } +-); +- +-// 6. POST /processorTokens - Create processor tokens for vaulting +-app.post("/processorTokens", authenticateBasic, (req, res) => { +- try { +- const { reference, cardData } = req.body; +- +- if (!cardData || !cardData.number) { +- return res.status(400).json({ +- error: { +- code: "BAD_REQUEST", +- message: "Missing cardData or number", +- }, +- }); +- } +- +- const processorTokenKey = generateId("ptk"); +- const cardNumber = cardData.number.toString(); +- +- // Determine card network based on first digits +- let network = "unknown"; +- if (cardNumber.startsWith("4")) network = "visa"; +- else if (cardNumber.startsWith("5") || cardNumber.startsWith("2")) +- network = "mastercard"; +- else if (cardNumber.startsWith("3")) network = "amex"; +- else if (cardNumber.startsWith("6")) network = "discover"; +- +- const processorToken = { +- key: processorTokenKey, +- agentKey: generateId("agt"), +- last4: cardNumber.substring(cardNumber.length - 4), +- status: "active", +- reference, +- cardInfo: [ +- { +- infoSource: "card", +- network, +- primaryNetwork: true, +- }, +- ], +- created: getCurrentTimestamp(), +- cvcPresent: !!cardData.cvc, +- version: 1, +- }; +- +- mockData.processorTokens[processorTokenKey] = processorToken; +- +- res.status(201).json(processorToken); +- } catch (error) { +- res.status(500).json({ +- error: { +- code: "INTERNAL_SERVER_ERROR", +- message: error.message, +- }, +- }); +- } +-}); +- +-// Error handling middleware +-// eslint-disable-next-line no-unused-vars +-app.use((err, req, res, next) => { +- console.error("Error:", err); +- res.status(500).json({ +- error: { +- code: "INTERNAL_SERVER_ERROR", +- message: "An unexpected error occurred", +- }, +- }); +-}); +- +-// 404 handler +-app.use((req, res) => { +- res.status(404).json({ +- error: { +- code: "NOT_FOUND", +- message: `Endpoint ${req.method} ${req.originalUrl} not found`, +- }, +- }); +-}); +- +-// Start server +-app.listen(PORT, () => { +- console.log(`🚀 Silverflow Mock Server running on port ${PORT}`); +- console.log(`📍 Server URL: http://localhost:${PORT}`); +- console.log("\n📋 Available Endpoints:"); +- console.log(" GET /health - Health check"); +- console.log(" POST /charges - Create payment authorization"); +- console.log(" POST /charges/{chargeKey}/clear - Manually clear charges"); +- console.log(" POST /charges/{chargeKey}/refund - Process refunds"); +- console.log(" POST /charges/{chargeKey}/reverse - Reverse charge (void)"); +- console.log(" GET /charges/{chargeKey} - Get charge status"); +- console.log( +- " GET /charges/{chargeKey}/actions/{actionKey} - Get action status" +- ); +- console.log(" POST /processorTokens - Create processor tokens"); +- console.log("\n🔐 Authentication (SignatureKey format):"); +- console.log(" auth_type: SignatureKey"); +- console.log(" api_key: apk-testkey123"); +- console.log(" key1: testsecret456 (merchant_acceptor_key)"); +- console.log(" api_secret: testsecret456"); +- console.log("\n📖 Use Basic Auth with base64 encoded api_key:api_secret"); +- console.log( +- " Example: Authorization: Basic " +- ); +- console.log("\n💡 Note: Silverflow depends on mockserver"); +-}); +- +-export default app; +diff --git a/cypress-tests/cypress/e2e/configs/mock-server/mockserver.ts b/cypress-tests/cypress/e2e/configs/mock-server/mockserver.ts +new file mode 100644 +index 00000000..30d94e78 +--- /dev/null ++++ b/cypress-tests/cypress/e2e/configs/mock-server/mockserver.ts +@@ -0,0 +1,62 @@ ++/* eslint-disable no-console */ ++import * as express from "express"; ++import cors from "cors"; ++import { Server } from "http"; ++import router from "./router.ts"; ++ ++// Type declarations ++type Express = express.Express; ++// @ts-ignore - Ignore the missing type declaration for router ++ ++// Create the Express application ++const app: Express = express.default(); ++const MOCKSERVER_PORT: number = parseInt( ++ process.env.MOCKSERVER_PORT || "3010", ++ 10 ++); ++ ++// Apply middleware ++app.use(cors()); ++app.use(express.default.json()); ++app.use(express.default.urlencoded({ extended: true })); ++ ++// Use the router for all routes ++app.use(router); ++ ++// Function to start the server ++function startServer(): Server { ++ const server: Server = app.listen(MOCKSERVER_PORT, () => { ++ console.log(`🚀 Mock Server running on port ${MOCKSERVER_PORT}`); ++ console.log(`📍 Server URL: http://localhost:${MOCKSERVER_PORT}`); ++ console.log("\n📋 Available Routes:"); ++ console.log(" GET /health - Health check"); ++ }); ++ ++ // Handle port already in use error ++ // eslint-disable-next-line no-undef ++ server.on("error", (error: NodeJS.ErrnoException) => { ++ if (error.code === "EADDRINUSE") { ++ console.error(`❌ ERROR: Port ${MOCKSERVER_PORT} is already in use!`); ++ console.error( ++ `Please make sure the port is available or set a different port using the MOCKSERVER_PORT environment variable.` ++ ); ++ process.exit(1); ++ } else { ++ console.error(`❌ ERROR: Failed to start server:`, error.message); ++ process.exit(1); ++ } ++ }); ++ ++ // Handle graceful shutdown ++ process.on("SIGINT", () => { ++ console.log("Shutting down mock server..."); ++ server.close(() => { ++ console.log("Mock server has been terminated"); ++ process.exit(0); ++ }); ++ }); ++ ++ return server; ++} ++ ++startServer(); +diff --git a/cypress-tests/cypress/e2e/configs/mock-server/router.ts b/cypress-tests/cypress/e2e/configs/mock-server/router.ts +new file mode 100644 +index 00000000..f1491773 +--- /dev/null ++++ b/cypress-tests/cypress/e2e/configs/mock-server/router.ts +@@ -0,0 +1,89 @@ ++/* eslint-disable no-console */ ++import * as express from "express"; ++import type { ++ Request, ++ Response, ++ NextFunction, ++ Router, ++ RequestHandler, ++} from "express"; ++// Import from TypeScript version ++import silverflowApp from "./Connectors/Silverflow.ts"; ++import celeroApp from "./Connectors/Celero.ts"; ++ ++// TODO: Update to import from TypeScript version once fully tested ++// import silverflowApp from "./Silverflow"; ++ ++interface MockRouters { ++ [key: string]: RequestHandler; ++} ++ ++const mockRouters: MockRouters = { ++ silverflow: silverflowApp, ++ celero: celeroApp, ++}; ++ ++// Create a router ++const router: Router = express.default.Router(); ++ ++// Log requests to the router ++function logRequest(req: Request, res: Response, next: NextFunction): void { ++ console.log(`Router: ${req.method} ${req.path}`); ++ next(); ++} ++ ++// Health check function ++function healthCheck(req: Request, res: Response): void { ++ res.json({ ++ status: "OK", ++ service: "Router", ++ timestamp: new Date().toISOString(), ++ message: "Router is functioning correctly", ++ }); ++} ++ ++// Error handling function ++function handleErrors( ++ err: Error, ++ req: Request, ++ res: Response, ++ _next: NextFunction ++): void { ++ console.error("Router Error:", err); ++ res.status(500).json({ ++ error: { ++ code: "ROUTER_ERROR", ++ message: "An error occurred in the router", ++ details: err.message, ++ }, ++ }); ++} ++ ++// Apply middleware ++router.use(logRequest); ++ ++// Define direct routes ++router.get("/health", healthCheck); ++ ++// Forward routes for all mock routers ++for (const routerName of Object.keys(mockRouters)) { ++ const name = routerName; ++ const routerApp = mockRouters[routerName]; ++ console.log(`CONNECTOR /${name}`); ++ router.use(`/${name}`, (req: Request, res: Response, next: NextFunction) => { ++ // Modify the path to remove the router name prefix ++ const originalUrl = req.url; ++ req.url = originalUrl.replace(new RegExp(`^\\/${name}`), ""); ++ ++ // Forward to the appropriate app ++ routerApp(req, res, next); ++ ++ // Restore the original URL after processing the request ++ req.url = originalUrl; ++ }); ++} ++ ++// Error handling ++router.use(handleErrors); ++ ++export default router; +diff --git a/cypress-tests/eslint.config.js b/cypress-tests/eslint.config.js +index e7f63628..da3f60fd 100644 +--- a/cypress-tests/eslint.config.js ++++ b/cypress-tests/eslint.config.js +@@ -3,6 +3,7 @@ import eslintConfigPrettier from "eslint-config-prettier"; + import pluginCypress from "eslint-plugin-cypress/flat"; + import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended"; + import globals from "globals"; ++import tseslint from "typescript-eslint"; + + /** @type {import('eslint').Linter.Config[]} */ + export default [ +@@ -10,6 +11,20 @@ export default [ + pluginCypress.configs.recommended, + eslintPluginPrettierRecommended, + eslintConfigPrettier, ++ ...tseslint.configs.recommended, ++ { ++ files: ["**/*.ts", "**/*.tsx"], ++ rules: { ++ "@typescript-eslint/no-explicit-any": "off", ++ "@typescript-eslint/no-unused-vars": [ ++ "warn", ++ { argsIgnorePattern: "^_.*$" }, ++ ], ++ "@typescript-eslint/explicit-module-boundary-types": "off", ++ "@typescript-eslint/ban-ts-comment": "off", ++ "@typescript-eslint/no-non-null-assertion": "off", ++ }, ++ }, + { + ignores: ["dist/**", "build/**", "node_modules/**"], + }, +@@ -21,18 +36,17 @@ export default [ + }, + }, + rules: { +- "no-unused-vars": "error", ++ "no-unused-vars": ["error", { argsIgnorePattern: "^_.*$" }], + "no-undef": "error", + "no-console": "warn", + "prefer-const": "warn", +- + "cypress/assertion-before-screenshot": "warn", + "cypress/no-assigning-return-values": "warn", ++ "@typescript-eslint/no-unused-expressions": "off", + "cypress/no-force": "warn", + "cypress/no-unnecessary-waiting": "warn", + "cypress/no-async-tests": "error", + "cypress/unsafe-to-chain-command": "warn", +- + "prettier/prettier": "error", + }, + }, +diff --git a/cypress-tests/package-lock.json b/cypress-tests/package-lock.json +index 7f36d9c5..fe90d888 100644 +--- a/cypress-tests/package-lock.json ++++ b/cypress-tests/package-lock.json +@@ -13,16 +13,36 @@ + "express": "^5.1.0" + }, + "devDependencies": { +- "@eslint/js": "^9.32.0", +- "cypress": "^14.5.3", ++ "@eslint/js": "^9.33.0", ++ "@types/cors": "^2.8.19", ++ "@types/express": "^5.0.3", ++ "@types/node": "^24.2.1", ++ "cypress": "^14.5.4", + "cypress-mochawesome-reporter": "^4.0.0", + "eslint": "^9.32.0", + "eslint-config-prettier": "^10.1.8", + "eslint-plugin-cypress": "^5.1.0", +- "eslint-plugin-prettier": "^5.5.3", ++ "eslint-plugin-import": "^2.32.0", ++ "eslint-plugin-prettier": "^5.5.4", + "globals": "^16.3.0", + "jsqr": "^1.4.0", +- "prettier": "^3.6.2" ++ "prettier": "^3.6.2", ++ "ts-node": "^10.9.2", ++ "typescript": "^5.9.2", ++ "typescript-eslint": "^8.39.1" ++ } ++ }, ++ "node_modules/@cspotcode/source-map-support": { ++ "version": "0.8.1", ++ "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", ++ "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "@jridgewell/trace-mapping": "0.3.9" ++ }, ++ "engines": { ++ "node": ">=12" + } + }, + "node_modules/@cypress/request": { +@@ -77,9 +97,9 @@ + } + }, + "node_modules/@eslint-community/eslint-utils": { +- "version": "4.4.1", +- "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.1.tgz", +- "integrity": "sha512-s3O3waFUrMV8P/XaF/+ZTp1X9XBZW1a4B97ZnjQF2KYWaFD2A8KyFBsrsfSjEmjn3RGWAIuvlneuZm3CUK3jbA==", ++ "version": "4.7.0", ++ "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.7.0.tgz", ++ "integrity": "sha512-dyybb3AcajC7uha6CvhdVRJqaKyn7w2YKqKyAN37NKYgZT36w+iRb0Dymmc5qEJ549c/S31cMMSFd75bteCpCw==", + "dev": true, + "license": "MIT", + "dependencies": { +@@ -194,9 +214,9 @@ + } + }, + "node_modules/@eslint/js": { +- "version": "9.32.0", +- "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.32.0.tgz", +- "integrity": "sha512-BBpRFZK3eX6uMLKz8WxFOBIFFcGFJ/g8XuwjTHCqHROSIsopI+ddn/d5Cfh36+7+e5edVS8dbSHnBNhrLEX0zg==", ++ "version": "9.33.0", ++ "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.33.0.tgz", ++ "integrity": "sha512-5K1/mKhWaMfreBGJTwval43JJmkip0RmM+3+IuqupeSKNC/Th2Kc7ucaq5ovTSra/OOKB9c58CGSz3QMVbWt0A==", + "dev": true, + "license": "MIT", + "engines": { +@@ -422,6 +442,72 @@ + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, ++ "node_modules/@jridgewell/resolve-uri": { ++ "version": "3.1.2", ++ "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", ++ "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", ++ "dev": true, ++ "license": "MIT", ++ "engines": { ++ "node": ">=6.0.0" ++ } ++ }, ++ "node_modules/@jridgewell/sourcemap-codec": { ++ "version": "1.5.4", ++ "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.4.tgz", ++ "integrity": "sha512-VT2+G1VQs/9oz078bLrYbecdZKs912zQlkelYpuf+SXF+QvZDYJlbx/LSx+meSAwdDFnF8FVXW92AVjjkVmgFw==", ++ "dev": true, ++ "license": "MIT" ++ }, ++ "node_modules/@jridgewell/trace-mapping": { ++ "version": "0.3.9", ++ "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", ++ "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "@jridgewell/resolve-uri": "^3.0.3", ++ "@jridgewell/sourcemap-codec": "^1.4.10" ++ } ++ }, ++ "node_modules/@nodelib/fs.scandir": { ++ "version": "2.1.5", ++ "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", ++ "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "@nodelib/fs.stat": "2.0.5", ++ "run-parallel": "^1.1.9" ++ }, ++ "engines": { ++ "node": ">= 8" ++ } ++ }, ++ "node_modules/@nodelib/fs.stat": { ++ "version": "2.0.5", ++ "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", ++ "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", ++ "dev": true, ++ "license": "MIT", ++ "engines": { ++ "node": ">= 8" ++ } ++ }, ++ "node_modules/@nodelib/fs.walk": { ++ "version": "1.2.8", ++ "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", ++ "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "@nodelib/fs.scandir": "2.1.5", ++ "fastq": "^1.6.0" ++ }, ++ "engines": { ++ "node": ">= 8" ++ } ++ }, + "node_modules/@pkgr/core": { + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/@pkgr/core/-/core-0.2.7.tgz", +@@ -435,6 +521,72 @@ + "url": "https://opencollective.com/pkgr" + } + }, ++ "node_modules/@rtsao/scc": { ++ "version": "1.1.0", ++ "resolved": "https://registry.npmjs.org/@rtsao/scc/-/scc-1.1.0.tgz", ++ "integrity": "sha512-zt6OdqaDoOnJ1ZYsCYGt9YmWzDXl4vQdKTyJev62gFhRGKdx7mcT54V9KIjg+d2wi9EXsPvAPKe7i7WjfVWB8g==", ++ "dev": true, ++ "license": "MIT" ++ }, ++ "node_modules/@tsconfig/node10": { ++ "version": "1.0.11", ++ "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.11.tgz", ++ "integrity": "sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==", ++ "dev": true, ++ "license": "MIT" ++ }, ++ "node_modules/@tsconfig/node12": { ++ "version": "1.0.11", ++ "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", ++ "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", ++ "dev": true, ++ "license": "MIT" ++ }, ++ "node_modules/@tsconfig/node14": { ++ "version": "1.0.3", ++ "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", ++ "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", ++ "dev": true, ++ "license": "MIT" ++ }, ++ "node_modules/@tsconfig/node16": { ++ "version": "1.0.4", ++ "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", ++ "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", ++ "dev": true, ++ "license": "MIT" ++ }, ++ "node_modules/@types/body-parser": { ++ "version": "1.19.6", ++ "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.6.tgz", ++ "integrity": "sha512-HLFeCYgz89uk22N5Qg3dvGvsv46B8GLvKKo1zKG4NybA8U2DiEO3w9lqGg29t/tfLRJpJ6iQxnVw4OnB7MoM9g==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "@types/connect": "*", ++ "@types/node": "*" ++ } ++ }, ++ "node_modules/@types/connect": { ++ "version": "3.4.38", ++ "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.38.tgz", ++ "integrity": "sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "@types/node": "*" ++ } ++ }, ++ "node_modules/@types/cors": { ++ "version": "2.8.19", ++ "resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.19.tgz", ++ "integrity": "sha512-mFNylyeyqN93lfe/9CSxOGREz8cpzAhH+E93xJ4xWQf62V8sQ/24reV2nyzUWM6H6Xji+GGHpkbLe7pVoUEskg==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "@types/node": "*" ++ } ++ }, + "node_modules/@types/estree": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", +@@ -442,6 +594,38 @@ + "dev": true, + "license": "MIT" + }, ++ "node_modules/@types/express": { ++ "version": "5.0.3", ++ "resolved": "https://registry.npmjs.org/@types/express/-/express-5.0.3.tgz", ++ "integrity": "sha512-wGA0NX93b19/dZC1J18tKWVIYWyyF2ZjT9vin/NRu0qzzvfVzWjs04iq2rQ3H65vCTQYlRqs3YHfY7zjdV+9Kw==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "@types/body-parser": "*", ++ "@types/express-serve-static-core": "^5.0.0", ++ "@types/serve-static": "*" ++ } ++ }, ++ "node_modules/@types/express-serve-static-core": { ++ "version": "5.0.7", ++ "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-5.0.7.tgz", ++ "integrity": "sha512-R+33OsgWw7rOhD1emjU7dzCDHucJrgJXMA5PYCzJxVil0dsyx5iBEPHqpPfiKNJQb7lZ1vxwoLR4Z87bBUpeGQ==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "@types/node": "*", ++ "@types/qs": "*", ++ "@types/range-parser": "*", ++ "@types/send": "*" ++ } ++ }, ++ "node_modules/@types/http-errors": { ++ "version": "2.0.5", ++ "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-2.0.5.tgz", ++ "integrity": "sha512-r8Tayk8HJnX0FztbZN7oVqGccWgw98T/0neJphO91KkmOzug1KkofZURD4UaD5uH8AqcFLfdPErnBod0u71/qg==", ++ "dev": true, ++ "license": "MIT" ++ }, + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", +@@ -449,15 +633,65 @@ + "dev": true, + "license": "MIT" + }, ++ "node_modules/@types/json5": { ++ "version": "0.0.29", ++ "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", ++ "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", ++ "dev": true, ++ "license": "MIT" ++ }, ++ "node_modules/@types/mime": { ++ "version": "1.3.5", ++ "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.5.tgz", ++ "integrity": "sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w==", ++ "dev": true, ++ "license": "MIT" ++ }, + "node_modules/@types/node": { +- "version": "22.10.1", +- "resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.1.tgz", +- "integrity": "sha512-qKgsUwfHZV2WCWLAnVP1JqnpE6Im6h3Y0+fYgMTasNQ7V++CBX5OT1as0g0f+OyubbFqhf6XVNIsmN4IIhEgGQ==", ++ "version": "24.2.1", ++ "resolved": "https://registry.npmjs.org/@types/node/-/node-24.2.1.tgz", ++ "integrity": "sha512-DRh5K+ka5eJic8CjH7td8QpYEV6Zo10gfRkjHCO3weqZHWDtAaSTFtl4+VMqOJ4N5jcuhZ9/l+yy8rVgw7BQeQ==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "undici-types": "~7.10.0" ++ } ++ }, ++ "node_modules/@types/qs": { ++ "version": "6.14.0", ++ "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.14.0.tgz", ++ "integrity": "sha512-eOunJqu0K1923aExK6y8p6fsihYEn/BYuQ4g0CxAAgFc4b/ZLN4CrsRZ55srTdqoiLzU2B2evC+apEIxprEzkQ==", ++ "dev": true, ++ "license": "MIT" ++ }, ++ "node_modules/@types/range-parser": { ++ "version": "1.2.7", ++ "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.7.tgz", ++ "integrity": "sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ==", ++ "dev": true, ++ "license": "MIT" ++ }, ++ "node_modules/@types/send": { ++ "version": "0.17.5", ++ "resolved": "https://registry.npmjs.org/@types/send/-/send-0.17.5.tgz", ++ "integrity": "sha512-z6F2D3cOStZvuk2SaP6YrwkNO65iTZcwA2ZkSABegdkAh/lf+Aa/YQndZVfmEXT5vgAp6zv06VQ3ejSVjAny4w==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "@types/mime": "^1", ++ "@types/node": "*" ++ } ++ }, ++ "node_modules/@types/serve-static": { ++ "version": "1.15.8", ++ "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.8.tgz", ++ "integrity": "sha512-roei0UY3LhpOJvjbIP6ZZFngyLKl5dskOtDhxY5THRSpO+ZI+nzJ+m5yUMzGrp89YRa7lvknKkMYjqQFGwA7Sg==", + "dev": true, + "license": "MIT", +- "optional": true, + "dependencies": { +- "undici-types": "~6.20.0" ++ "@types/http-errors": "*", ++ "@types/node": "*", ++ "@types/send": "*" + } + }, + "node_modules/@types/sinonjs__fake-timers": { +@@ -485,150 +719,421 @@ + "@types/node": "*" + } + }, +- "node_modules/accepts": { +- "version": "2.0.0", +- "resolved": "https://registry.npmjs.org/accepts/-/accepts-2.0.0.tgz", +- "integrity": "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==", ++ "node_modules/@typescript-eslint/eslint-plugin": { ++ "version": "8.39.1", ++ "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.39.1.tgz", ++ "integrity": "sha512-yYegZ5n3Yr6eOcqgj2nJH8cH/ZZgF+l0YIdKILSDjYFRjgYQMgv/lRjV5Z7Up04b9VYUondt8EPMqg7kTWgJ2g==", ++ "dev": true, + "license": "MIT", + "dependencies": { +- "mime-types": "^3.0.0", +- "negotiator": "^1.0.0" ++ "@eslint-community/regexpp": "^4.10.0", ++ "@typescript-eslint/scope-manager": "8.39.1", ++ "@typescript-eslint/type-utils": "8.39.1", ++ "@typescript-eslint/utils": "8.39.1", ++ "@typescript-eslint/visitor-keys": "8.39.1", ++ "graphemer": "^1.4.0", ++ "ignore": "^7.0.0", ++ "natural-compare": "^1.4.0", ++ "ts-api-utils": "^2.1.0" + }, + "engines": { +- "node": ">= 0.6" ++ "node": "^18.18.0 || ^20.9.0 || >=21.1.0" ++ }, ++ "funding": { ++ "type": "opencollective", ++ "url": "https://opencollective.com/typescript-eslint" ++ }, ++ "peerDependencies": { ++ "@typescript-eslint/parser": "^8.39.1", ++ "eslint": "^8.57.0 || ^9.0.0", ++ "typescript": ">=4.8.4 <6.0.0" + } + }, +- "node_modules/accepts/node_modules/mime-db": { +- "version": "1.54.0", +- "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz", +- "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==", ++ "node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore": { ++ "version": "7.0.5", ++ "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.5.tgz", ++ "integrity": "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==", ++ "dev": true, + "license": "MIT", + "engines": { +- "node": ">= 0.6" ++ "node": ">= 4" + } + }, +- "node_modules/accepts/node_modules/mime-types": { +- "version": "3.0.1", +- "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.1.tgz", +- "integrity": "sha512-xRc4oEhT6eaBpU1XF7AjpOFD+xQmXNB5OVKwp4tqCuBpHLS/ZbBDrc07mYTDqVMg6PfxUjjNp85O6Cd2Z/5HWA==", ++ "node_modules/@typescript-eslint/parser": { ++ "version": "8.39.1", ++ "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.39.1.tgz", ++ "integrity": "sha512-pUXGCuHnnKw6PyYq93lLRiZm3vjuslIy7tus1lIQTYVK9bL8XBgJnCWm8a0KcTtHC84Yya1Q6rtll+duSMj0dg==", ++ "dev": true, + "license": "MIT", + "dependencies": { +- "mime-db": "^1.54.0" ++ "@typescript-eslint/scope-manager": "8.39.1", ++ "@typescript-eslint/types": "8.39.1", ++ "@typescript-eslint/typescript-estree": "8.39.1", ++ "@typescript-eslint/visitor-keys": "8.39.1", ++ "debug": "^4.3.4" + }, + "engines": { +- "node": ">= 0.6" +- } +- }, +- "node_modules/acorn": { +- "version": "8.15.0", +- "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", +- "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", +- "dev": true, +- "license": "MIT", +- "bin": { +- "acorn": "bin/acorn" ++ "node": "^18.18.0 || ^20.9.0 || >=21.1.0" ++ }, ++ "funding": { ++ "type": "opencollective", ++ "url": "https://opencollective.com/typescript-eslint" + }, +- "engines": { +- "node": ">=0.4.0" +- } +- }, +- "node_modules/acorn-jsx": { +- "version": "5.3.2", +- "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", +- "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", +- "dev": true, +- "license": "MIT", + "peerDependencies": { +- "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" ++ "eslint": "^8.57.0 || ^9.0.0", ++ "typescript": ">=4.8.4 <6.0.0" + } + }, +- "node_modules/aggregate-error": { +- "version": "3.1.0", +- "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", +- "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", ++ "node_modules/@typescript-eslint/project-service": { ++ "version": "8.39.1", ++ "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.39.1.tgz", ++ "integrity": "sha512-8fZxek3ONTwBu9ptw5nCKqZOSkXshZB7uAxuFF0J/wTMkKydjXCzqqga7MlFMpHi9DoG4BadhmTkITBcg8Aybw==", + "dev": true, + "license": "MIT", + "dependencies": { +- "clean-stack": "^2.0.0", +- "indent-string": "^4.0.0" ++ "@typescript-eslint/tsconfig-utils": "^8.39.1", ++ "@typescript-eslint/types": "^8.39.1", ++ "debug": "^4.3.4" + }, + "engines": { +- "node": ">=8" ++ "node": "^18.18.0 || ^20.9.0 || >=21.1.0" ++ }, ++ "funding": { ++ "type": "opencollective", ++ "url": "https://opencollective.com/typescript-eslint" ++ }, ++ "peerDependencies": { ++ "typescript": ">=4.8.4 <6.0.0" + } + }, +- "node_modules/ajv": { +- "version": "6.12.6", +- "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", +- "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", ++ "node_modules/@typescript-eslint/scope-manager": { ++ "version": "8.39.1", ++ "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.39.1.tgz", ++ "integrity": "sha512-RkBKGBrjgskFGWuyUGz/EtD8AF/GW49S21J8dvMzpJitOF1slLEbbHnNEtAHtnDAnx8qDEdRrULRnWVx27wGBw==", + "dev": true, + "license": "MIT", + "dependencies": { +- "fast-deep-equal": "^3.1.1", +- "fast-json-stable-stringify": "^2.0.0", +- "json-schema-traverse": "^0.4.1", +- "uri-js": "^4.2.2" ++ "@typescript-eslint/types": "8.39.1", ++ "@typescript-eslint/visitor-keys": "8.39.1" ++ }, ++ "engines": { ++ "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { +- "type": "github", +- "url": "https://github.com/sponsors/epoberezkin" ++ "type": "opencollective", ++ "url": "https://opencollective.com/typescript-eslint" + } + }, +- "node_modules/ansi-colors": { +- "version": "4.1.3", +- "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz", +- "integrity": "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==", ++ "node_modules/@typescript-eslint/tsconfig-utils": { ++ "version": "8.39.1", ++ "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.39.1.tgz", ++ "integrity": "sha512-ePUPGVtTMR8XMU2Hee8kD0Pu4NDE1CN9Q1sxGSGd/mbOtGZDM7pnhXNJnzW63zk/q+Z54zVzj44HtwXln5CvHA==", + "dev": true, + "license": "MIT", + "engines": { +- "node": ">=6" ++ "node": "^18.18.0 || ^20.9.0 || >=21.1.0" ++ }, ++ "funding": { ++ "type": "opencollective", ++ "url": "https://opencollective.com/typescript-eslint" ++ }, ++ "peerDependencies": { ++ "typescript": ">=4.8.4 <6.0.0" + } + }, +- "node_modules/ansi-escapes": { +- "version": "4.3.2", +- "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", +- "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", ++ "node_modules/@typescript-eslint/type-utils": { ++ "version": "8.39.1", ++ "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.39.1.tgz", ++ "integrity": "sha512-gu9/ahyatyAdQbKeHnhT4R+y3YLtqqHyvkfDxaBYk97EcbfChSJXyaJnIL3ygUv7OuZatePHmQvuH5ru0lnVeA==", + "dev": true, + "license": "MIT", + "dependencies": { +- "type-fest": "^0.21.3" ++ "@typescript-eslint/types": "8.39.1", ++ "@typescript-eslint/typescript-estree": "8.39.1", ++ "@typescript-eslint/utils": "8.39.1", ++ "debug": "^4.3.4", ++ "ts-api-utils": "^2.1.0" + }, + "engines": { +- "node": ">=8" ++ "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { +- "url": "https://github.com/sponsors/sindresorhus" ++ "type": "opencollective", ++ "url": "https://opencollective.com/typescript-eslint" ++ }, ++ "peerDependencies": { ++ "eslint": "^8.57.0 || ^9.0.0", ++ "typescript": ">=4.8.4 <6.0.0" + } + }, +- "node_modules/ansi-regex": { +- "version": "5.0.1", +- "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", +- "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", ++ "node_modules/@typescript-eslint/types": { ++ "version": "8.39.1", ++ "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.39.1.tgz", ++ "integrity": "sha512-7sPDKQQp+S11laqTrhHqeAbsCfMkwJMrV7oTDvtDds4mEofJYir414bYKUEb8YPUm9QL3U+8f6L6YExSoAGdQw==", + "dev": true, + "license": "MIT", + "engines": { +- "node": ">=8" ++ "node": "^18.18.0 || ^20.9.0 || >=21.1.0" ++ }, ++ "funding": { ++ "type": "opencollective", ++ "url": "https://opencollective.com/typescript-eslint" + } + }, +- "node_modules/ansi-styles": { +- "version": "4.3.0", +- "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", +- "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", ++ "node_modules/@typescript-eslint/typescript-estree": { ++ "version": "8.39.1", ++ "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.39.1.tgz", ++ "integrity": "sha512-EKkpcPuIux48dddVDXyQBlKdeTPMmALqBUbEk38McWv0qVEZwOpVJBi7ugK5qVNgeuYjGNQxrrnoM/5+TI/BPw==", + "dev": true, + "license": "MIT", + "dependencies": { +- "color-convert": "^2.0.1" ++ "@typescript-eslint/project-service": "8.39.1", ++ "@typescript-eslint/tsconfig-utils": "8.39.1", ++ "@typescript-eslint/types": "8.39.1", ++ "@typescript-eslint/visitor-keys": "8.39.1", ++ "debug": "^4.3.4", ++ "fast-glob": "^3.3.2", ++ "is-glob": "^4.0.3", ++ "minimatch": "^9.0.4", ++ "semver": "^7.6.0", ++ "ts-api-utils": "^2.1.0" + }, + "engines": { +- "node": ">=8" ++ "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { +- "url": "https://github.com/chalk/ansi-styles?sponsor=1" ++ "type": "opencollective", ++ "url": "https://opencollective.com/typescript-eslint" ++ }, ++ "peerDependencies": { ++ "typescript": ">=4.8.4 <6.0.0" + } + }, +- "node_modules/anymatch": { +- "version": "3.1.3", +- "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", +- "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", ++ "node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": { ++ "version": "2.0.2", ++ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", ++ "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "balanced-match": "^1.0.0" ++ } ++ }, ++ "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": { ++ "version": "9.0.5", ++ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", ++ "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", ++ "dev": true, ++ "license": "ISC", ++ "dependencies": { ++ "brace-expansion": "^2.0.1" ++ }, ++ "engines": { ++ "node": ">=16 || 14 >=14.17" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/isaacs" ++ } ++ }, ++ "node_modules/@typescript-eslint/utils": { ++ "version": "8.39.1", ++ "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.39.1.tgz", ++ "integrity": "sha512-VF5tZ2XnUSTuiqZFXCZfZs1cgkdd3O/sSYmdo2EpSyDlC86UM/8YytTmKnehOW3TGAlivqTDT6bS87B/GQ/jyg==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "@eslint-community/eslint-utils": "^4.7.0", ++ "@typescript-eslint/scope-manager": "8.39.1", ++ "@typescript-eslint/types": "8.39.1", ++ "@typescript-eslint/typescript-estree": "8.39.1" ++ }, ++ "engines": { ++ "node": "^18.18.0 || ^20.9.0 || >=21.1.0" ++ }, ++ "funding": { ++ "type": "opencollective", ++ "url": "https://opencollective.com/typescript-eslint" ++ }, ++ "peerDependencies": { ++ "eslint": "^8.57.0 || ^9.0.0", ++ "typescript": ">=4.8.4 <6.0.0" ++ } ++ }, ++ "node_modules/@typescript-eslint/visitor-keys": { ++ "version": "8.39.1", ++ "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.39.1.tgz", ++ "integrity": "sha512-W8FQi6kEh2e8zVhQ0eeRnxdvIoOkAp/CPAahcNio6nO9dsIwb9b34z90KOlheoyuVf6LSOEdjlkxSkapNEc+4A==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "@typescript-eslint/types": "8.39.1", ++ "eslint-visitor-keys": "^4.2.1" ++ }, ++ "engines": { ++ "node": "^18.18.0 || ^20.9.0 || >=21.1.0" ++ }, ++ "funding": { ++ "type": "opencollective", ++ "url": "https://opencollective.com/typescript-eslint" ++ } ++ }, ++ "node_modules/accepts": { ++ "version": "2.0.0", ++ "resolved": "https://registry.npmjs.org/accepts/-/accepts-2.0.0.tgz", ++ "integrity": "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==", ++ "license": "MIT", ++ "dependencies": { ++ "mime-types": "^3.0.0", ++ "negotiator": "^1.0.0" ++ }, ++ "engines": { ++ "node": ">= 0.6" ++ } ++ }, ++ "node_modules/accepts/node_modules/mime-db": { ++ "version": "1.54.0", ++ "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz", ++ "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==", ++ "license": "MIT", ++ "engines": { ++ "node": ">= 0.6" ++ } ++ }, ++ "node_modules/accepts/node_modules/mime-types": { ++ "version": "3.0.1", ++ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.1.tgz", ++ "integrity": "sha512-xRc4oEhT6eaBpU1XF7AjpOFD+xQmXNB5OVKwp4tqCuBpHLS/ZbBDrc07mYTDqVMg6PfxUjjNp85O6Cd2Z/5HWA==", ++ "license": "MIT", ++ "dependencies": { ++ "mime-db": "^1.54.0" ++ }, ++ "engines": { ++ "node": ">= 0.6" ++ } ++ }, ++ "node_modules/acorn": { ++ "version": "8.15.0", ++ "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", ++ "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", ++ "dev": true, ++ "license": "MIT", ++ "bin": { ++ "acorn": "bin/acorn" ++ }, ++ "engines": { ++ "node": ">=0.4.0" ++ } ++ }, ++ "node_modules/acorn-jsx": { ++ "version": "5.3.2", ++ "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", ++ "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", ++ "dev": true, ++ "license": "MIT", ++ "peerDependencies": { ++ "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" ++ } ++ }, ++ "node_modules/acorn-walk": { ++ "version": "8.3.4", ++ "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.4.tgz", ++ "integrity": "sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "acorn": "^8.11.0" ++ }, ++ "engines": { ++ "node": ">=0.4.0" ++ } ++ }, ++ "node_modules/aggregate-error": { ++ "version": "3.1.0", ++ "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", ++ "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "clean-stack": "^2.0.0", ++ "indent-string": "^4.0.0" ++ }, ++ "engines": { ++ "node": ">=8" ++ } ++ }, ++ "node_modules/ajv": { ++ "version": "6.12.6", ++ "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", ++ "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "fast-deep-equal": "^3.1.1", ++ "fast-json-stable-stringify": "^2.0.0", ++ "json-schema-traverse": "^0.4.1", ++ "uri-js": "^4.2.2" ++ }, ++ "funding": { ++ "type": "github", ++ "url": "https://github.com/sponsors/epoberezkin" ++ } ++ }, ++ "node_modules/ansi-colors": { ++ "version": "4.1.3", ++ "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz", ++ "integrity": "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==", ++ "dev": true, ++ "license": "MIT", ++ "engines": { ++ "node": ">=6" ++ } ++ }, ++ "node_modules/ansi-escapes": { ++ "version": "4.3.2", ++ "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", ++ "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "type-fest": "^0.21.3" ++ }, ++ "engines": { ++ "node": ">=8" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/sindresorhus" ++ } ++ }, ++ "node_modules/ansi-regex": { ++ "version": "5.0.1", ++ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", ++ "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", ++ "dev": true, ++ "license": "MIT", ++ "engines": { ++ "node": ">=8" ++ } ++ }, ++ "node_modules/ansi-styles": { ++ "version": "4.3.0", ++ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", ++ "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "color-convert": "^2.0.1" ++ }, ++ "engines": { ++ "node": ">=8" ++ }, ++ "funding": { ++ "url": "https://github.com/chalk/ansi-styles?sponsor=1" ++ } ++ }, ++ "node_modules/anymatch": { ++ "version": "3.1.3", ++ "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", ++ "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "license": "ISC", + "peer": true, +@@ -661,6 +1166,13 @@ + ], + "license": "MIT" + }, ++ "node_modules/arg": { ++ "version": "4.1.3", ++ "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", ++ "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", ++ "dev": true, ++ "license": "MIT" ++ }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", +@@ -668,6 +1180,128 @@ + "dev": true, + "license": "Python-2.0" + }, ++ "node_modules/array-buffer-byte-length": { ++ "version": "1.0.2", ++ "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.2.tgz", ++ "integrity": "sha512-LHE+8BuR7RYGDKvnrmcuSq3tDcKv9OFEXQt/HpbZhY7V6h0zlUXutnAD82GiFx9rdieCMjkvtcsPqBwgUl1Iiw==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "call-bound": "^1.0.3", ++ "is-array-buffer": "^3.0.5" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, ++ "node_modules/array-includes": { ++ "version": "3.1.9", ++ "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.9.tgz", ++ "integrity": "sha512-FmeCCAenzH0KH381SPT5FZmiA/TmpndpcaShhfgEN9eCVjnFBqq3l1xrI42y8+PPLI6hypzou4GXw00WHmPBLQ==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "call-bind": "^1.0.8", ++ "call-bound": "^1.0.4", ++ "define-properties": "^1.2.1", ++ "es-abstract": "^1.24.0", ++ "es-object-atoms": "^1.1.1", ++ "get-intrinsic": "^1.3.0", ++ "is-string": "^1.1.1", ++ "math-intrinsics": "^1.1.0" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, ++ "node_modules/array.prototype.findlastindex": { ++ "version": "1.2.6", ++ "resolved": "https://registry.npmjs.org/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.6.tgz", ++ "integrity": "sha512-F/TKATkzseUExPlfvmwQKGITM3DGTK+vkAsCZoDc5daVygbJBnjEUCbgkAvVFsgfXfX4YIqZ/27G3k3tdXrTxQ==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "call-bind": "^1.0.8", ++ "call-bound": "^1.0.4", ++ "define-properties": "^1.2.1", ++ "es-abstract": "^1.23.9", ++ "es-errors": "^1.3.0", ++ "es-object-atoms": "^1.1.1", ++ "es-shim-unscopables": "^1.1.0" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, ++ "node_modules/array.prototype.flat": { ++ "version": "1.3.3", ++ "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.3.tgz", ++ "integrity": "sha512-rwG/ja1neyLqCuGZ5YYrznA62D4mZXg0i1cIskIUKSiqF3Cje9/wXAls9B9s1Wa2fomMsIv8czB8jZcPmxCXFg==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "call-bind": "^1.0.8", ++ "define-properties": "^1.2.1", ++ "es-abstract": "^1.23.5", ++ "es-shim-unscopables": "^1.0.2" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, ++ "node_modules/array.prototype.flatmap": { ++ "version": "1.3.3", ++ "resolved": "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.3.3.tgz", ++ "integrity": "sha512-Y7Wt51eKJSyi80hFrJCePGGNo5ktJCslFuboqJsbf57CCPcm5zztluPlc4/aD8sWsKvlwatezpV4U1efk8kpjg==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "call-bind": "^1.0.8", ++ "define-properties": "^1.2.1", ++ "es-abstract": "^1.23.5", ++ "es-shim-unscopables": "^1.0.2" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, ++ "node_modules/arraybuffer.prototype.slice": { ++ "version": "1.0.4", ++ "resolved": "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.4.tgz", ++ "integrity": "sha512-BNoCY6SXXPQ7gF2opIP4GBE+Xw7U+pHMYKuzjgCN3GwiaIR09UUeKfheyIry77QtrCBlC0KK0q5/TER/tYh3PQ==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "array-buffer-byte-length": "^1.0.1", ++ "call-bind": "^1.0.8", ++ "define-properties": "^1.2.1", ++ "es-abstract": "^1.23.5", ++ "es-errors": "^1.3.0", ++ "get-intrinsic": "^1.2.6", ++ "is-array-buffer": "^3.0.4" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, + "node_modules/asn1": { + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz", +@@ -705,6 +1339,16 @@ + "dev": true, + "license": "MIT" + }, ++ "node_modules/async-function": { ++ "version": "1.0.0", ++ "resolved": "https://registry.npmjs.org/async-function/-/async-function-1.0.0.tgz", ++ "integrity": "sha512-hsU18Ae8CDTR6Kgu9DYf0EbCr/a5iGL0rytQDobUcdpYOKokk8LEjVphnXkDkgpi0wYVsqrXuP0bZxJaTqdgoA==", ++ "dev": true, ++ "license": "MIT", ++ "engines": { ++ "node": ">= 0.4" ++ } ++ }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", +@@ -722,6 +1366,22 @@ + "node": ">= 4.0.0" + } + }, ++ "node_modules/available-typed-arrays": { ++ "version": "1.0.7", ++ "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", ++ "integrity": "sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "possible-typed-array-names": "^1.0.0" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, + "node_modules/aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", +@@ -842,7 +1502,6 @@ + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "license": "MIT", +- "peer": true, + "dependencies": { + "fill-range": "^7.1.1" + }, +@@ -912,6 +1571,25 @@ + "node": ">=6" + } + }, ++ "node_modules/call-bind": { ++ "version": "1.0.8", ++ "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.8.tgz", ++ "integrity": "sha512-oKlSFMcMwpUg2ednkhQ454wfWiU/ul3CkJe/PEHcTKuiX6RpbehUiFMXu13HalGZxfUwCQzZG747YXBn1im9ww==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "call-bind-apply-helpers": "^1.0.0", ++ "es-define-property": "^1.0.0", ++ "get-intrinsic": "^1.2.4", ++ "set-function-length": "^1.2.2" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", +@@ -1274,6 +1952,13 @@ + "node": ">= 0.10" + } + }, ++ "node_modules/create-require": { ++ "version": "1.1.1", ++ "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", ++ "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", ++ "dev": true, ++ "license": "MIT" ++ }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", +@@ -1290,9 +1975,9 @@ + } + }, + "node_modules/cypress": { +- "version": "14.5.3", +- "resolved": "https://registry.npmjs.org/cypress/-/cypress-14.5.3.tgz", +- "integrity": "sha512-syLwKjDeMg77FRRx68bytLdlqHXDT4yBVh0/PPkcgesChYDjUZbwxLqMXuryYKzAyJsPsQHUDW1YU74/IYEUIA==", ++ "version": "14.5.4", ++ "resolved": "https://registry.npmjs.org/cypress/-/cypress-14.5.4.tgz", ++ "integrity": "sha512-0Dhm4qc9VatOcI1GiFGVt8osgpPdqJLHzRwcAB5MSD/CAAts3oybvPUPawHyvJZUd8osADqZe/xzMsZ8sDTjXw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", +@@ -1413,6 +2098,60 @@ + "node": ">=0.10" + } + }, ++ "node_modules/data-view-buffer": { ++ "version": "1.0.2", ++ "resolved": "https://registry.npmjs.org/data-view-buffer/-/data-view-buffer-1.0.2.tgz", ++ "integrity": "sha512-EmKO5V3OLXh1rtK2wgXRansaK1/mtVdTUEiEI0W8RkvgT05kfxaH29PliLnpLP73yYO6142Q72QNa8Wx/A5CqQ==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "call-bound": "^1.0.3", ++ "es-errors": "^1.3.0", ++ "is-data-view": "^1.0.2" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, ++ "node_modules/data-view-byte-length": { ++ "version": "1.0.2", ++ "resolved": "https://registry.npmjs.org/data-view-byte-length/-/data-view-byte-length-1.0.2.tgz", ++ "integrity": "sha512-tuhGbE6CfTM9+5ANGf+oQb72Ky/0+s3xKUpHvShfiz2RxMFgFPjsXuRLBVMtvMs15awe45SRb83D6wH4ew6wlQ==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "call-bound": "^1.0.3", ++ "es-errors": "^1.3.0", ++ "is-data-view": "^1.0.2" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/inspect-js" ++ } ++ }, ++ "node_modules/data-view-byte-offset": { ++ "version": "1.0.1", ++ "resolved": "https://registry.npmjs.org/data-view-byte-offset/-/data-view-byte-offset-1.0.1.tgz", ++ "integrity": "sha512-BS8PfmtDGnrgYdOonGZQdLZslWIeCGFP9tpan0hi1Co2Zr2NKADsvGYA8XxuG/4UWgJ6Cjtv+YJnB6MM69QGlQ==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "call-bound": "^1.0.2", ++ "es-errors": "^1.3.0", ++ "is-data-view": "^1.0.1" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, + "node_modules/dateformat": { + "version": "4.6.3", + "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-4.6.3.tgz", +@@ -1468,6 +2207,42 @@ + "dev": true, + "license": "MIT" + }, ++ "node_modules/define-data-property": { ++ "version": "1.1.4", ++ "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", ++ "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "es-define-property": "^1.0.0", ++ "es-errors": "^1.3.0", ++ "gopd": "^1.0.1" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, ++ "node_modules/define-properties": { ++ "version": "1.2.1", ++ "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz", ++ "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "define-data-property": "^1.0.1", ++ "has-property-descriptors": "^1.0.0", ++ "object-keys": "^1.1.1" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", +@@ -1497,6 +2272,19 @@ + "node": ">=0.3.1" + } + }, ++ "node_modules/doctrine": { ++ "version": "2.1.0", ++ "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", ++ "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", ++ "dev": true, ++ "license": "Apache-2.0", ++ "dependencies": { ++ "esutils": "^2.0.2" ++ }, ++ "engines": { ++ "node": ">=0.10.0" ++ } ++ }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", +@@ -1575,6 +2363,75 @@ + "node": ">=8.6" + } + }, ++ "node_modules/es-abstract": { ++ "version": "1.24.0", ++ "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.24.0.tgz", ++ "integrity": "sha512-WSzPgsdLtTcQwm4CROfS5ju2Wa1QQcVeT37jFjYzdFz1r9ahadC8B8/a4qxJxM+09F18iumCdRmlr96ZYkQvEg==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "array-buffer-byte-length": "^1.0.2", ++ "arraybuffer.prototype.slice": "^1.0.4", ++ "available-typed-arrays": "^1.0.7", ++ "call-bind": "^1.0.8", ++ "call-bound": "^1.0.4", ++ "data-view-buffer": "^1.0.2", ++ "data-view-byte-length": "^1.0.2", ++ "data-view-byte-offset": "^1.0.1", ++ "es-define-property": "^1.0.1", ++ "es-errors": "^1.3.0", ++ "es-object-atoms": "^1.1.1", ++ "es-set-tostringtag": "^2.1.0", ++ "es-to-primitive": "^1.3.0", ++ "function.prototype.name": "^1.1.8", ++ "get-intrinsic": "^1.3.0", ++ "get-proto": "^1.0.1", ++ "get-symbol-description": "^1.1.0", ++ "globalthis": "^1.0.4", ++ "gopd": "^1.2.0", ++ "has-property-descriptors": "^1.0.2", ++ "has-proto": "^1.2.0", ++ "has-symbols": "^1.1.0", ++ "hasown": "^2.0.2", ++ "internal-slot": "^1.1.0", ++ "is-array-buffer": "^3.0.5", ++ "is-callable": "^1.2.7", ++ "is-data-view": "^1.0.2", ++ "is-negative-zero": "^2.0.3", ++ "is-regex": "^1.2.1", ++ "is-set": "^2.0.3", ++ "is-shared-array-buffer": "^1.0.4", ++ "is-string": "^1.1.1", ++ "is-typed-array": "^1.1.15", ++ "is-weakref": "^1.1.1", ++ "math-intrinsics": "^1.1.0", ++ "object-inspect": "^1.13.4", ++ "object-keys": "^1.1.1", ++ "object.assign": "^4.1.7", ++ "own-keys": "^1.0.1", ++ "regexp.prototype.flags": "^1.5.4", ++ "safe-array-concat": "^1.1.3", ++ "safe-push-apply": "^1.0.0", ++ "safe-regex-test": "^1.1.0", ++ "set-proto": "^1.0.0", ++ "stop-iteration-iterator": "^1.1.0", ++ "string.prototype.trim": "^1.2.10", ++ "string.prototype.trimend": "^1.0.9", ++ "string.prototype.trimstart": "^1.0.8", ++ "typed-array-buffer": "^1.0.3", ++ "typed-array-byte-length": "^1.0.3", ++ "typed-array-byte-offset": "^1.0.4", ++ "typed-array-length": "^1.0.7", ++ "unbox-primitive": "^1.1.0", ++ "which-typed-array": "^1.1.19" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", +@@ -1621,6 +2478,37 @@ + "node": ">= 0.4" + } + }, ++ "node_modules/es-shim-unscopables": { ++ "version": "1.1.0", ++ "resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.1.0.tgz", ++ "integrity": "sha512-d9T8ucsEhh8Bi1woXCf+TIKDIROLG5WCkxg8geBCbvk22kzwC5G2OnXVMO6FUsvQlgUUXQ2itephWDLqDzbeCw==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "hasown": "^2.0.2" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ } ++ }, ++ "node_modules/es-to-primitive": { ++ "version": "1.3.0", ++ "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.3.0.tgz", ++ "integrity": "sha512-w+5mJ3GuFL+NjVtJlvydShqE1eN3h3PbI7/5LAsYJP/2qtuMXjfL2LpHSRqo4b4eSF5K/DH1JXKUAHSB2UW50g==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "is-callable": "^1.2.7", ++ "is-date-object": "^1.0.5", ++ "is-symbol": "^1.0.4" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", +@@ -1727,23 +2615,127 @@ + "eslint": ">=7.0.0" + } + }, ++ "node_modules/eslint-import-resolver-node": { ++ "version": "0.3.9", ++ "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz", ++ "integrity": "sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "debug": "^3.2.7", ++ "is-core-module": "^2.13.0", ++ "resolve": "^1.22.4" ++ } ++ }, ++ "node_modules/eslint-import-resolver-node/node_modules/debug": { ++ "version": "3.2.7", ++ "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", ++ "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "ms": "^2.1.1" ++ } ++ }, ++ "node_modules/eslint-module-utils": { ++ "version": "2.12.1", ++ "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.12.1.tgz", ++ "integrity": "sha512-L8jSWTze7K2mTg0vos/RuLRS5soomksDPoJLXIslC7c8Wmut3bx7CPpJijDcBZtxQ5lrbUdM+s0OlNbz0DCDNw==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "debug": "^3.2.7" ++ }, ++ "engines": { ++ "node": ">=4" ++ }, ++ "peerDependenciesMeta": { ++ "eslint": { ++ "optional": true ++ } ++ } ++ }, ++ "node_modules/eslint-module-utils/node_modules/debug": { ++ "version": "3.2.7", ++ "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", ++ "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "ms": "^2.1.1" ++ } ++ }, + "node_modules/eslint-plugin-cypress": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-cypress/-/eslint-plugin-cypress-5.1.0.tgz", + "integrity": "sha512-tdLXm4aq9vX2hTtKJTUFD3gdNseMKqsf8+P6hI4TtOPdz1LU4xvTpQBd1++qPAsPZP2lyYh71B5mvzu2lBr4Ow==", + "dev": true, +- "license": "MIT", +- "dependencies": { +- "globals": "^16.2.0" +- }, +- "peerDependencies": { +- "eslint": ">=9" ++ "license": "MIT", ++ "dependencies": { ++ "globals": "^16.2.0" ++ }, ++ "peerDependencies": { ++ "eslint": ">=9" ++ } ++ }, ++ "node_modules/eslint-plugin-import": { ++ "version": "2.32.0", ++ "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.32.0.tgz", ++ "integrity": "sha512-whOE1HFo/qJDyX4SnXzP4N6zOWn79WhnCUY/iDR0mPfQZO8wcYE4JClzI2oZrhBnnMUCBCHZhO6VQyoBU95mZA==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "@rtsao/scc": "^1.1.0", ++ "array-includes": "^3.1.9", ++ "array.prototype.findlastindex": "^1.2.6", ++ "array.prototype.flat": "^1.3.3", ++ "array.prototype.flatmap": "^1.3.3", ++ "debug": "^3.2.7", ++ "doctrine": "^2.1.0", ++ "eslint-import-resolver-node": "^0.3.9", ++ "eslint-module-utils": "^2.12.1", ++ "hasown": "^2.0.2", ++ "is-core-module": "^2.16.1", ++ "is-glob": "^4.0.3", ++ "minimatch": "^3.1.2", ++ "object.fromentries": "^2.0.8", ++ "object.groupby": "^1.0.3", ++ "object.values": "^1.2.1", ++ "semver": "^6.3.1", ++ "string.prototype.trimend": "^1.0.9", ++ "tsconfig-paths": "^3.15.0" ++ }, ++ "engines": { ++ "node": ">=4" ++ }, ++ "peerDependencies": { ++ "eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8 || ^9" ++ } ++ }, ++ "node_modules/eslint-plugin-import/node_modules/debug": { ++ "version": "3.2.7", ++ "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", ++ "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "ms": "^2.1.1" ++ } ++ }, ++ "node_modules/eslint-plugin-import/node_modules/semver": { ++ "version": "6.3.1", ++ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", ++ "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", ++ "dev": true, ++ "license": "ISC", ++ "bin": { ++ "semver": "bin/semver.js" + } + }, + "node_modules/eslint-plugin-prettier": { +- "version": "5.5.3", +- "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.5.3.tgz", +- "integrity": "sha512-NAdMYww51ehKfDyDhv59/eIItUVzU0Io9H2E8nHNGKEeeqlnci+1gCvrHib6EmZdf6GxF+LCV5K7UC65Ezvw7w==", ++ "version": "5.5.4", ++ "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.5.4.tgz", ++ "integrity": "sha512-swNtI95SToIz05YINMA6Ox5R057IMAmWZ26GqPxusAp1TZzj+IdY9tXNWWD3vkF/wEqydCONcwjTFpxybBqZsg==", + "dev": true, + "license": "MIT", + "dependencies": { +@@ -1801,6 +2793,19 @@ + "url": "https://opencollective.com/eslint" + } + }, ++ "node_modules/eslint/node_modules/@eslint/js": { ++ "version": "9.32.0", ++ "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.32.0.tgz", ++ "integrity": "sha512-BBpRFZK3eX6uMLKz8WxFOBIFFcGFJ/g8XuwjTHCqHROSIsopI+ddn/d5Cfh36+7+e5edVS8dbSHnBNhrLEX0zg==", ++ "dev": true, ++ "license": "MIT", ++ "engines": { ++ "node": "^18.18.0 || ^20.9.0 || >=21.1.0" ++ }, ++ "funding": { ++ "url": "https://eslint.org/donate" ++ } ++ }, + "node_modules/espree": { + "version": "10.4.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-10.4.0.tgz", +@@ -2033,6 +3038,36 @@ + "dev": true, + "license": "Apache-2.0" + }, ++ "node_modules/fast-glob": { ++ "version": "3.3.3", ++ "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz", ++ "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "@nodelib/fs.stat": "^2.0.2", ++ "@nodelib/fs.walk": "^1.2.3", ++ "glob-parent": "^5.1.2", ++ "merge2": "^1.3.0", ++ "micromatch": "^4.0.8" ++ }, ++ "engines": { ++ "node": ">=8.6.0" ++ } ++ }, ++ "node_modules/fast-glob/node_modules/glob-parent": { ++ "version": "5.1.2", ++ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", ++ "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", ++ "dev": true, ++ "license": "ISC", ++ "dependencies": { ++ "is-glob": "^4.0.1" ++ }, ++ "engines": { ++ "node": ">= 6" ++ } ++ }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", +@@ -2047,6 +3082,16 @@ + "dev": true, + "license": "MIT" + }, ++ "node_modules/fastq": { ++ "version": "1.19.1", ++ "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.19.1.tgz", ++ "integrity": "sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ==", ++ "dev": true, ++ "license": "ISC", ++ "dependencies": { ++ "reusify": "^1.0.4" ++ } ++ }, + "node_modules/fd-slicer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", +@@ -2102,7 +3147,6 @@ + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "license": "MIT", +- "peer": true, + "dependencies": { + "to-regex-range": "^5.0.1" + }, +@@ -2176,6 +3220,22 @@ + "dev": true, + "license": "ISC" + }, ++ "node_modules/for-each": { ++ "version": "0.3.5", ++ "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.5.tgz", ++ "integrity": "sha512-dKx12eRCVIzqCxFGplyFKJMPvLEWgmNtUrpTiJIR5u97zEhRG8ySrtboPHZXx7daLxQVrl643cTzbab2tkQjxg==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "is-callable": "^1.2.7" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, + "node_modules/foreground-child": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.1.tgz", +@@ -2291,6 +3351,37 @@ + "url": "https://github.com/sponsors/ljharb" + } + }, ++ "node_modules/function.prototype.name": { ++ "version": "1.1.8", ++ "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.8.tgz", ++ "integrity": "sha512-e5iwyodOHhbMr/yNrc7fDYG4qlbIvI5gajyzPnb5TCwyhjApznQh1BMFou9b30SevY43gCJKXycoCBjMbsuW0Q==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "call-bind": "^1.0.8", ++ "call-bound": "^1.0.3", ++ "define-properties": "^1.2.1", ++ "functions-have-names": "^1.2.3", ++ "hasown": "^2.0.2", ++ "is-callable": "^1.2.7" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, ++ "node_modules/functions-have-names": { ++ "version": "1.2.3", ++ "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", ++ "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", ++ "dev": true, ++ "license": "MIT", ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", +@@ -2354,6 +3445,24 @@ + "url": "https://github.com/sponsors/sindresorhus" + } + }, ++ "node_modules/get-symbol-description": { ++ "version": "1.1.0", ++ "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.1.0.tgz", ++ "integrity": "sha512-w9UMqWwJxHNOvoNzSJ2oPF5wvYcvP7jUvYzhp67yEhTi17ZDBBC1z9pTdGuzjD+EFIqLSYRweZjqfiPzQ06Ebg==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "call-bound": "^1.0.3", ++ "es-errors": "^1.3.0", ++ "get-intrinsic": "^1.2.6" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, + "node_modules/getos": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/getos/-/getos-3.2.1.tgz", +@@ -2463,6 +3572,23 @@ + "url": "https://github.com/sponsors/sindresorhus" + } + }, ++ "node_modules/globalthis": { ++ "version": "1.0.4", ++ "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.4.tgz", ++ "integrity": "sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "define-properties": "^1.2.1", ++ "gopd": "^1.0.1" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", +@@ -2482,6 +3608,26 @@ + "dev": true, + "license": "ISC" + }, ++ "node_modules/graphemer": { ++ "version": "1.4.0", ++ "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", ++ "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", ++ "dev": true, ++ "license": "MIT" ++ }, ++ "node_modules/has-bigints": { ++ "version": "1.1.0", ++ "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.1.0.tgz", ++ "integrity": "sha512-R3pbpkcIqv2Pm3dUwgjclDRVmWpTJW2DcMzcIhEXEx1oh/CEMObMm3KLmRJOdvhM7o4uQBnwr8pzRK2sJWIqfg==", ++ "dev": true, ++ "license": "MIT", ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", +@@ -2492,6 +3638,35 @@ + "node": ">=8" + } + }, ++ "node_modules/has-property-descriptors": { ++ "version": "1.0.2", ++ "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", ++ "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "es-define-property": "^1.0.0" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, ++ "node_modules/has-proto": { ++ "version": "1.2.0", ++ "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.2.0.tgz", ++ "integrity": "sha512-KIL7eQPfHQRC8+XluaIw7BHUwwqL19bQn4hzNgdr+1wXoU0KKj6rufu47lhY7KbJR2C6T6+PfyN0Ea7wkSS+qQ==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "dunder-proto": "^1.0.0" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", +@@ -2680,76 +3855,226 @@ + "url": "https://github.com/sponsors/sindresorhus" + } + }, +- "node_modules/imurmurhash": { +- "version": "0.1.4", +- "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", +- "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", ++ "node_modules/imurmurhash": { ++ "version": "0.1.4", ++ "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", ++ "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", ++ "dev": true, ++ "license": "MIT", ++ "engines": { ++ "node": ">=0.8.19" ++ } ++ }, ++ "node_modules/indent-string": { ++ "version": "4.0.0", ++ "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", ++ "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", ++ "dev": true, ++ "license": "MIT", ++ "engines": { ++ "node": ">=8" ++ } ++ }, ++ "node_modules/inflight": { ++ "version": "1.0.6", ++ "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", ++ "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", ++ "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", ++ "dev": true, ++ "license": "ISC", ++ "peer": true, ++ "dependencies": { ++ "once": "^1.3.0", ++ "wrappy": "1" ++ } ++ }, ++ "node_modules/inherits": { ++ "version": "2.0.4", ++ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", ++ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", ++ "license": "ISC" ++ }, ++ "node_modules/ini": { ++ "version": "2.0.0", ++ "resolved": "https://registry.npmjs.org/ini/-/ini-2.0.0.tgz", ++ "integrity": "sha512-7PnF4oN3CvZF23ADhA5wRaYEQpJ8qygSkbtTXWBeXWXmEVRXK+1ITciHWwHhsjv1TmW0MgacIv6hEi5pX5NQdA==", ++ "dev": true, ++ "license": "ISC", ++ "engines": { ++ "node": ">=10" ++ } ++ }, ++ "node_modules/internal-slot": { ++ "version": "1.1.0", ++ "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.1.0.tgz", ++ "integrity": "sha512-4gd7VpWNQNB4UKKCFFVcp1AVv+FMOgs9NKzjHKusc8jTMhd5eL1NqQqOpE0KzMds804/yHlglp3uxgluOqAPLw==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "es-errors": "^1.3.0", ++ "hasown": "^2.0.2", ++ "side-channel": "^1.1.0" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ } ++ }, ++ "node_modules/ipaddr.js": { ++ "version": "1.9.1", ++ "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", ++ "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", ++ "license": "MIT", ++ "engines": { ++ "node": ">= 0.10" ++ } ++ }, ++ "node_modules/is-array-buffer": { ++ "version": "3.0.5", ++ "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.5.tgz", ++ "integrity": "sha512-DDfANUiiG2wC1qawP66qlTugJeL5HyzMpfr8lLK+jMQirGzNod0B12cFB/9q838Ru27sBwfw78/rdoU7RERz6A==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "call-bind": "^1.0.8", ++ "call-bound": "^1.0.3", ++ "get-intrinsic": "^1.2.6" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, ++ "node_modules/is-async-function": { ++ "version": "2.1.1", ++ "resolved": "https://registry.npmjs.org/is-async-function/-/is-async-function-2.1.1.tgz", ++ "integrity": "sha512-9dgM/cZBnNvjzaMYHVoxxfPj2QXt22Ev7SuuPrs+xav0ukGB0S6d4ydZdEiM48kLx5kDV+QBPrpVnFyefL8kkQ==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "async-function": "^1.0.0", ++ "call-bound": "^1.0.3", ++ "get-proto": "^1.0.1", ++ "has-tostringtag": "^1.0.2", ++ "safe-regex-test": "^1.1.0" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, ++ "node_modules/is-bigint": { ++ "version": "1.1.0", ++ "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.1.0.tgz", ++ "integrity": "sha512-n4ZT37wG78iz03xPRKJrHTdZbe3IicyucEtdRsV5yglwc3GyUfbAfpSeD0FJ41NbUNSt5wbhqfp1fS+BgnvDFQ==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "has-bigints": "^1.0.2" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, ++ "node_modules/is-binary-path": { ++ "version": "2.1.0", ++ "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", ++ "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", ++ "dev": true, ++ "license": "MIT", ++ "peer": true, ++ "dependencies": { ++ "binary-extensions": "^2.0.0" ++ }, ++ "engines": { ++ "node": ">=8" ++ } ++ }, ++ "node_modules/is-boolean-object": { ++ "version": "1.2.2", ++ "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.2.2.tgz", ++ "integrity": "sha512-wa56o2/ElJMYqjCjGkXri7it5FbebW5usLw/nPmCMs5DeZ7eziSYZhSmPRn0txqeW4LnAmQQU7FgqLpsEFKM4A==", + "dev": true, + "license": "MIT", ++ "dependencies": { ++ "call-bound": "^1.0.3", ++ "has-tostringtag": "^1.0.2" ++ }, + "engines": { +- "node": ">=0.8.19" ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" + } + }, +- "node_modules/indent-string": { +- "version": "4.0.0", +- "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", +- "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", ++ "node_modules/is-callable": { ++ "version": "1.2.7", ++ "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", ++ "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", + "dev": true, + "license": "MIT", + "engines": { +- "node": ">=8" ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" + } + }, +- "node_modules/inflight": { +- "version": "1.0.6", +- "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", +- "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", +- "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", ++ "node_modules/is-core-module": { ++ "version": "2.16.1", ++ "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz", ++ "integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==", + "dev": true, +- "license": "ISC", +- "peer": true, ++ "license": "MIT", + "dependencies": { +- "once": "^1.3.0", +- "wrappy": "1" +- } +- }, +- "node_modules/inherits": { +- "version": "2.0.4", +- "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", +- "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", +- "license": "ISC" +- }, +- "node_modules/ini": { +- "version": "2.0.0", +- "resolved": "https://registry.npmjs.org/ini/-/ini-2.0.0.tgz", +- "integrity": "sha512-7PnF4oN3CvZF23ADhA5wRaYEQpJ8qygSkbtTXWBeXWXmEVRXK+1ITciHWwHhsjv1TmW0MgacIv6hEi5pX5NQdA==", +- "dev": true, +- "license": "ISC", ++ "hasown": "^2.0.2" ++ }, + "engines": { +- "node": ">=10" ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" + } + }, +- "node_modules/ipaddr.js": { +- "version": "1.9.1", +- "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", +- "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", ++ "node_modules/is-data-view": { ++ "version": "1.0.2", ++ "resolved": "https://registry.npmjs.org/is-data-view/-/is-data-view-1.0.2.tgz", ++ "integrity": "sha512-RKtWF8pGmS87i2D6gqQu/l7EYRlVdfzemCJN/P3UOs//x1QE7mfhvzHIApBTRf7axvT6DMGwSwBXYCT0nfB9xw==", ++ "dev": true, + "license": "MIT", ++ "dependencies": { ++ "call-bound": "^1.0.2", ++ "get-intrinsic": "^1.2.6", ++ "is-typed-array": "^1.1.13" ++ }, + "engines": { +- "node": ">= 0.10" ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" + } + }, +- "node_modules/is-binary-path": { +- "version": "2.1.0", +- "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", +- "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", ++ "node_modules/is-date-object": { ++ "version": "1.1.0", ++ "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.1.0.tgz", ++ "integrity": "sha512-PwwhEakHVKTdRNVOw+/Gyh0+MzlCl4R6qKvkhuvLtPMggI1WAHt9sOwZxQLSGpUaDnrdyDsomoRgNnCfKNSXXg==", + "dev": true, + "license": "MIT", +- "peer": true, + "dependencies": { +- "binary-extensions": "^2.0.0" ++ "call-bound": "^1.0.2", ++ "has-tostringtag": "^1.0.2" + }, + "engines": { +- "node": ">=8" ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-extglob": { +@@ -2762,6 +4087,22 @@ + "node": ">=0.10.0" + } + }, ++ "node_modules/is-finalizationregistry": { ++ "version": "1.1.1", ++ "resolved": "https://registry.npmjs.org/is-finalizationregistry/-/is-finalizationregistry-1.1.1.tgz", ++ "integrity": "sha512-1pC6N8qWJbWoPtEjgcL2xyhQOP491EQjeUo3qTKcmV8YSDDJrOepfG8pcC7h/QgnQHYSv0mJ3Z/ZWxmatVrysg==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "call-bound": "^1.0.3" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", +@@ -2772,6 +4113,25 @@ + "node": ">=8" + } + }, ++ "node_modules/is-generator-function": { ++ "version": "1.1.0", ++ "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.1.0.tgz", ++ "integrity": "sha512-nPUB5km40q9e8UfN/Zc24eLlzdSf9OfKByBw9CIdw4H1giPMeA0OIJvbchsCu4npfI2QcMVBsGEBHKZ7wLTWmQ==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "call-bound": "^1.0.3", ++ "get-proto": "^1.0.0", ++ "has-tostringtag": "^1.0.2", ++ "safe-regex-test": "^1.1.0" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", +@@ -2802,17 +4162,59 @@ + "url": "https://github.com/sponsors/sindresorhus" + } + }, ++ "node_modules/is-map": { ++ "version": "2.0.3", ++ "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.3.tgz", ++ "integrity": "sha512-1Qed0/Hr2m+YqxnM09CjA2d/i6YZNfF6R2oRAOj36eUdS6qIV/huPJNSEpKbupewFs+ZsJlxsjjPbc0/afW6Lw==", ++ "dev": true, ++ "license": "MIT", ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, ++ "node_modules/is-negative-zero": { ++ "version": "2.0.3", ++ "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.3.tgz", ++ "integrity": "sha512-5KoIu2Ngpyek75jXodFvnafB6DJgr3u8uuK0LEZJjrU19DrMD3EVERaR8sjz8CCGgpZvxPl9SuE1GMVPFHx1mw==", ++ "dev": true, ++ "license": "MIT", ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "license": "MIT", +- "peer": true, + "engines": { + "node": ">=0.12.0" + } + }, ++ "node_modules/is-number-object": { ++ "version": "1.1.1", ++ "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.1.1.tgz", ++ "integrity": "sha512-lZhclumE1G6VYD8VHe35wFaIif+CTy5SJIi5+3y4psDgWu4wPDoBhF8NxUOinEc7pHgiTsT6MaBb92rKhhD+Xw==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "call-bound": "^1.0.3", ++ "has-tostringtag": "^1.0.2" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, + "node_modules/is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", +@@ -2840,6 +4242,54 @@ + "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==", + "license": "MIT" + }, ++ "node_modules/is-regex": { ++ "version": "1.2.1", ++ "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.2.1.tgz", ++ "integrity": "sha512-MjYsKHO5O7mCsmRGxWcLWheFqN9DJ/2TmngvjKXihe6efViPqc274+Fx/4fYj/r03+ESvBdTXK0V6tA3rgez1g==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "call-bound": "^1.0.2", ++ "gopd": "^1.2.0", ++ "has-tostringtag": "^1.0.2", ++ "hasown": "^2.0.2" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, ++ "node_modules/is-set": { ++ "version": "2.0.3", ++ "resolved": "https://registry.npmjs.org/is-set/-/is-set-2.0.3.tgz", ++ "integrity": "sha512-iPAjerrse27/ygGLxw+EBR9agv9Y6uLeYVJMu+QNCoouJ1/1ri0mGrcWpfCqFZuzzx3WjtwxG098X+n4OuRkPg==", ++ "dev": true, ++ "license": "MIT", ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, ++ "node_modules/is-shared-array-buffer": { ++ "version": "1.0.4", ++ "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.4.tgz", ++ "integrity": "sha512-ISWac8drv4ZGfwKl5slpHG9OwPNty4jOWPRIhBpxOoD+hqITiwuipOQ2bNthAzwA3B4fIjO4Nln74N0S9byq8A==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "call-bound": "^1.0.3" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, + "node_modules/is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", +@@ -2853,6 +4303,57 @@ + "url": "https://github.com/sponsors/sindresorhus" + } + }, ++ "node_modules/is-string": { ++ "version": "1.1.1", ++ "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.1.1.tgz", ++ "integrity": "sha512-BtEeSsoaQjlSPBemMQIrY1MY0uM6vnS1g5fmufYOtnxLGUZM2178PKbhsk7Ffv58IX+ZtcvoGwccYsh0PglkAA==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "call-bound": "^1.0.3", ++ "has-tostringtag": "^1.0.2" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, ++ "node_modules/is-symbol": { ++ "version": "1.1.1", ++ "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.1.1.tgz", ++ "integrity": "sha512-9gGx6GTtCQM73BgmHQXfDmLtfjjTUDSyoxTCbp5WtoixAhfgsDirWIcVQ/IHpvI5Vgd5i/J5F7B9cN/WlVbC/w==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "call-bound": "^1.0.2", ++ "has-symbols": "^1.1.0", ++ "safe-regex-test": "^1.1.0" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, ++ "node_modules/is-typed-array": { ++ "version": "1.1.15", ++ "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.15.tgz", ++ "integrity": "sha512-p3EcsicXjit7SaskXHs1hA91QxgTw46Fv6EFKKGS5DRFLD8yKnohjF3hxoju94b/OcMZoQukzpPpBE9uLVKzgQ==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "which-typed-array": "^1.1.16" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, + "node_modules/is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", +@@ -2873,6 +4374,59 @@ + "url": "https://github.com/sponsors/sindresorhus" + } + }, ++ "node_modules/is-weakmap": { ++ "version": "2.0.2", ++ "resolved": "https://registry.npmjs.org/is-weakmap/-/is-weakmap-2.0.2.tgz", ++ "integrity": "sha512-K5pXYOm9wqY1RgjpL3YTkF39tni1XajUIkawTLUo9EZEVUFga5gSQJF8nNS7ZwJQ02y+1YCNYcMh+HIf1ZqE+w==", ++ "dev": true, ++ "license": "MIT", ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, ++ "node_modules/is-weakref": { ++ "version": "1.1.1", ++ "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.1.1.tgz", ++ "integrity": "sha512-6i9mGWSlqzNMEqpCp93KwRS1uUOodk2OJ6b+sq7ZPDSy2WuI5NFIxp/254TytR8ftefexkWn5xNiHUNpPOfSew==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "call-bound": "^1.0.3" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, ++ "node_modules/is-weakset": { ++ "version": "2.0.4", ++ "resolved": "https://registry.npmjs.org/is-weakset/-/is-weakset-2.0.4.tgz", ++ "integrity": "sha512-mfcwb6IzQyOKTs84CQMrOwW4gQcaTOAWJ0zzJCl2WSPDrWk/OzDaImWFH3djXhb24g4eudZfLRozAvPGw4d9hQ==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "call-bound": "^1.0.3", ++ "get-intrinsic": "^1.2.6" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, ++ "node_modules/isarray": { ++ "version": "2.0.5", ++ "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", ++ "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", ++ "dev": true, ++ "license": "MIT" ++ }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", +@@ -2963,7 +4517,20 @@ + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==", + "dev": true, +- "license": "ISC" ++ "license": "ISC" ++ }, ++ "node_modules/json5": { ++ "version": "1.0.2", ++ "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz", ++ "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "minimist": "^1.2.0" ++ }, ++ "bin": { ++ "json5": "lib/cli.js" ++ } + }, + "node_modules/jsonfile": { + "version": "6.1.0", +@@ -3220,6 +4787,13 @@ + "node": "20 || >=22" + } + }, ++ "node_modules/make-error": { ++ "version": "1.3.6", ++ "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", ++ "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", ++ "dev": true, ++ "license": "ISC" ++ }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", +@@ -3257,6 +4831,30 @@ + "dev": true, + "license": "MIT" + }, ++ "node_modules/merge2": { ++ "version": "1.4.1", ++ "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", ++ "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", ++ "dev": true, ++ "license": "MIT", ++ "engines": { ++ "node": ">= 8" ++ } ++ }, ++ "node_modules/micromatch": { ++ "version": "4.0.8", ++ "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", ++ "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "braces": "^3.0.3", ++ "picomatch": "^2.3.1" ++ }, ++ "engines": { ++ "node": ">=8.6" ++ } ++ }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", +@@ -3674,6 +5272,90 @@ + "url": "https://github.com/sponsors/ljharb" + } + }, ++ "node_modules/object-keys": { ++ "version": "1.1.1", ++ "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", ++ "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", ++ "dev": true, ++ "license": "MIT", ++ "engines": { ++ "node": ">= 0.4" ++ } ++ }, ++ "node_modules/object.assign": { ++ "version": "4.1.7", ++ "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.7.tgz", ++ "integrity": "sha512-nK28WOo+QIjBkDduTINE4JkF/UJJKyf2EJxvJKfblDpyg0Q+pkOHNTL0Qwy6NP6FhE/EnzV73BxxqcJaXY9anw==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "call-bind": "^1.0.8", ++ "call-bound": "^1.0.3", ++ "define-properties": "^1.2.1", ++ "es-object-atoms": "^1.0.0", ++ "has-symbols": "^1.1.0", ++ "object-keys": "^1.1.1" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, ++ "node_modules/object.fromentries": { ++ "version": "2.0.8", ++ "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.8.tgz", ++ "integrity": "sha512-k6E21FzySsSK5a21KRADBd/NGneRegFO5pLHfdQLpRDETUNJueLXs3WCzyQ3tFRDYgbq3KHGXfTbi2bs8WQ6rQ==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "call-bind": "^1.0.7", ++ "define-properties": "^1.2.1", ++ "es-abstract": "^1.23.2", ++ "es-object-atoms": "^1.0.0" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, ++ "node_modules/object.groupby": { ++ "version": "1.0.3", ++ "resolved": "https://registry.npmjs.org/object.groupby/-/object.groupby-1.0.3.tgz", ++ "integrity": "sha512-+Lhy3TQTuzXI5hevh8sBGqbmurHbbIjAi0Z4S63nthVLmLxfbj4T54a4CfZrXIrt9iP4mVAPYMo/v99taj3wjQ==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "call-bind": "^1.0.7", ++ "define-properties": "^1.2.1", ++ "es-abstract": "^1.23.2" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ } ++ }, ++ "node_modules/object.values": { ++ "version": "1.2.1", ++ "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.2.1.tgz", ++ "integrity": "sha512-gXah6aZrcUxjWg2zR2MwouP2eHlCBzdV4pygudehaKXSGW4v2AsRQUK+lwwXhii6KFZcunEnmSUoYp5CXibxtA==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "call-bind": "^1.0.8", ++ "call-bound": "^1.0.3", ++ "define-properties": "^1.2.1", ++ "es-object-atoms": "^1.0.0" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", +@@ -3746,6 +5428,24 @@ + "dev": true, + "license": "MIT" + }, ++ "node_modules/own-keys": { ++ "version": "1.0.1", ++ "resolved": "https://registry.npmjs.org/own-keys/-/own-keys-1.0.1.tgz", ++ "integrity": "sha512-qFOyK5PjiWZd+QQIh+1jhdb9LpxTF0qs7Pm8o5QHYZ0M3vKqSqzsZaEB6oWlxZ+q2sJBMI/Ktgd2N5ZwQoRHfg==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "get-intrinsic": "^1.2.6", ++ "object-keys": "^1.1.1", ++ "safe-push-apply": "^1.0.0" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", +@@ -3843,6 +5543,13 @@ + "node": ">=8" + } + }, ++ "node_modules/path-parse": { ++ "version": "1.0.7", ++ "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", ++ "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", ++ "dev": true, ++ "license": "MIT" ++ }, + "node_modules/path-scurry": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.0.tgz", +@@ -3889,7 +5596,6 @@ + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "license": "MIT", +- "peer": true, + "engines": { + "node": ">=8.6" + }, +@@ -3907,6 +5613,16 @@ + "node": ">=0.10.0" + } + }, ++ "node_modules/possible-typed-array-names": { ++ "version": "1.1.0", ++ "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.1.0.tgz", ++ "integrity": "sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg==", ++ "dev": true, ++ "license": "MIT", ++ "engines": { ++ "node": ">= 0.4" ++ } ++ }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", +@@ -4037,6 +5753,27 @@ + "url": "https://github.com/sponsors/ljharb" + } + }, ++ "node_modules/queue-microtask": { ++ "version": "1.2.3", ++ "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", ++ "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", ++ "dev": true, ++ "funding": [ ++ { ++ "type": "github", ++ "url": "https://github.com/sponsors/feross" ++ }, ++ { ++ "type": "patreon", ++ "url": "https://www.patreon.com/feross" ++ }, ++ { ++ "type": "consulting", ++ "url": "https://feross.org/support" ++ } ++ ], ++ "license": "MIT" ++ }, + "node_modules/randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", +@@ -4093,6 +5830,50 @@ + "node": ">=8.10.0" + } + }, ++ "node_modules/reflect.getprototypeof": { ++ "version": "1.0.10", ++ "resolved": "https://registry.npmjs.org/reflect.getprototypeof/-/reflect.getprototypeof-1.0.10.tgz", ++ "integrity": "sha512-00o4I+DVrefhv+nX0ulyi3biSHCPDe+yLv5o/p6d/UVlirijB8E16FtfwSAi4g3tcqrQ4lRAqQSoFEZJehYEcw==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "call-bind": "^1.0.8", ++ "define-properties": "^1.2.1", ++ "es-abstract": "^1.23.9", ++ "es-errors": "^1.3.0", ++ "es-object-atoms": "^1.0.0", ++ "get-intrinsic": "^1.2.7", ++ "get-proto": "^1.0.1", ++ "which-builtin-type": "^1.2.1" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, ++ "node_modules/regexp.prototype.flags": { ++ "version": "1.5.4", ++ "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.4.tgz", ++ "integrity": "sha512-dYqgNSZbDwkaJ2ceRd9ojCGjBq+mOm9LmtXnAnEGyHhN/5R7iDW2TRw3h+o/jCFxus3P2LfWIIiwowAjANm7IA==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "call-bind": "^1.0.8", ++ "define-properties": "^1.2.1", ++ "es-errors": "^1.3.0", ++ "get-proto": "^1.0.1", ++ "gopd": "^1.2.0", ++ "set-function-name": "^2.0.2" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, + "node_modules/request-progress": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/request-progress/-/request-progress-3.0.0.tgz", +@@ -4113,6 +5894,27 @@ + "node": ">=0.10.0" + } + }, ++ "node_modules/resolve": { ++ "version": "1.22.10", ++ "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.10.tgz", ++ "integrity": "sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "is-core-module": "^2.16.0", ++ "path-parse": "^1.0.7", ++ "supports-preserve-symlinks-flag": "^1.0.0" ++ }, ++ "bin": { ++ "resolve": "bin/resolve" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, + "node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", +@@ -4137,6 +5939,17 @@ + "node": ">=8" + } + }, ++ "node_modules/reusify": { ++ "version": "1.1.0", ++ "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz", ++ "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==", ++ "dev": true, ++ "license": "MIT", ++ "engines": { ++ "iojs": ">=1.0.0", ++ "node": ">=0.10.0" ++ } ++ }, + "node_modules/rfdc": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.4.1.tgz", +@@ -4160,6 +5973,30 @@ + "node": ">= 18" + } + }, ++ "node_modules/run-parallel": { ++ "version": "1.2.0", ++ "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", ++ "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", ++ "dev": true, ++ "funding": [ ++ { ++ "type": "github", ++ "url": "https://github.com/sponsors/feross" ++ }, ++ { ++ "type": "patreon", ++ "url": "https://www.patreon.com/feross" ++ }, ++ { ++ "type": "consulting", ++ "url": "https://feross.org/support" ++ } ++ ], ++ "license": "MIT", ++ "dependencies": { ++ "queue-microtask": "^1.2.2" ++ } ++ }, + "node_modules/rxjs": { + "version": "7.8.1", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz", +@@ -4170,6 +6007,26 @@ + "tslib": "^2.1.0" + } + }, ++ "node_modules/safe-array-concat": { ++ "version": "1.1.3", ++ "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.1.3.tgz", ++ "integrity": "sha512-AURm5f0jYEOydBj7VQlVvDrjeFgthDdEF5H1dP+6mNpoXOMo1quQqJ4wvJDyRZ9+pO3kGWoOdmV08cSv2aJV6Q==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "call-bind": "^1.0.8", ++ "call-bound": "^1.0.2", ++ "get-intrinsic": "^1.2.6", ++ "has-symbols": "^1.1.0", ++ "isarray": "^2.0.5" ++ }, ++ "engines": { ++ "node": ">=0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", +@@ -4190,6 +6047,41 @@ + ], + "license": "MIT" + }, ++ "node_modules/safe-push-apply": { ++ "version": "1.0.0", ++ "resolved": "https://registry.npmjs.org/safe-push-apply/-/safe-push-apply-1.0.0.tgz", ++ "integrity": "sha512-iKE9w/Z7xCzUMIZqdBsp6pEQvwuEebH4vdpjcDWnyzaI6yl6O9FHvVpmGelvEHNsoY6wGblkxR6Zty/h00WiSA==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "es-errors": "^1.3.0", ++ "isarray": "^2.0.5" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, ++ "node_modules/safe-regex-test": { ++ "version": "1.1.0", ++ "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.1.0.tgz", ++ "integrity": "sha512-x/+Cz4YrimQxQccJf5mKEbIa1NzeCRNI5Ecl/ekmlYaampdNLPalVyIcCZNNH3MvmqBugV5TMYZXv0ljslUlaw==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "call-bound": "^1.0.2", ++ "es-errors": "^1.3.0", ++ "is-regex": "^1.2.1" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", +@@ -4269,13 +6161,62 @@ + "integrity": "sha512-61g9pCh0Vnh7IutZjtLGGpTA355+OPn2TyDv/6ivP2h/AdAVX9azsoxmg2/M6nZeQZNYBEwIcsne1mJd9oQItQ==", + "license": "MIT", + "dependencies": { +- "encodeurl": "^2.0.0", +- "escape-html": "^1.0.3", +- "parseurl": "^1.3.3", +- "send": "^1.2.0" ++ "encodeurl": "^2.0.0", ++ "escape-html": "^1.0.3", ++ "parseurl": "^1.3.3", ++ "send": "^1.2.0" ++ }, ++ "engines": { ++ "node": ">= 18" ++ } ++ }, ++ "node_modules/set-function-length": { ++ "version": "1.2.2", ++ "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", ++ "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "define-data-property": "^1.1.4", ++ "es-errors": "^1.3.0", ++ "function-bind": "^1.1.2", ++ "get-intrinsic": "^1.2.4", ++ "gopd": "^1.0.1", ++ "has-property-descriptors": "^1.0.2" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ } ++ }, ++ "node_modules/set-function-name": { ++ "version": "2.0.2", ++ "resolved": "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.2.tgz", ++ "integrity": "sha512-7PGFlmtwsEADb0WYyvCMa1t+yke6daIG4Wirafur5kcf+MhUnPms1UeR0CKQdTZD81yESwMHbtn+TR+dMviakQ==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "define-data-property": "^1.1.4", ++ "es-errors": "^1.3.0", ++ "functions-have-names": "^1.2.3", ++ "has-property-descriptors": "^1.0.2" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ } ++ }, ++ "node_modules/set-proto": { ++ "version": "1.0.0", ++ "resolved": "https://registry.npmjs.org/set-proto/-/set-proto-1.0.0.tgz", ++ "integrity": "sha512-RJRdvCo6IAnPdsvP/7m6bsQqNnn1FCBX5ZNtFL98MmFF/4xAIJTIg1YbHW5DC2W5SKZanrC6i4HsJqlajw/dZw==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "dunder-proto": "^1.0.1", ++ "es-errors": "^1.3.0", ++ "es-object-atoms": "^1.0.0" + }, + "engines": { +- "node": ">= 18" ++ "node": ">= 0.4" + } + }, + "node_modules/setprototypeof": { +@@ -4436,6 +6377,20 @@ + "node": ">= 0.8" + } + }, ++ "node_modules/stop-iteration-iterator": { ++ "version": "1.1.0", ++ "resolved": "https://registry.npmjs.org/stop-iteration-iterator/-/stop-iteration-iterator-1.1.0.tgz", ++ "integrity": "sha512-eLoXW/DHyl62zxY4SCaIgnRhuMr6ri4juEYARS8E6sCEqzKpOiE521Ucofdx+KnDZl5xmvGYaaKCk5FEOxJCoQ==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "es-errors": "^1.3.0", ++ "internal-slot": "^1.1.0" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ } ++ }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", +@@ -4467,6 +6422,65 @@ + "node": ">=8" + } + }, ++ "node_modules/string.prototype.trim": { ++ "version": "1.2.10", ++ "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.10.tgz", ++ "integrity": "sha512-Rs66F0P/1kedk5lyYyH9uBzuiI/kNRmwJAR9quK6VOtIpZ2G+hMZd+HQbbv25MgCA6gEffoMZYxlTod4WcdrKA==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "call-bind": "^1.0.8", ++ "call-bound": "^1.0.2", ++ "define-data-property": "^1.1.4", ++ "define-properties": "^1.2.1", ++ "es-abstract": "^1.23.5", ++ "es-object-atoms": "^1.0.0", ++ "has-property-descriptors": "^1.0.2" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, ++ "node_modules/string.prototype.trimend": { ++ "version": "1.0.9", ++ "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.9.tgz", ++ "integrity": "sha512-G7Ok5C6E/j4SGfyLCloXTrngQIQU3PWtXGst3yM7Bea9FRURf1S42ZHlZZtsNque2FN2PoUhfZXYLNWwEr4dLQ==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "call-bind": "^1.0.8", ++ "call-bound": "^1.0.2", ++ "define-properties": "^1.2.1", ++ "es-object-atoms": "^1.0.0" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, ++ "node_modules/string.prototype.trimstart": { ++ "version": "1.0.8", ++ "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.8.tgz", ++ "integrity": "sha512-UXSH262CSZY1tfu3G3Secr6uGLCFVPMhIqHjlgCUtCCcgihYc/xKs9djMTMUOb2j1mVSeU8EU6NWc/iQKU6Gfg==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "call-bind": "^1.0.7", ++ "define-properties": "^1.2.1", ++ "es-object-atoms": "^1.0.0" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", +@@ -4494,6 +6508,16 @@ + "node": ">=8" + } + }, ++ "node_modules/strip-bom": { ++ "version": "3.0.0", ++ "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", ++ "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", ++ "dev": true, ++ "license": "MIT", ++ "engines": { ++ "node": ">=4" ++ } ++ }, + "node_modules/strip-final-newline": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", +@@ -4533,6 +6557,19 @@ + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, ++ "node_modules/supports-preserve-symlinks-flag": { ++ "version": "1.0.0", ++ "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", ++ "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", ++ "dev": true, ++ "license": "MIT", ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, + "node_modules/synckit": { + "version": "0.11.8", + "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.11.8.tgz", +@@ -4619,7 +6656,6 @@ + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "license": "MIT", +- "peer": true, + "dependencies": { + "is-number": "^7.0.0" + }, +@@ -4659,6 +6695,86 @@ + "tree-kill": "cli.js" + } + }, ++ "node_modules/ts-api-utils": { ++ "version": "2.1.0", ++ "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.1.0.tgz", ++ "integrity": "sha512-CUgTZL1irw8u29bzrOD/nH85jqyc74D6SshFgujOIA7osm2Rz7dYH77agkx7H4FBNxDq7Cjf+IjaX/8zwFW+ZQ==", ++ "dev": true, ++ "license": "MIT", ++ "engines": { ++ "node": ">=18.12" ++ }, ++ "peerDependencies": { ++ "typescript": ">=4.8.4" ++ } ++ }, ++ "node_modules/ts-node": { ++ "version": "10.9.2", ++ "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", ++ "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "@cspotcode/source-map-support": "^0.8.0", ++ "@tsconfig/node10": "^1.0.7", ++ "@tsconfig/node12": "^1.0.7", ++ "@tsconfig/node14": "^1.0.0", ++ "@tsconfig/node16": "^1.0.2", ++ "acorn": "^8.4.1", ++ "acorn-walk": "^8.1.1", ++ "arg": "^4.1.0", ++ "create-require": "^1.1.0", ++ "diff": "^4.0.1", ++ "make-error": "^1.1.1", ++ "v8-compile-cache-lib": "^3.0.1", ++ "yn": "3.1.1" ++ }, ++ "bin": { ++ "ts-node": "dist/bin.js", ++ "ts-node-cwd": "dist/bin-cwd.js", ++ "ts-node-esm": "dist/bin-esm.js", ++ "ts-node-script": "dist/bin-script.js", ++ "ts-node-transpile-only": "dist/bin-transpile.js", ++ "ts-script": "dist/bin-script-deprecated.js" ++ }, ++ "peerDependencies": { ++ "@swc/core": ">=1.2.50", ++ "@swc/wasm": ">=1.2.50", ++ "@types/node": "*", ++ "typescript": ">=2.7" ++ }, ++ "peerDependenciesMeta": { ++ "@swc/core": { ++ "optional": true ++ }, ++ "@swc/wasm": { ++ "optional": true ++ } ++ } ++ }, ++ "node_modules/ts-node/node_modules/diff": { ++ "version": "4.0.2", ++ "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", ++ "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", ++ "dev": true, ++ "license": "BSD-3-Clause", ++ "engines": { ++ "node": ">=0.3.1" ++ } ++ }, ++ "node_modules/tsconfig-paths": { ++ "version": "3.15.0", ++ "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz", ++ "integrity": "sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "@types/json5": "^0.0.29", ++ "json5": "^1.0.2", ++ "minimist": "^1.2.6", ++ "strip-bom": "^3.0.0" ++ } ++ }, + "node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", +@@ -4747,13 +6863,147 @@ + "node": ">= 0.6" + } + }, +- "node_modules/undici-types": { +- "version": "6.20.0", +- "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz", +- "integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==", ++ "node_modules/typed-array-buffer": { ++ "version": "1.0.3", ++ "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.3.tgz", ++ "integrity": "sha512-nAYYwfY3qnzX30IkA6AQZjVbtK6duGontcQm1WSG1MD94YLqK0515GNApXkoxKOWMusVssAHWLh9SeaoefYFGw==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "call-bound": "^1.0.3", ++ "es-errors": "^1.3.0", ++ "is-typed-array": "^1.1.14" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ } ++ }, ++ "node_modules/typed-array-byte-length": { ++ "version": "1.0.3", ++ "resolved": "https://registry.npmjs.org/typed-array-byte-length/-/typed-array-byte-length-1.0.3.tgz", ++ "integrity": "sha512-BaXgOuIxz8n8pIq3e7Atg/7s+DpiYrxn4vdot3w9KbnBhcRQq6o3xemQdIfynqSeXeDrF32x+WvfzmOjPiY9lg==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "call-bind": "^1.0.8", ++ "for-each": "^0.3.3", ++ "gopd": "^1.2.0", ++ "has-proto": "^1.2.0", ++ "is-typed-array": "^1.1.14" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, ++ "node_modules/typed-array-byte-offset": { ++ "version": "1.0.4", ++ "resolved": "https://registry.npmjs.org/typed-array-byte-offset/-/typed-array-byte-offset-1.0.4.tgz", ++ "integrity": "sha512-bTlAFB/FBYMcuX81gbL4OcpH5PmlFHqlCCpAl8AlEzMz5k53oNDvN8p1PNOWLEmI2x4orp3raOFB51tv9X+MFQ==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "available-typed-arrays": "^1.0.7", ++ "call-bind": "^1.0.8", ++ "for-each": "^0.3.3", ++ "gopd": "^1.2.0", ++ "has-proto": "^1.2.0", ++ "is-typed-array": "^1.1.15", ++ "reflect.getprototypeof": "^1.0.9" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, ++ "node_modules/typed-array-length": { ++ "version": "1.0.7", ++ "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.7.tgz", ++ "integrity": "sha512-3KS2b+kL7fsuk/eJZ7EQdnEmQoaho/r6KUef7hxvltNA5DR8NAUM+8wJMbJyZ4G9/7i3v5zPBIMN5aybAh2/Jg==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "call-bind": "^1.0.7", ++ "for-each": "^0.3.3", ++ "gopd": "^1.0.1", ++ "is-typed-array": "^1.1.13", ++ "possible-typed-array-names": "^1.0.0", ++ "reflect.getprototypeof": "^1.0.6" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, ++ "node_modules/typescript": { ++ "version": "5.9.2", ++ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.2.tgz", ++ "integrity": "sha512-CWBzXQrc/qOkhidw1OzBTQuYRbfyxDXJMVJ1XNwUHGROVmuaeiEm3OslpZ1RV96d7SKKjZKrSJu3+t/xlw3R9A==", ++ "dev": true, ++ "license": "Apache-2.0", ++ "bin": { ++ "tsc": "bin/tsc", ++ "tsserver": "bin/tsserver" ++ }, ++ "engines": { ++ "node": ">=14.17" ++ } ++ }, ++ "node_modules/typescript-eslint": { ++ "version": "8.39.1", ++ "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.39.1.tgz", ++ "integrity": "sha512-GDUv6/NDYngUlNvwaHM1RamYftxf782IyEDbdj3SeaIHHv8fNQVRC++fITT7kUJV/5rIA/tkoRSSskt6osEfqg==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "@typescript-eslint/eslint-plugin": "8.39.1", ++ "@typescript-eslint/parser": "8.39.1", ++ "@typescript-eslint/typescript-estree": "8.39.1", ++ "@typescript-eslint/utils": "8.39.1" ++ }, ++ "engines": { ++ "node": "^18.18.0 || ^20.9.0 || >=21.1.0" ++ }, ++ "funding": { ++ "type": "opencollective", ++ "url": "https://opencollective.com/typescript-eslint" ++ }, ++ "peerDependencies": { ++ "eslint": "^8.57.0 || ^9.0.0", ++ "typescript": ">=4.8.4 <6.0.0" ++ } ++ }, ++ "node_modules/unbox-primitive": { ++ "version": "1.1.0", ++ "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.1.0.tgz", ++ "integrity": "sha512-nWJ91DjeOkej/TA8pXQ3myruKpKEYgqvpw9lz4OPHj/NWFNluYrjbz9j01CJ8yKQd2g4jFoOkINCTW2I5LEEyw==", + "dev": true, + "license": "MIT", +- "optional": true ++ "dependencies": { ++ "call-bound": "^1.0.3", ++ "has-bigints": "^1.0.2", ++ "has-symbols": "^1.1.0", ++ "which-boxed-primitive": "^1.1.1" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, ++ "node_modules/undici-types": { ++ "version": "7.10.0", ++ "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.10.0.tgz", ++ "integrity": "sha512-t5Fy/nfn+14LuOc2KNYg75vZqClpAiqscVvMygNnlsHBFpSXdJaYtXMcdNLpl/Qvc3P2cB3s6lOV51nqsFq4ag==", ++ "dev": true, ++ "license": "MIT" + }, + "node_modules/universalify": { + "version": "2.0.1", +@@ -4804,6 +7054,13 @@ + "uuid": "dist/bin/uuid" + } + }, ++ "node_modules/v8-compile-cache-lib": { ++ "version": "3.0.1", ++ "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", ++ "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", ++ "dev": true, ++ "license": "MIT" ++ }, + "node_modules/validator": { + "version": "13.12.0", + "resolved": "https://registry.npmjs.org/validator/-/validator-13.12.0.tgz", +@@ -4854,6 +7111,95 @@ + "node": ">= 8" + } + }, ++ "node_modules/which-boxed-primitive": { ++ "version": "1.1.1", ++ "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.1.1.tgz", ++ "integrity": "sha512-TbX3mj8n0odCBFVlY8AxkqcHASw3L60jIuF8jFP78az3C2YhmGvqbHBpAjTRH2/xqYunrJ9g1jSyjCjpoWzIAA==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "is-bigint": "^1.1.0", ++ "is-boolean-object": "^1.2.1", ++ "is-number-object": "^1.1.1", ++ "is-string": "^1.1.1", ++ "is-symbol": "^1.1.1" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, ++ "node_modules/which-builtin-type": { ++ "version": "1.2.1", ++ "resolved": "https://registry.npmjs.org/which-builtin-type/-/which-builtin-type-1.2.1.tgz", ++ "integrity": "sha512-6iBczoX+kDQ7a3+YJBnh3T+KZRxM/iYNPXicqk66/Qfm1b93iu+yOImkg0zHbj5LNOcNv1TEADiZ0xa34B4q6Q==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "call-bound": "^1.0.2", ++ "function.prototype.name": "^1.1.6", ++ "has-tostringtag": "^1.0.2", ++ "is-async-function": "^2.0.0", ++ "is-date-object": "^1.1.0", ++ "is-finalizationregistry": "^1.1.0", ++ "is-generator-function": "^1.0.10", ++ "is-regex": "^1.2.1", ++ "is-weakref": "^1.0.2", ++ "isarray": "^2.0.5", ++ "which-boxed-primitive": "^1.1.0", ++ "which-collection": "^1.0.2", ++ "which-typed-array": "^1.1.16" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, ++ "node_modules/which-collection": { ++ "version": "1.0.2", ++ "resolved": "https://registry.npmjs.org/which-collection/-/which-collection-1.0.2.tgz", ++ "integrity": "sha512-K4jVyjnBdgvc86Y6BkaLZEN933SwYOuBFkdmBu9ZfkcAbdVbpITnDmjvZ/aQjRXQrv5EPkTnD1s39GiiqbngCw==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "is-map": "^2.0.3", ++ "is-set": "^2.0.3", ++ "is-weakmap": "^2.0.2", ++ "is-weakset": "^2.0.3" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, ++ "node_modules/which-typed-array": { ++ "version": "1.1.19", ++ "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.19.tgz", ++ "integrity": "sha512-rEvr90Bck4WZt9HHFC4DJMsjvu7x+r6bImz0/BrbWb7A2djJ8hnZMrWnHo9F8ssv0OMErasDhftrfROTyqSDrw==", ++ "dev": true, ++ "license": "MIT", ++ "dependencies": { ++ "available-typed-arrays": "^1.0.7", ++ "call-bind": "^1.0.8", ++ "call-bound": "^1.0.4", ++ "for-each": "^0.3.5", ++ "get-proto": "^1.0.1", ++ "gopd": "^1.2.0", ++ "has-tostringtag": "^1.0.2" ++ }, ++ "engines": { ++ "node": ">= 0.4" ++ }, ++ "funding": { ++ "url": "https://github.com/sponsors/ljharb" ++ } ++ }, + "node_modules/word-wrap": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", +@@ -4984,6 +7330,16 @@ + "fd-slicer": "~1.1.0" + } + }, ++ "node_modules/yn": { ++ "version": "3.1.1", ++ "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", ++ "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", ++ "dev": true, ++ "license": "MIT", ++ "engines": { ++ "node": ">=6" ++ } ++ }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", +diff --git a/cypress-tests/package.json b/cypress-tests/package.json +index 30d70716..a03f11e0 100644 +--- a/cypress-tests/package.json ++++ b/cypress-tests/package.json +@@ -16,6 +16,8 @@ + "report:generate": "node scripts/report-generator.js", + "report:open": "open dashboard/index.html || start dashboard/index.html || xdg-open dashboard/index.html", + "dashboard:serve": "node scripts/serve-dashboard.js", ++ "mockserver": "npx tsx cypress/e2e/configs/mock-server/mockserver.ts", ++ "build:ts": "tsc", + "dashboard": "npm run dashboard:serve", + "cypress:ci:report": "npm run cypress:ci && npm run report:generate", + "build": "node scripts/build.js", +@@ -26,19 +28,26 @@ + "author": "Hyperswitch", + "license": "ISC", + "dependencies": { +- "express": "^5.1.0", +- "cors": "^2.8.5" ++ "cors": "^2.8.5", ++ "express": "^5.1.0" + }, + "devDependencies": { +- "@eslint/js": "^9.32.0", +- "cypress": "^14.5.3", ++ "@eslint/js": "^9.33.0", ++ "@types/cors": "^2.8.19", ++ "@types/express": "^5.0.3", ++ "@types/node": "^24.2.1", ++ "cypress": "^14.5.4", + "cypress-mochawesome-reporter": "^4.0.0", + "eslint": "^9.32.0", + "eslint-config-prettier": "^10.1.8", + "eslint-plugin-cypress": "^5.1.0", +- "eslint-plugin-prettier": "^5.5.3", ++ "eslint-plugin-import": "^2.32.0", ++ "eslint-plugin-prettier": "^5.5.4", + "globals": "^16.3.0", + "jsqr": "^1.4.0", +- "prettier": "^3.6.2" ++ "prettier": "^3.6.2", ++ "ts-node": "^10.9.2", ++ "typescript": "^5.9.2", ++ "typescript-eslint": "^8.39.1" + } + } +diff --git a/cypress-tests/tsconfig.json b/cypress-tests/tsconfig.json +new file mode 100644 +index 00000000..2bc8a5d9 +--- /dev/null ++++ b/cypress-tests/tsconfig.json +@@ -0,0 +1,18 @@ ++{ ++ "compilerOptions": { ++ "target": "ES2020", ++ "module": "NodeNext", ++ "moduleResolution": "NodeNext", ++ "esModuleInterop": true, ++ "strict": true, ++ "skipLibCheck": true, ++ "forceConsistentCasingInFileNames": true, ++ "outDir": "dist", ++ "rootDir": ".", ++ "resolveJsonModule": true, ++ "allowImportingTsExtensions": true, ++ "noEmit": true ++ }, ++ "include": ["cypress/**/*.ts"], ++ "exclude": ["node_modules"] ++} + +----- END CHUNK ----- \ No newline at end of file diff --git a/raw/e3/e3c46b7de71d619b84beb2dba36b6f62a570d45f.txt b/raw/e3/e3c46b7de71d619b84beb2dba36b6f62a570d45f.txt new file mode 100644 index 0000000000000000000000000000000000000000..95faf66e77bbcd8a32ff1c7c6f058cdd206ecd2c --- /dev/null +++ b/raw/e3/e3c46b7de71d619b84beb2dba36b6f62a570d45f.txt @@ -0,0 +1,1137 @@ +ROUTE: juspay/hyperswitch@e3c46b7de71d619b84beb2dba36b6f62a570d45f +REPO: https://github.com/juspay/hyperswitch +COMMIT: e3c46b7de71d619b84beb2dba36b6f62a570d45f +AUTHOR: Kanika Bansal +DATE: 2025-08-22T13:08:23 + +=== ISSUE_AND_PR === +[PR #8896] refactor(user_roles): implement parent group info based role APIs +URL: https://github.com/juspay/hyperswitch/pull/8896 +BODY: +## Type of Change + + +- [ ] Bugfix +- [ ] New feature +- [x] Enhancement +- [x] Refactoring +- [ ] Dependency updates +- [ ] Documentation +- [ ] CI/CD + +## Description + +#### **POST** `/user/role/v2` +- Creates a role using `parent_groups` (with `name` + `scopes`) instead of granular `groups`. +- Internally maps `parent_groups` + `scopes` to existing granular permissions for DB storage. + +#### **GET** `/user/role/list/?entity_type={entity_type}&groups=true` +- Replicates existing `/user/role/list` functionality but replaces the `groups` field with a `parent_groups` array containing: + - `name` + - `description` + - `scopes` + +#### **GET** `/user/parent/list/?entity_type={entity_type}` +- Added entity_type filter for current parent/list which used to take user role entity_type. + + +### Additional Changes + +- [x] This PR modifies the API contract +- [ ] This PR modifies the database schema +- [ ] This PR modifies application configuration/environment variables + + + + +## Motivation and Context + +We are standardizing all role-related APIs (/role/list, /role/v2) to use parent group + scopes rather than granular permissions like we use in the Invite api. + +Improves readability for FE consumers and ensures consistency across role creation and retrieval. + + +## How did you test it? + +1. Create Custom Role +Request: +``` +curl --location 'http://localhost:8080/user/role/v2' \ +--header 'Cookie: ******* +--header 'Content-Type: application/json' \ +--data '{ + "role_scope": "merchant", + "parent_groups": [ + { + "name": "Operations", + "scopes": [ + "read", + "write" + ] + }, + { + "name": "Connectors", + "scopes": [ + "write" + ] + }, + { + "name": "Analytics", + "scopes": [ + "read" + + ] + }, + { + "name": "Internal", + "scopes": [ + "read", + "write" + + ] + } + + ], + "role_name": "roles_123" +}' +``` +2. Get Role Info List +``` +curl --location 'http://localhost:8080/user/role/list/?entity_type=organization&groups=true' \ +--header 'Cookie: ******* +``` +Response: +``` +[ + { + "role_id": "org_admin", + "role_name": "organization_admin", + "entity_type": "organization", + "parent_groups": [ + { + "name": "ReconReports", + "description": "Generate & Verify Reconciliation Token, Reconciliation Analytics, Reconciliation Reports, Organization Account", + "scopes": [ + "read", + "write" + ] + }, + { + "name": "Account", + "description": "Organization Account, Api Keys, Webhook Events", + "scopes": [ + "read", + "write" + ] + }, + { + "name": "Theme", + "description": "Themes", + "scopes": [ + "write", + "read" + ] + }, + { + "name": "Workflows", + "description": "Routing, 3DS Decision Manager, Surcharge Decision Manager, Organization Account, Revenue Recovery", + "scopes": [ + "read", + "write" + ] + }, + { + "name": "Users", + "description": "Users, Organization Account", + "scopes": [ + "write", + "read" + ] + }, + { + "name": "Analytics", + "description": "Analytics, Operation Reports, Organization Account", + "scopes": [ + "read" + ] + }, + { + "name": "ReconOps", + "description": "Generate & Verify Reconciliation Token, Reconciliation Process Manager, Reconciliation File Upload, Run Reconciliation Process, Reconciliation Configurations, Reconciliation Analytics, Reconciliation Reports, Organization Account", + "scopes": [ + "write", + "read" + ] + }, + { + "name": "Operations", + "description": "Payments, Refunds, Mandates, Disputes, Customers, Payouts, Operation Reports, Organization Account", + "scopes": [ + "read", + "write" + ] + }, + { + "name": "Connectors", + "description": "Payment Processors, Payout Processors, Fraud & Risk Managers, Organization Account", + "scopes": [ + "read", + "write" + ] + } + ], + "role_scope": "organization" + } +] +``` + +3. Parent List +``` +curl --location 'http://localhost:8080/user/parent/list/?entity_type=profile' \ +--header 'Cookie: ******* +``` + +``` +[ + { + "name": "Connectors", + "description": "Payment Processors, Payout Processors, Fraud & Risk Managers, Business Profile Account", + "scopes": [ + "read", + "write" + ] + }, + { + "name": "ReconReports", + "description": "Business Profile Account", + "scopes": [ + "read", + "write" + ] + }, + { + "name": "Analytics", + "description": "Analytics, Operation Reports, Business Profile Account", + "scopes": [ + "read" + ] + }, + { + "name": "Workflows", + "description": "Routing, 3DS Decision Manager, Business Profile Account, Revenue Recovery", + "scopes": [ + "write", + "read" + ] + }, + { + "name": "Operations", + "description": "Payments, Refunds, Disputes, Payouts, Operation Reports, Business Profile Account", + "scopes": [ + "read", + "write" + ] + }, + { + "name": "ReconOps", + "description": "Business Profile Account", + "scopes": [ + "read", + "write" + ] + }, + { + "name": "Account", + "description": "Business Profile Account, Webhook Events", + "scopes": [ + "write", + "read" + ] + }, + { + "name": "Users", + "description": "Users, Business Profile Account", + "scopes": [ + "read", + "write" + ] + } +] +``` +## Checklist + + +- [ ] I formatted the code `cargo +nightly fmt --all` +- [ ] I addressed lints thrown by `cargo clippy` +- [ ] I reviewed the submitted code +- [ ] I added unit tests for my changes where possible +COMMENTS: +- semanticdiff-com[bot]: Review changes with  SemanticDiff +
+Changed Files +
+ +| File | Status | +| :--- | :--- | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8896/changes#crates/router/src/routes/app.rs)  [crates/router/src/routes/app\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8896/changes#crates/router/src/routes/app.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8896/changes#crates/router/src/routes/app.rs)  98% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8896/changes#crates/common_enums/src/enums.rs)  [crates/common\_enums/src/enums\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8896/changes#crates/common_enums/src/enums.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8896/changes#crates/common_enums/src/enums.rs)  93% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8896/changes#crates/router/src/core/user_role.rs)  [crates/router/src/core/user\_role\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8896/changes#crates/router/src/core/user_role.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8896/changes#crates/router/src/core/user_role.rs)  73% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8896/changes#crates/api_models/src/events/user_role.rs)  [crates/api\_models/src/events/user\_role\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8896/changes#crates/api_models/src/events/user_role.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8896/changes#crates/api_models/src/events/user_role.rs)  51% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8896/changes#crates/router/src/routes/lock_utils.rs)  [crates/router/src/routes/lock\_utils\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8896/changes#crates/router/src/routes/lock_utils.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8896/changes#crates/router/src/routes/lock_utils.rs)  44% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8896/changes#crates/router/src/core/user_role/role.rs)  [crates/router/src/core/user\_role/role\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8896/changes#crates/router/src/core/user_role/role.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8896/changes#crates/router/src/core/user_role/role.rs)  22% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8896/changes#crates/router/src/services/authorization/permission_groups.rs)  [crates/router/src/services/authorization/permission\_groups\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8896/changes#crates/router/src/services/authorization/permission_groups.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8896/changes#crates/router/src/services/authorization/permission_groups.rs)  22% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8896/changes#crates/router/src/utils/user_role.rs)  [crates/router/src/utils/user\_role\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8896/changes#crates/router/src/utils/user_role.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8896/changes#crates/router/src/utils/user_role.rs)  17% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8896/changes#crates/api_models/src/user_role/role.rs)  [crates/api\_models/src/user\_role/role\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8896/changes#crates/api_models/src/user_role/role.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8896/changes#crates/api_models/src/user_role/role.rs)  5% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8896/changes#crates/router/src/routes/user_role.rs)  [crates/router/src/routes/user\_role\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8896/changes#crates/router/src/routes/user_role.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8896/changes#crates/router/src/routes/user_role.rs)  0% smaller | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8896/changes#crates/router_env/src/logger/types.rs)  [crates/router\_env/src/logger/types\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8896/changes#crates/router_env/src/logger/types.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8896/changes#crates/router_env/src/logger/types.rs)  0% smaller | + +
+- ThisIsMani [crates/api_models/src/user_role/role.rs:18]: Use different type for this. Don't change the current type, that is not supposed to be used for this. +- ThisIsMani [crates/api_models/src/user_role/role.rs:50]: This should be reverted back once the previous change is done. +- ThisIsMani [crates/router/src/core/user_role/role.rs:47]: Fix the import. +- ThisIsMani [crates/router/src/core/user_role.rs:119]: ```suggestion + // TODO: Remove this hashset conversion when merchant access +``` + +- ThisIsMani [crates/router/src/core/user_role.rs:126]: Should we also check the entity type here? How is that handled? For example Customer related stuff should not be there for profile. +- ThisIsMani [crates/router/src/core/user_role/role.rs:33]: What happens if the same parent_group is present multiple times. +- ThisIsMani [crates/api_models/src/user_role/role.rs:61]: We should make this option. +- ThisIsMani [crates/api_models/src/user_role/role.rs:58]: ```suggestion +pub struct ListRolesQueryParams { +``` +- ThisIsMani [crates/router/src/core/user_role/role.rs:590]: To be deprecated. +- ThisIsMani [crates/api_models/src/user_role/role.rs:93]: ```suggestion +pub struct GetParentGroupsInfoQueryParams { +``` +- ThisIsMani [crates/router/src/core/user_role.rs:120]: Check if the current user role entity type is greater than the entity type he is requesting. +- ThisIsMani [crates/router/src/routes/user_role.rs:347]: Use a single flow here. +- ThisIsMani [crates/router/src/services/authorization/permission_groups.rs:152]: Remove this if not needed. +- ThisIsMani [crates/router/src/services/authorization/permission_groups.rs:164]: Apply this on filtered resources instead. +- ThisIsMani [crates/router/src/services/authorization/permission_groups.rs:176]: Return available scopes instead of validating them here. +- kanikabansal-juspay [crates/router/src/core/user_role.rs:126]: That check is handled in `get_descriptions_for_groups` function. +- kanikabansal-juspay [crates/router/src/core/user_role/role.rs:33]: We are using the `validate_role_groups` function in create_role_v2 which compares the length of unique groups with the original groups and returns an error if they don’t match. So this case is already handled. +- ThisIsMani [crates/router/src/core/user_role/role.rs:46]: any or all can be used. +- ThisIsMani [crates/router/src/core/user_role/role.rs:67]: Can be replaced by fold. +- ThisIsMani [crates/router/src/core/user_role/role.rs:33]: Can be replaced with map. + +=== COMMIT === +SUBJECT: refactor(user_roles): implement parent group info based role APIs (#8896) +BODY: +Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> + +=== FILES === +Summary: 11 files changed, +415 -103 +- crates/api_models/src/events/user_role.rs (+11 -5) +- crates/api_models/src/user_role/role.rs (+37 -1) +- crates/common_enums/src/enums.rs (+7 -3) +- crates/router/src/core/user_role.rs (+28 -17) +- crates/router/src/core/user_role/role.rs (+161 -20) +- crates/router/src/routes/app.rs (+43 -37) +- crates/router/src/routes/lock_utils.rs (+1 -0) +- crates/router/src/routes/user_role.rs (+26 -5) +- crates/router/src/services/authorization/permission_groups.rs (+22 -12) +- crates/router/src/utils/user_role.rs (+77 -3) +- crates/router_env/src/logger/types.rs (+2 -0) + +=== PATCH === +diff --git a/crates/api_models/src/events/user_role.rs b/crates/api_models/src/events/user_role.rs +index e0df36a3..7b6413b2 100644 +--- a/crates/api_models/src/events/user_role.rs ++++ b/crates/api_models/src/events/user_role.rs +@@ -2,9 +2,10 @@ use common_utils::events::{ApiEventMetric, ApiEventsType}; + + use crate::user_role::{ + role::{ +- CreateRoleRequest, GetRoleRequest, GroupsAndResources, ListRolesAtEntityLevelRequest, +- ListRolesRequest, RoleInfoResponseNew, RoleInfoWithGroupsResponse, RoleInfoWithParents, +- UpdateRoleRequest, ++ CreateRoleRequest, CreateRoleV2Request, GetParentGroupsInfoQueryParams, GetRoleRequest, ++ GroupsAndResources, ListRolesAtEntityLevelRequest, ListRolesQueryParams, ListRolesResponse, ++ ParentGroupInfoRequest, RoleInfoResponseNew, RoleInfoResponseWithParentsGroup, ++ RoleInfoWithGroupsResponse, RoleInfoWithParents, UpdateRoleRequest, + }, + AuthorizationInfoResponse, DeleteUserRoleRequest, ListUsersInEntityRequest, + UpdateUserRoleRequest, +@@ -14,17 +15,22 @@ common_utils::impl_api_event_type!( + Miscellaneous, + ( + GetRoleRequest, ++ GetParentGroupsInfoQueryParams, + AuthorizationInfoResponse, + UpdateUserRoleRequest, + DeleteUserRoleRequest, + CreateRoleRequest, ++ CreateRoleV2Request, + UpdateRoleRequest, + ListRolesAtEntityLevelRequest, + RoleInfoResponseNew, + RoleInfoWithGroupsResponse, + ListUsersInEntityRequest, +- ListRolesRequest, ++ ListRolesQueryParams, + GroupsAndResources, +- RoleInfoWithParents ++ RoleInfoWithParents, ++ ParentGroupInfoRequest, ++ RoleInfoResponseWithParentsGroup, ++ ListRolesResponse + ) + ); +diff --git a/crates/api_models/src/user_role/role.rs b/crates/api_models/src/user_role/role.rs +index 6b8736d3..0ab85327 100644 +--- a/crates/api_models/src/user_role/role.rs ++++ b/crates/api_models/src/user_role/role.rs +@@ -10,6 +10,14 @@ pub struct CreateRoleRequest { + pub entity_type: Option, + } + ++#[derive(Debug, serde::Deserialize, serde::Serialize)] ++pub struct CreateRoleV2Request { ++ pub role_name: String, ++ pub role_scope: RoleScope, ++ pub entity_type: Option, ++ pub parent_groups: Vec, ++} ++ + #[derive(Debug, serde::Deserialize, serde::Serialize)] + pub struct UpdateRoleRequest { + pub groups: Option>, +@@ -41,8 +49,15 @@ pub struct ParentGroupInfo { + } + + #[derive(Debug, serde::Deserialize, serde::Serialize)] +-pub struct ListRolesRequest { ++pub struct ParentGroupInfoRequest { ++ pub name: ParentGroup, ++ pub scopes: Vec, ++} ++ ++#[derive(Debug, serde::Deserialize, serde::Serialize)] ++pub struct ListRolesQueryParams { + pub entity_type: Option, ++ pub groups: Option, + } + + #[derive(Debug, serde::Serialize)] +@@ -54,6 +69,15 @@ pub struct RoleInfoResponseNew { + pub scope: RoleScope, + } + ++#[derive(Debug, serde::Serialize)] ++pub struct RoleInfoResponseWithParentsGroup { ++ pub role_id: String, ++ pub role_name: String, ++ pub entity_type: EntityType, ++ pub parent_groups: Vec, ++ pub role_scope: RoleScope, ++} ++ + #[derive(Debug, serde::Deserialize, serde::Serialize)] + pub struct GetRoleRequest { + pub role_id: String, +@@ -64,6 +88,11 @@ pub struct ListRolesAtEntityLevelRequest { + pub entity_type: EntityType, + } + ++#[derive(Debug, serde::Deserialize, serde::Serialize)] ++pub struct GetParentGroupsInfoQueryParams { ++ pub entity_type: Option, ++} ++ + #[derive(Debug, serde::Deserialize, serde::Serialize)] + pub enum RoleCheckType { + Invite, +@@ -81,3 +110,10 @@ pub struct GroupsAndResources { + pub groups: Vec, + pub resources: Vec, + } ++ ++#[derive(Debug, serde::Serialize)] ++#[serde(untagged)] ++pub enum ListRolesResponse { ++ WithGroups(Vec), ++ WithParentGroups(Vec), ++} +diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs +index bf93c6fa..22091eca 100644 +--- a/crates/common_enums/src/enums.rs ++++ b/crates/common_enums/src/enums.rs +@@ -7708,7 +7708,9 @@ pub enum PermissionGroup { + ThemeManage, + } + +-#[derive(Clone, Debug, serde::Serialize, PartialEq, Eq, Hash, strum::EnumIter)] ++#[derive( ++ Clone, Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Hash, strum::EnumIter, ++)] + pub enum ParentGroup { + Operations, + Connectors, +@@ -7722,7 +7724,7 @@ pub enum ParentGroup { + Theme, + } + +-#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash, serde::Serialize)] ++#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash, serde::Serialize, serde::Deserialize)] + #[serde(rename_all = "snake_case")] + pub enum Resource { + Payment, +@@ -7753,7 +7755,9 @@ pub enum Resource { + Theme, + } + +-#[derive(Debug, Clone, Copy, Eq, PartialEq, Ord, PartialOrd, serde::Serialize, Hash)] ++#[derive( ++ Debug, Clone, Copy, Eq, PartialEq, Ord, PartialOrd, serde::Serialize, serde::Deserialize, Hash, ++)] + #[serde(rename_all = "snake_case")] + pub enum PermissionScope { + Read = 0, +diff --git a/crates/router/src/core/user_role.rs b/crates/router/src/core/user_role.rs +index edad36e5..1b4870f0 100644 +--- a/crates/router/src/core/user_role.rs ++++ b/crates/router/src/core/user_role.rs +@@ -89,6 +89,7 @@ pub async fn get_authorization_info_with_group_tag( + pub async fn get_parent_group_info( + state: SessionState, + user_from_token: auth::UserFromToken, ++ request: role_api::GetParentGroupsInfoQueryParams, + ) -> UserResponse> { + let role_info = roles::RoleInfo::from_role_id_org_id_tenant_id( + &state, +@@ -102,24 +103,34 @@ pub async fn get_parent_group_info( + .await + .to_not_found_response(UserErrors::InvalidRoleId)?; + +- let parent_groups = ParentGroup::get_descriptions_for_groups( +- role_info.get_entity_type(), +- PermissionGroup::iter().collect(), +- ) +- .unwrap_or_default() +- .into_iter() +- .map(|(parent_group, description)| role_api::ParentGroupInfo { +- name: parent_group.clone(), +- description, +- scopes: PermissionGroup::iter() +- .filter_map(|group| (group.parent() == parent_group).then_some(group.scope())) +- // TODO: Remove this hashset conversion when merhant access +- // and organization access groups are removed +- .collect::>() ++ let entity_type = request ++ .entity_type ++ .unwrap_or_else(|| role_info.get_entity_type()); ++ ++ if role_info.get_entity_type() < entity_type { ++ return Err(report!(UserErrors::InvalidRoleOperation)).attach_printable(format!( ++ "Invalid operation, requestor entity type = {} cannot access entity type = {}", ++ role_info.get_entity_type(), ++ entity_type ++ )); ++ } ++ ++ let parent_groups = ++ ParentGroup::get_descriptions_for_groups(entity_type, PermissionGroup::iter().collect()) ++ .unwrap_or_default() + .into_iter() +- .collect(), +- }) +- .collect::>(); ++ .map(|(parent_group, description)| role_api::ParentGroupInfo { ++ name: parent_group.clone(), ++ description, ++ scopes: PermissionGroup::iter() ++ .filter_map(|group| (group.parent() == parent_group).then_some(group.scope())) ++ // TODO: Remove this hashset conversion when merchant access ++ // and organization access groups are removed ++ .collect::>() ++ .into_iter() ++ .collect(), ++ }) ++ .collect::>(); + + Ok(ApplicationResponse::Json(parent_groups)) + } +diff --git a/crates/router/src/core/user_role/role.rs b/crates/router/src/core/user_role/role.rs +index 554c0cd7..cbd49a14 100644 +--- a/crates/router/src/core/user_role/role.rs ++++ b/crates/router/src/core/user_role/role.rs +@@ -157,6 +157,111 @@ pub async fn create_role( + )) + } + ++pub async fn create_role_v2( ++ state: SessionState, ++ user_from_token: UserFromToken, ++ req: role_api::CreateRoleV2Request, ++ _req_state: ReqState, ++) -> UserResponse { ++ let now = common_utils::date_time::now(); ++ ++ let user_entity_type = user_from_token ++ .get_role_info_from_db(&state) ++ .await ++ .attach_printable("Invalid role_id in JWT")? ++ .get_entity_type(); ++ ++ let role_entity_type = req.entity_type.unwrap_or(EntityType::Merchant); ++ ++ if matches!(role_entity_type, EntityType::Organization) { ++ return Err(report!(UserErrors::InvalidRoleOperation)) ++ .attach_printable("User trying to create org level custom role"); ++ } ++ ++ let requestor_entity_from_role_scope = EntityType::from(req.role_scope); ++ ++ if requestor_entity_from_role_scope < role_entity_type { ++ return Err(report!(UserErrors::InvalidRoleOperation)).attach_printable(format!( ++ "User is trying to create role of type {role_entity_type} and scope {requestor_entity_from_role_scope}", ++ )); ++ } ++ ++ let max_from_scope_and_entity = cmp::max(requestor_entity_from_role_scope, role_entity_type); ++ ++ if user_entity_type < max_from_scope_and_entity { ++ return Err(report!(UserErrors::InvalidRoleOperation)).attach_printable(format!( ++ "{user_entity_type} is trying to create of scope {requestor_entity_from_role_scope} and of type {role_entity_type}", ++ )); ++ } ++ ++ let role_name = RoleName::new(req.role_name.clone())?; ++ ++ let permission_groups = ++ utils::user_role::parent_group_info_request_to_permission_groups(&req.parent_groups)?; ++ ++ utils::user_role::validate_role_groups(&permission_groups)?; ++ utils::user_role::validate_role_name( ++ &state, ++ &role_name, ++ &user_from_token.merchant_id, ++ &user_from_token.org_id, ++ user_from_token ++ .tenant_id ++ .as_ref() ++ .unwrap_or(&state.tenant.tenant_id), ++ &user_from_token.profile_id, ++ &role_entity_type, ++ ) ++ .await?; ++ ++ let (org_id, merchant_id, profile_id) = match role_entity_type { ++ EntityType::Organization | EntityType::Tenant => (user_from_token.org_id, None, None), ++ EntityType::Merchant => ( ++ user_from_token.org_id, ++ Some(user_from_token.merchant_id), ++ None, ++ ), ++ EntityType::Profile => ( ++ user_from_token.org_id, ++ Some(user_from_token.merchant_id), ++ Some(user_from_token.profile_id), ++ ), ++ }; ++ ++ let role = state ++ .global_store ++ .insert_role(RoleNew { ++ role_id: generate_id_with_default_len("role"), ++ role_name: role_name.get_role_name(), ++ merchant_id, ++ org_id, ++ groups: permission_groups, ++ scope: req.role_scope, ++ entity_type: role_entity_type, ++ created_by: user_from_token.user_id.clone(), ++ last_modified_by: user_from_token.user_id, ++ created_at: now, ++ last_modified_at: now, ++ profile_id, ++ tenant_id: user_from_token.tenant_id.unwrap_or(state.tenant.tenant_id), ++ }) ++ .await ++ .to_duplicate_response(UserErrors::RoleNameAlreadyExists)?; ++ ++ let response_parent_groups = ++ utils::user_role::permission_groups_to_parent_group_info(&role.groups, role.entity_type); ++ ++ Ok(ApplicationResponse::Json( ++ role_api::RoleInfoResponseWithParentsGroup { ++ role_id: role.role_id, ++ role_name: role.role_name, ++ role_scope: role.scope, ++ entity_type: role.entity_type, ++ parent_groups: response_parent_groups, ++ }, ++ )) ++} ++ + pub async fn get_role_with_groups( + state: SessionState, + user_from_token: UserFromToken, +@@ -227,7 +332,7 @@ pub async fn get_parent_info_for_role( + .get_permission_groups() + .iter() + .filter_map(|group| (group.parent() == parent_group).then_some(group.scope())) +- // TODO: Remove this hashset conversion when merhant access ++ // TODO: Remove this hashset conversion when merchant access + // and organization access groups are removed + .collect::>() + .into_iter() +@@ -331,8 +436,8 @@ pub async fn update_role( + pub async fn list_roles_with_info( + state: SessionState, + user_from_token: UserFromToken, +- request: role_api::ListRolesRequest, +-) -> UserResponse> { ++ request: role_api::ListRolesQueryParams, ++) -> UserResponse { + let user_role_info = user_from_token + .get_role_info_from_db(&state) + .await +@@ -397,25 +502,61 @@ pub async fn list_roles_with_info( + + role_info_vec.extend(custom_roles.into_iter().map(roles::RoleInfo::from)); + +- let list_role_info_response = role_info_vec +- .into_iter() +- .filter_map(|role_info| { +- let is_lower_entity = user_role_entity >= role_info.get_entity_type(); +- let request_filter = request.entity_type.map_or(true, |entity_type| { +- entity_type == role_info.get_entity_type() +- }); +- +- (is_lower_entity && request_filter).then_some(role_api::RoleInfoResponseNew { +- role_id: role_info.get_role_id().to_string(), +- role_name: role_info.get_role_name().to_string(), +- groups: role_info.get_permission_groups().to_vec(), +- entity_type: role_info.get_entity_type(), +- scope: role_info.get_scope(), ++ if request.groups == Some(true) { ++ let list_role_info_response = role_info_vec ++ .into_iter() ++ .filter_map(|role_info| { ++ let is_lower_entity = user_role_entity >= role_info.get_entity_type(); ++ let request_filter = request.entity_type.map_or(true, |entity_type| { ++ entity_type == role_info.get_entity_type() ++ }); ++ ++ (is_lower_entity && request_filter).then_some({ ++ let permission_groups = role_info.get_permission_groups(); ++ let parent_groups = utils::user_role::permission_groups_to_parent_group_info( ++ &permission_groups, ++ role_info.get_entity_type(), ++ ); ++ ++ role_api::RoleInfoResponseWithParentsGroup { ++ role_id: role_info.get_role_id().to_string(), ++ role_name: role_info.get_role_name().to_string(), ++ entity_type: role_info.get_entity_type(), ++ parent_groups, ++ role_scope: role_info.get_scope(), ++ } ++ }) + }) +- }) +- .collect::>(); ++ .collect::>(); ++ ++ Ok(ApplicationResponse::Json( ++ role_api::ListRolesResponse::WithParentGroups(list_role_info_response), ++ )) ++ } ++ // TODO: To be deprecated ++ else { ++ let list_role_info_response = role_info_vec ++ .into_iter() ++ .filter_map(|role_info| { ++ let is_lower_entity = user_role_entity >= role_info.get_entity_type(); ++ let request_filter = request.entity_type.map_or(true, |entity_type| { ++ entity_type == role_info.get_entity_type() ++ }); + +- Ok(ApplicationResponse::Json(list_role_info_response)) ++ (is_lower_entity && request_filter).then_some(role_api::RoleInfoResponseNew { ++ role_id: role_info.get_role_id().to_string(), ++ role_name: role_info.get_role_name().to_string(), ++ groups: role_info.get_permission_groups().to_vec(), ++ entity_type: role_info.get_entity_type(), ++ scope: role_info.get_scope(), ++ }) ++ }) ++ .collect::>(); ++ ++ Ok(ApplicationResponse::Json( ++ role_api::ListRolesResponse::WithGroups(list_role_info_response), ++ )) ++ } + } + + pub async fn list_roles_at_entity_level( +diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs +index b5425e55..690a4337 100644 +--- a/crates/router/src/routes/app.rs ++++ b/crates/router/src/routes/app.rs +@@ -2722,45 +2722,51 @@ impl User { + } + + // Role information +- route = +- route.service( +- web::scope("/role") +- .service( +- web::resource("") +- .route(web::get().to(user_role::get_role_from_token)) +- .route(web::post().to(user_role::create_role)), +- ) +- .service(web::resource("/v2").route( +- web::get().to(user_role::get_groups_and_resources_for_role_from_token), +- )) +- // TODO: To be deprecated +- .service( +- web::resource("/v2/list") +- .route(web::get().to(user_role::list_roles_with_info)), +- ) +- .service( +- web::scope("/list") +- .service( +- web::resource("") +- .route(web::get().to(user_role::list_roles_with_info)), +- ) +- .service(web::resource("/invite").route( ++ route = route.service( ++ web::scope("/role") ++ .service( ++ web::resource("") ++ .route(web::get().to(user_role::get_role_from_token)) ++ // TODO: To be deprecated ++ .route(web::post().to(user_role::create_role)), ++ ) ++ .service( ++ web::resource("/v2") ++ .route(web::post().to(user_role::create_role_v2)) ++ .route( ++ web::get().to(user_role::get_groups_and_resources_for_role_from_token), ++ ), ++ ) ++ // TODO: To be deprecated ++ .service( ++ web::resource("/v2/list").route(web::get().to(user_role::list_roles_with_info)), ++ ) ++ .service( ++ web::scope("/list") ++ .service( ++ web::resource("").route(web::get().to(user_role::list_roles_with_info)), ++ ) ++ .service( ++ web::resource("/invite").route( + web::get().to(user_role::list_invitable_roles_at_entity_level), +- )) +- .service(web::resource("/update").route( ++ ), ++ ) ++ .service( ++ web::resource("/update").route( + web::get().to(user_role::list_updatable_roles_at_entity_level), +- )), +- ) +- .service( +- web::resource("/{role_id}") +- .route(web::get().to(user_role::get_role)) +- .route(web::put().to(user_role::update_role)), +- ) +- .service( +- web::resource("/{role_id}/v2") +- .route(web::get().to(user_role::get_parent_info_for_role)), +- ), +- ); ++ ), ++ ), ++ ) ++ .service( ++ web::resource("/{role_id}") ++ .route(web::get().to(user_role::get_role)) ++ .route(web::put().to(user_role::update_role)), ++ ) ++ .service( ++ web::resource("/{role_id}/v2") ++ .route(web::get().to(user_role::get_parent_info_for_role)), ++ ), ++ ); + + #[cfg(feature = "dummy_connector")] + { +diff --git a/crates/router/src/routes/lock_utils.rs b/crates/router/src/routes/lock_utils.rs +index dcc5cf07..27b66e5b 100644 +--- a/crates/router/src/routes/lock_utils.rs ++++ b/crates/router/src/routes/lock_utils.rs +@@ -331,6 +331,7 @@ impl From for ApiIdentifier { + | Flow::AcceptInvitationsPreAuth + | Flow::DeleteUserRole + | Flow::CreateRole ++ | Flow::CreateRoleV2 + | Flow::UpdateRole + | Flow::UserFromEmail + | Flow::ListUsersInLineage => Self::UserRole, +diff --git a/crates/router/src/routes/user_role.rs b/crates/router/src/routes/user_role.rs +index 9910cef3..91cc92cb 100644 +--- a/crates/router/src/routes/user_role.rs ++++ b/crates/router/src/routes/user_role.rs +@@ -74,7 +74,7 @@ pub async fn get_groups_and_resources_for_role_from_token( + )) + .await + } +- ++// TODO: To be deprecated + pub async fn create_role( + state: web::Data, + req: HttpRequest, +@@ -95,6 +95,26 @@ pub async fn create_role( + .await + } + ++pub async fn create_role_v2( ++ state: web::Data, ++ req: HttpRequest, ++ json_payload: web::Json, ++) -> HttpResponse { ++ let flow = Flow::CreateRoleV2; ++ Box::pin(api::server_wrap( ++ flow, ++ state.clone(), ++ &req, ++ json_payload.into_inner(), ++ role_core::create_role_v2, ++ &auth::JWTAuth { ++ permission: Permission::MerchantUserWrite, ++ }, ++ api_locking::LockAction::NotApplicable, ++ )) ++ .await ++} ++ + pub async fn get_role( + state: web::Data, + req: HttpRequest, +@@ -274,6 +294,7 @@ pub async fn get_role_information( + pub async fn get_parent_group_info( + state: web::Data, + http_req: HttpRequest, ++ query: web::Query, + ) -> HttpResponse { + let flow = Flow::GetParentGroupInfo; + +@@ -281,9 +302,9 @@ pub async fn get_parent_group_info( + flow, + state.clone(), + &http_req, +- (), +- |state, user_from_token, _, _| async move { +- user_role_core::get_parent_group_info(state, user_from_token).await ++ query.into_inner(), ++ |state, user_from_token, request, _| async move { ++ user_role_core::get_parent_group_info(state, user_from_token, request).await + }, + &auth::JWTAuth { + permission: Permission::ProfileUserRead, +@@ -317,7 +338,7 @@ pub async fn list_users_in_lineage( + pub async fn list_roles_with_info( + state: web::Data, + req: HttpRequest, +- query: web::Query, ++ query: web::Query, + ) -> HttpResponse { + let flow = Flow::ListRolesV2; + +diff --git a/crates/router/src/services/authorization/permission_groups.rs b/crates/router/src/services/authorization/permission_groups.rs +index c056bdfc..774368b1 100644 +--- a/crates/router/src/services/authorization/permission_groups.rs ++++ b/crates/router/src/services/authorization/permission_groups.rs +@@ -119,6 +119,7 @@ pub trait ParentGroupExt { + entity_type: EntityType, + groups: Vec, + ) -> Option>; ++ fn get_available_scopes(&self) -> Vec; + } + + impl ParentGroupExt for ParentGroup { +@@ -143,24 +144,26 @@ impl ParentGroupExt for ParentGroup { + ) -> Option> { + let descriptions_map = Self::iter() + .filter_map(|parent| { +- let scopes = groups +- .iter() +- .filter(|group| group.parent() == parent) +- .map(|group| group.scope()) +- .max()?; +- +- let resources = parent ++ if !groups.iter().any(|group| group.parent() == parent) { ++ return None; ++ } ++ let filtered_resources: Vec<_> = parent + .resources() +- .iter() ++ .into_iter() + .filter(|res| res.entities().iter().any(|entity| entity <= &entity_type)) ++ .collect(); ++ ++ if filtered_resources.is_empty() { ++ return None; ++ } ++ ++ let description = filtered_resources ++ .iter() + .map(|res| permissions::get_resource_name(*res, entity_type)) + .collect::>>()? + .join(", "); + +- Some(( +- parent, +- format!("{} {}", permissions::get_scope_name(scopes), resources), +- )) ++ Some((parent, description)) + }) + .collect::>(); + +@@ -169,6 +172,13 @@ impl ParentGroupExt for ParentGroup { + .not() + .then_some(descriptions_map) + } ++ ++ fn get_available_scopes(&self) -> Vec { ++ PermissionGroup::iter() ++ .filter(|group| group.parent() == *self) ++ .map(|group| group.scope()) ++ .collect() ++ } + } + + pub static OPERATIONS: [Resource; 8] = [ +diff --git a/crates/router/src/utils/user_role.rs b/crates/router/src/utils/user_role.rs +index c1d9dc10..67ed2127 100644 +--- a/crates/router/src/utils/user_role.rs ++++ b/crates/router/src/utils/user_role.rs +@@ -1,6 +1,10 @@ +-use std::{cmp, collections::HashSet}; ++use std::{ ++ cmp, ++ collections::{HashMap, HashSet}, ++}; + +-use common_enums::{EntityType, PermissionGroup}; ++use api_models::user_role::role as role_api; ++use common_enums::{EntityType, ParentGroup, PermissionGroup}; + use common_utils::id_type; + use diesel_models::{ + enums::{UserRoleVersion, UserStatus}, +@@ -10,6 +14,7 @@ use diesel_models::{ + use error_stack::{report, Report, ResultExt}; + use router_env::logger; + use storage_impl::errors::StorageError; ++use strum::IntoEnumIterator; + + use crate::{ + consts, +@@ -19,7 +24,11 @@ use crate::{ + user_role::{ListUserRolesByOrgIdPayload, ListUserRolesByUserIdPayload}, + }, + routes::SessionState, +- services::authorization::{self as authz, roles}, ++ services::authorization::{ ++ self as authz, ++ permission_groups::{ParentGroupExt, PermissionGroupExt}, ++ roles, ++ }, + types::domain, + }; + +@@ -508,3 +517,68 @@ pub fn get_min_entity( + + Ok(cmp::min(user_entity, filter_entity)) + } ++ ++pub fn parent_group_info_request_to_permission_groups( ++ parent_groups: &[role_api::ParentGroupInfoRequest], ++) -> Result, UserErrors> { ++ parent_groups ++ .iter() ++ .try_fold(Vec::new(), |mut permission_groups, parent_group| { ++ let scopes = &parent_group.scopes; ++ ++ if scopes.is_empty() { ++ return Err(UserErrors::InvalidRoleOperation); ++ } ++ ++ let available_scopes = parent_group.name.get_available_scopes(); ++ ++ if !scopes.iter().all(|scope| available_scopes.contains(scope)) { ++ return Err(UserErrors::InvalidRoleOperation); ++ } ++ ++ let groups = PermissionGroup::iter() ++ .filter(|group| { ++ group.parent() == parent_group.name && scopes.contains(&group.scope()) ++ }) ++ .collect::>(); ++ permission_groups.extend(groups); ++ ++ Ok(permission_groups) ++ }) ++} ++ ++pub fn permission_groups_to_parent_group_info( ++ permission_groups: &[PermissionGroup], ++ entity_type: EntityType, ++) -> Vec { ++ let parent_groups_map: HashMap> = ++ permission_groups ++ .iter() ++ .fold(HashMap::new(), |mut acc, group| { ++ let parent = group.parent(); ++ let scope = group.scope(); ++ acc.entry(parent).or_default().push(scope); ++ acc ++ }); ++ ++ parent_groups_map ++ .into_iter() ++ .filter_map(|(name, scopes)| { ++ let unique_scopes = scopes ++ .into_iter() ++ .collect::>() ++ .into_iter() ++ .collect(); ++ ++ let description = ++ ParentGroup::get_descriptions_for_groups(entity_type, permission_groups.to_vec()) ++ .and_then(|descriptions| descriptions.get(&name).cloned())?; ++ ++ Some(role_api::ParentGroupInfo { ++ name, ++ description, ++ scopes: unique_scopes, ++ }) ++ }) ++ .collect() ++} +diff --git a/crates/router_env/src/logger/types.rs b/crates/router_env/src/logger/types.rs +index 722d9bde..b758d98f 100644 +--- a/crates/router_env/src/logger/types.rs ++++ b/crates/router_env/src/logger/types.rs +@@ -473,6 +473,8 @@ pub enum Flow { + PaymentsAuthorize, + /// Create Role + CreateRole, ++ /// Create Role V2 ++ CreateRoleV2, + /// Update Role + UpdateRole, + /// User email flow start + +----- END CHUNK ----- \ No newline at end of file diff --git a/raw/e9/e9a8187dfdc74a5b555140afd5b7ec05491f06ed.txt b/raw/e9/e9a8187dfdc74a5b555140afd5b7ec05491f06ed.txt new file mode 100644 index 0000000000000000000000000000000000000000..f8f4911742e6529b684075a0a9db870612ed73e8 --- /dev/null +++ b/raw/e9/e9a8187dfdc74a5b555140afd5b7ec05491f06ed.txt @@ -0,0 +1,560 @@ +ROUTE: juspay/hyperswitch@e9a8187dfdc74a5b555140afd5b7ec05491f06ed +REPO: https://github.com/juspay/hyperswitch +COMMIT: e9a8187dfdc74a5b555140afd5b7ec05491f06ed +AUTHOR: Swangi Kumari <85639103+swangi-kumari@users.noreply.github.com> +DATE: 2025-08-22T13:04:07 + +=== ISSUE_AND_PR === +[PR #8930] refactor(core): refund sync process scheduled time +URL: https://github.com/juspay/hyperswitch/pull/8930 +BODY: +## Type of Change + + +- [x] Bugfix +- [ ] New feature +- [ ] Enhancement +- [x] Refactoring +- [ ] Dependency updates +- [ ] Documentation +- [ ] CI/CD + +## Description + +Before refund sync process tracker task was using pt_mapping_{connector} for sync retries (this is config name of Psync which was incorrect) + +Fixes made in this PR - +- We are using pt_mapping_refund_sync_{connector} +- refund sync which was using retry_sync_task so made retry_refund_sync_task which will handle the refund task +- fix refund sync workflow being incorrectly scheduled for 2nd retry attempt instead of 1st retry attempt +- ConnectorPTMapping should also be read from db , previously we were always reading only from redis + +### Additional Changes + +- [ ] This PR modifies the API contract +- [ ] This PR modifies the database schema +- [ ] This PR modifies application configuration/environment variables + + + + +## Motivation and Context + + + +## How did you test it? +Create a process tracker config for Adyen connector +``` +curl --location 'http://localhost:8080/configs/pt_mapping_refund_sync_adyen' \ +--header 'Content-Type: application/json' \ +--header 'api-key: _____' \ +--data '{ + "key": "pt_mapping_refund_sync_adyen", + "value": "{\"custom_merchant_mapping\":{},\"default_mapping\":{\"start_after\":180,\"frequencies\":[[20,2],[30,2],[40,2],[60,2],[2400,1],[43200,4],[86400,3],[345600,2]]},\"max_retries_count\":18}" +}' +``` +Response +``` +{ + "key": "pt_mapping_refund_sync_adyen", + "value": "{\"custom_merchant_mapping\":{},\"default_mapping\":{\"start_after\":180,\"frequencies\":[[20,2],[30,2],[40,2],[60,2],[2400,1],[43200,4],[86400,3],[345600,2]]},\"max_retries_count\":18}" +} +``` + +Create a no 3ds card payment via Adyen +``` +{ + "amount": 1000, + "currency": "USD", + "confirm": true, + "capture_method": "automatic", + "capture_on": "2022-09-10T10:11:12Z", + "amount_to_capture": 1000, + "customer_id": "StripeCustomer", + "email": "guest@example.com", + "name": "John Doe", + "phone": "999999999", + "phone_country_code": "+1", + "description": "Its my first payment request", + "authentication_type": "no_three_ds", + "return_url": "https://duck.com", + "payment_method": "card", + "payment_method_type": "credit", + "payment_method_data": { + "card": { + "card_number": "4111111111111111", + "card_exp_month": "03", + "card_exp_year": "2030", + "card_holder_name": "joseph Doe", + "card_cvc": "737" + } + + }, + "metadata": { + "order_id": "ORD-12345", + "sdata": { + "customer_segment": "premium", + "purchase_platform": "web_store" + } + }, + "routing": { + "type": "single", + "data": "adyen" + }, + "billing": { + "address": { + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "city": "San Fransico", + "state": "California", + "zip": "94122", + "country": "US", + "first_name": "PiX" + } + }, + "shipping": { + "address": { + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "city": "San Fransico", + "state": "California", + "zip": "94122", + "country": "US", + "first_name": "PiX" + } + }, + "statement_descriptor_name": "joseph", + "statement_descriptor_suffix": "JS", + "merchant_order_reference_id": "order_narvar12", + "browser_info": { + "os_type": "macOS", + "language": "en-GB", + "time_zone": -330, + "ip_address": "103.159.11.202", + "os_version": "10.15.7", + "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36", + "color_depth": 24, + "device_model": "Macintosh", + "java_enabled": true, + "screen_width": 1920, + "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8", + "screen_height": 1080, + "accept_language": "en", + "java_script_enabled": true + }, + "profile_id": "{{payment_profile_id}}" +} +``` +Response +``` +{ + "payment_id": "pay_PuKa9OvV1e3yrcdZcfEo", + "merchant_id": "merchant_1755523756", + "status": "succeeded", + "amount": 1000, + "net_amount": 1000, + "shipping_cost": null, + "amount_capturable": 0, + "amount_received": 1000, + "connector": "adyen", + "client_secret": "pay_PuKa9OvV1e3yrcdZcfEo_secret_V1Yu4MdVf3iEhwKygr0H", + "created": "2025-08-19T06:21:08.206Z", + "currency": "USD", + "customer_id": "StripeCustomer", + "customer": { + "id": "StripeCustomer", + "name": "John Doe", + "email": "guest@example.com", + "phone": "999999999", + "phone_country_code": "+1" + }, + "description": "Its my first payment request", + "refunds": null, + "disputes": null, + "mandate_id": null, + "mandate_data": null, + "setup_future_usage": null, + "off_session": null, + "capture_on": null, + "capture_method": "automatic", + "payment_method": "card", + "payment_method_data": { + "card": { + "last4": "1111", + "card_type": "CREDIT", + "card_network": "Visa", + "card_issuer": "JP Morgan", + "card_issuing_country": "INDIA", + "card_isin": "411111", + "card_extended_bin": null, + "card_exp_month": "03", + "card_exp_year": "2030", + "card_holder_name": "joseph Doe", + "payment_checks": null, + "authentication_data": null + }, + "billing": null + }, + "payment_token": null, + "shipping": { + "address": { + "city": "San Fransico", + "country": "US", + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "zip": "94122", + "state": "California", + "first_name": "PiX", + "last_name": null, + "origin_zip": null + }, + "phone": null, + "email": null + }, + "billing": { + "address": { + "city": "San Fransico", + "country": "US", + "line1": "1467", + "line2": "Harrison Street", + "line3": "Harrison Street", + "zip": "94122", + "state": "California", + "first_name": "PiX", + "last_name": null, + "origin_zip": null + }, + "phone": null, + "email": null + }, + "order_details": null, + "email": "guest@example.com", + "name": "John Doe", + "phone": "999999999", + "return_url": "https://duck.com/", + "authentication_type": "no_three_ds", + "statement_descriptor_name": "joseph", + "statement_descriptor_suffix": "JS", + "next_action": null, + "cancellation_reason": null, + "error_code": null, + "error_message": null, + "unified_code": null, + "unified_message": null, + "payment_experience": null, + "payment_method_type": "credit", + "connector_label": null, + "business_country": null, + "business_label": "default", + "business_sub_label": null, + "allowed_payment_method_types": null, + "ephemeral_key": { + "customer_id": "StripeCustomer", + "created_at": 1755584468, + "expires": 1755588068, + "secret": "epk_eadaf298af8f4d58b46ac00860f9e440" + }, + "manual_retry_allowed": false, + "connector_transaction_id": "HH2TDB3NBZXRHBV5", + "frm_message": null, + "metadata": { + "sdata": { + "customer_segment": "premium", + "purchase_platform": "web_store" + }, + "order_id": "ORD-12345" + }, + "connector_metadata": null, + "feature_metadata": { + "redirect_response": null, + "search_tags": null, + "apple_pay_recurring_details": null, + "gateway_system": "direct" + }, + "reference_id": "pay_PuKa9OvV1e3yrcdZcfEo_1", + "payment_link": null, + "profile_id": "pro_IBcsy1G8u4AqtpDlpoQ6", + "surcharge_details": null, + "attempt_count": 1, + "merchant_decision": null, + "merchant_connector_id": "mca_ST0rQKrUA8r95Bvci4FV", + "incremental_authorization_allowed": false, + "authorization_count": null, + "incremental_authorizations": null, + "external_authentication_details": null, + "external_3ds_authentication_attempted": false, + "expires_on": "2025-08-19T06:36:08.206Z", + "fingerprint": null, + "browser_info": { + "os_type": "macOS", + "language": "en-GB", + "time_zone": -330, + "ip_address": "103.159.11.202", + "os_version": "10.15.7", + "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36", + "color_depth": 24, + "device_model": "Macintosh", + "java_enabled": true, + "screen_width": 1920, + "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8", + "screen_height": 1080, + "accept_language": "en", + "java_script_enabled": true + }, + "payment_channel": null, + "payment_method_id": null, + "network_transaction_id": null, + "payment_method_status": null, + "updated": "2025-08-19T06:21:11.290Z", + "split_payments": null, + "frm_metadata": null, + "extended_authorization_applied": null, + "capture_before": null, + "merchant_order_reference_id": "order_narvar12", + "order_tax_amount": null, + "connector_mandate_id": null, + "card_discovery": "manual", + "force_3ds_challenge": false, + "force_3ds_challenge_trigger": false, + "issuer_error_code": null, + "issuer_error_message": null, + "is_iframe_redirection_enabled": null, + "whole_connector_response": null, + "enable_partial_authorization": null +} +``` + +Create a Refund Request +``` +{ + "payment_id": "{{payment_id}}", + "amount": 600, + "reason": "Customer returned product", + "refund_type": "instant", + "metadata": { + "udf1": "value1", + "new_customer": "true", + "login_date": "2019-09-10T10:11:12Z" + } +} +``` +Response +``` +{ + "refund_id": "ref_ItP2mAScOD5yeWYmsgWA", + "payment_id": "pay_PuKa9OvV1e3yrcdZcfEo", + "amount": 600, + "currency": "USD", + "status": "pending", + "reason": "Customer returned product", + "metadata": { + "udf1": "value1", + "new_customer": "true", + "login_date": "2019-09-10T10:11:12Z" + }, + "error_message": null, + "error_code": null, + "unified_code": null, + "unified_message": null, + "created_at": "2025-08-19T06:21:25.378Z", + "updated_at": "2025-08-19T06:21:25.738Z", + "connector": "adyen", + "profile_id": "pro_IBcsy1G8u4AqtpDlpoQ6", + "merchant_connector_id": "mca_ST0rQKrUA8r95Bvci4FV", + "split_refunds": null, + "issuer_error_code": null, + "issuer_error_message": null +} +``` +In db search for this refund id +`select * from refund where refund_id = 'ref_ItP2mAScOD5yeWYmsgWA';` +We will get internal_reference_id | refid_DFtahM9L64gRSkyzkibF +Screenshot 2025-08-19 at 11 57 31 AM + + +Using this internal_reference_id we will check in process_tracker table to check the scheduled time +`select * from process_tracker where id like '%refid_DFtahM9L64gRSkyzkibF%';` +We can scheduled time is 3min after updated_at as in config start_after time was set 180 sec +Screenshot 2025-08-19 at 11 57 58 AM + +After 3 min if we check process_tracker +scheduled time is 20sec min after updated_at as in config 1st frequency was set 20 sec +Screenshot 2025-08-19 at 12 01 19 PM + + +## Checklist + + +- [x] I formatted the code `cargo +nightly fmt --all` +- [x] I addressed lints thrown by `cargo clippy` +- [x] I reviewed the submitted code +- [ ] I added unit tests for my changes where possible +COMMENTS: +- semanticdiff-com[bot]: Review changes with  SemanticDiff +
+Changed Files +
+ +| File | Status | +| :--- | :--- | +| [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8930/changes#crates/router/src/core/refunds.rs)  [crates/router/src/core/refunds\.rs](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8930/changes#crates/router/src/core/refunds.rs) | [](https://app.semanticdiff.com/gh/juspay/hyperswitch/pull/8930/changes#crates/router/src/core/refunds.rs)  33% smaller | + +
+- sai-harsha-vardhan [crates/router/src/core/refunds.rs:1648]: Please add an `attach_printable` here + +=== COMMIT === +SUBJECT: refactor(core): refund sync process scheduled time (#8930) + +=== FILES === +Summary: 1 files changed, +53 -16 +- crates/router/src/core/refunds.rs (+53 -16) + +=== PATCH === +diff --git a/crates/router/src/core/refunds.rs b/crates/router/src/core/refunds.rs +index ed44f61b..3d8463c2 100644 +--- a/crates/router/src/core/refunds.rs ++++ b/crates/router/src/core/refunds.rs +@@ -4,7 +4,7 @@ use std::collections::HashMap; + #[cfg(feature = "olap")] + use api_models::admin::MerchantConnectorInfo; + use common_utils::{ +- ext_traits::AsyncExt, ++ ext_traits::{AsyncExt, StringExt}, + types::{ConnectorTransactionId, MinorUnit}, + }; + use diesel_models::{process_tracker::business_status, refund as diesel_refund}; +@@ -14,7 +14,9 @@ use hyperswitch_domain_models::{ + }; + use hyperswitch_interfaces::integrity::{CheckIntegrity, FlowIntegrity, GetIntegrityObject}; + use router_env::{instrument, tracing}; +-use scheduler::{consumer::types::process_data, utils as process_tracker_utils}; ++use scheduler::{ ++ consumer::types::process_data, errors as sch_errors, utils as process_tracker_utils, ++}; + #[cfg(feature = "olap")] + use strum::IntoEnumIterator; + +@@ -40,7 +42,6 @@ use crate::{ + transformers::{ForeignFrom, ForeignInto}, + }, + utils::{self, OptionExt}, +- workflows::payment_sync, + }; + + // ********************************************** REFUND EXECUTE ********************************************** +@@ -1439,7 +1440,7 @@ pub async fn sync_refund_with_gateway_workflow( + .await? + } + _ => { +- _ = payment_sync::retry_sync_task( ++ _ = retry_refund_sync_task( + &*state.store, + response.connector, + response.merchant_id, +@@ -1452,6 +1453,33 @@ pub async fn sync_refund_with_gateway_workflow( + Ok(()) + } + ++/// Schedule the task for refund retry ++/// ++/// Returns bool which indicates whether this was the last refund retry or not ++pub async fn retry_refund_sync_task( ++ db: &dyn db::StorageInterface, ++ connector: String, ++ merchant_id: common_utils::id_type::MerchantId, ++ pt: storage::ProcessTracker, ++) -> Result { ++ let schedule_time = ++ get_refund_sync_process_schedule_time(db, &connector, &merchant_id, pt.retry_count + 1) ++ .await?; ++ ++ match schedule_time { ++ Some(s_time) => { ++ db.as_scheduler().retry_process(pt, s_time).await?; ++ Ok(false) ++ } ++ None => { ++ db.as_scheduler() ++ .finish_process_with_business_status(pt, business_status::RETRIES_EXCEEDED) ++ .await?; ++ Ok(true) ++ } ++ } ++} ++ + #[instrument(skip_all)] + pub async fn start_refund_workflow( + state: &SessionState, +@@ -1614,7 +1642,12 @@ pub async fn add_refund_sync_task( + ) -> RouterResult { + let task = "SYNC_REFUND"; + let process_tracker_id = format!("{runner}_{task}_{}", refund.internal_reference_id); +- let schedule_time = common_utils::date_time::now(); ++ let schedule_time = ++ get_refund_sync_process_schedule_time(db, &refund.connector, &refund.merchant_id, 0) ++ .await ++ .change_context(errors::ApiErrorResponse::InternalServerError) ++ .attach_printable("Failed to fetch schedule time for refund sync process")? ++ .unwrap_or_else(common_utils::date_time::now); + let refund_workflow_tracking_data = refund_to_refund_core_workflow_model(refund); + let tag = ["REFUND"]; + let process_tracker_entry = storage::ProcessTrackerNew::new( +@@ -1688,15 +1721,20 @@ pub async fn get_refund_sync_process_schedule_time( + merchant_id: &common_utils::id_type::MerchantId, + retry_count: i32, + ) -> Result, errors::ProcessTrackerError> { +- let redis_mapping: errors::CustomResult = +- db::get_and_deserialize_key( +- db, +- &format!("pt_mapping_refund_sync_{connector}"), +- "ConnectorPTMapping", +- ) +- .await; +- +- let mapping = match redis_mapping { ++ let mapping: common_utils::errors::CustomResult< ++ process_data::ConnectorPTMapping, ++ errors::StorageError, ++ > = db ++ .find_config_by_key(&format!("pt_mapping_refund_sync_{connector}")) ++ .await ++ .map(|value| value.config) ++ .and_then(|config| { ++ config ++ .parse_struct("ConnectorPTMapping") ++ .change_context(errors::StorageError::DeserializationFailed) ++ }); ++ ++ let mapping = match mapping { + Ok(x) => x, + Err(err) => { + logger::error!("Error: while getting connector mapping: {err:?}"); +@@ -1704,8 +1742,7 @@ pub async fn get_refund_sync_process_schedule_time( + } + }; + +- let time_delta = +- process_tracker_utils::get_schedule_time(mapping, merchant_id, retry_count + 1); ++ let time_delta = process_tracker_utils::get_schedule_time(mapping, merchant_id, retry_count); + + Ok(process_tracker_utils::get_time_from_delta(time_delta)) + } + +----- END CHUNK ----- \ No newline at end of file diff --git a/raw/eb/ebfaba872ad77bdfc50755ce830a6a8de5a231ce.txt b/raw/eb/ebfaba872ad77bdfc50755ce830a6a8de5a231ce.txt new file mode 100644 index 0000000000000000000000000000000000000000..f9db30db6e046602e7ad74bc67d8b342458f5b0c --- /dev/null +++ b/raw/eb/ebfaba872ad77bdfc50755ce830a6a8de5a231ce.txt @@ -0,0 +1,148 @@ +ROUTE: juspay/hyperswitch@ebfaba872ad77bdfc50755ce830a6a8de5a231ce +REPO: https://github.com/juspay/hyperswitch +COMMIT: ebfaba872ad77bdfc50755ce830a6a8de5a231ce +AUTHOR: Hrithikesh <61539176+hrithikesh026@users.noreply.github.com> +DATE: 2025-08-21T13:58:40 + +=== ISSUE_AND_PR === +[PR #8940] chore: include missing drop null constraint queries in v2_compatible_migrations +URL: https://github.com/juspay/hyperswitch/pull/8940 +BODY: +## Type of Change + + +- [ ] Bugfix +- [ ] New feature +- [ ] Enhancement +- [x] Refactoring +- [ ] Dependency updates +- [ ] Documentation +- [ ] CI/CD + +## Description + +Two drop null constraint queries were missing in v2_compatible_migrations directory. Added those. +1. Dropping not null on confirm column in payment_attempt. +2. Dropping not null on internal_reference_id in refunds. + + +### Additional Changes + +- [ ] This PR modifies the API contract +- [ ] This PR modifies the database schema +- [ ] This PR modifies application configuration/environment variables + + + + +## Motivation and Context + + + +## How did you test it? + +Manual. + +Ran just `migrate_v2_compatible` and then `just migrate_v2` +image + + +## Checklist + + +- [x] I formatted the code `cargo +nightly fmt --all` +- [x] I addressed lints thrown by `cargo clippy` +- [x] I reviewed the submitted code +- [ ] I added unit tests for my changes where possible +COMMENTS: +- semanticdiff-com[bot]: Review changes with  SemanticDiff + +=== COMMIT === +SUBJECT: chore: include missing drop null constraint queries in v2_compatible_migrations (#8940) + +=== FILES === +Summary: 3 files changed, +13 -1 +- .github/CODEOWNERS (+1 -0) +- v2_compatible_migrations/2024-08-28-081757_drop_not_null_constraints_on_v1_columns/down.sql (+6 -1) +- v2_compatible_migrations/2024-08-28-081757_drop_not_null_constraints_on_v1_columns/up.sql (+6 -0) + +=== PATCH === +diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS +index a2fe05e7..1be5059f 100644 +--- a/.github/CODEOWNERS ++++ b/.github/CODEOWNERS +@@ -19,6 +19,7 @@ crates/router/src/db/ @juspay/hyperswitch-framework + crates/router/src/routes/ @juspay/hyperswitch-framework + migrations/ @juspay/hyperswitch-framework + v2_migrations/ @juspay/hyperswitch-framework ++v2_compatible_migrations/ @juspay/hyperswitch-framework + api-reference/ @juspay/hyperswitch-framework + Cargo.toml @juspay/hyperswitch-framework + Cargo.lock @juspay/hyperswitch-framework +diff --git a/v2_compatible_migrations/2024-08-28-081757_drop_not_null_constraints_on_v1_columns/down.sql b/v2_compatible_migrations/2024-08-28-081757_drop_not_null_constraints_on_v1_columns/down.sql +index 819ba22b..527adaf5 100644 +--- a/v2_compatible_migrations/2024-08-28-081757_drop_not_null_constraints_on_v1_columns/down.sql ++++ b/v2_compatible_migrations/2024-08-28-081757_drop_not_null_constraints_on_v1_columns/down.sql +@@ -43,6 +43,9 @@ ALTER TABLE payment_attempt + ADD PRIMARY KEY (attempt_id, merchant_id), + ALTER COLUMN amount SET NOT NULL; + ++ALTER TABLE payment_attempt ++ ALTER COLUMN confirm SET NOT NULL; ++ + ---------------------- Payment Methods ---------------------- + DROP INDEX IF EXISTS idx_payment_methods_payment_method_id; + ALTER TABLE payment_methods +@@ -51,4 +54,6 @@ ALTER TABLE payment_methods + ---------------------- Refunds ---------------------- + DROP INDEX IF EXISTS idx_refund_refund_id_merchant_id; + ALTER TABLE refund +- ADD PRIMARY KEY (refund_id,merchant_id); +\ No newline at end of file ++ ADD PRIMARY KEY (refund_id,merchant_id); ++ALTER TABLE refund ++ ALTER COLUMN internal_reference_id SET NOT NULL; +\ No newline at end of file +diff --git a/v2_compatible_migrations/2024-08-28-081757_drop_not_null_constraints_on_v1_columns/up.sql b/v2_compatible_migrations/2024-08-28-081757_drop_not_null_constraints_on_v1_columns/up.sql +index 199609d3..965c6fd9 100644 +--- a/v2_compatible_migrations/2024-08-28-081757_drop_not_null_constraints_on_v1_columns/up.sql ++++ b/v2_compatible_migrations/2024-08-28-081757_drop_not_null_constraints_on_v1_columns/up.sql +@@ -58,6 +58,9 @@ ALTER TABLE payment_attempt + -- This is done to nullify the effects of dropping primary key for v1 + CREATE INDEX idx_payment_attempt_attempt_id_merchant_id ON payment_attempt (attempt_id, merchant_id); + ++ALTER TABLE payment_attempt ++ ALTER COLUMN confirm DROP NOT NULL; ++ + ---------------------- Payment Methods ---------------------- + ALTER TABLE payment_methods + DROP CONSTRAINT payment_methods_pkey, +@@ -69,5 +72,8 @@ CREATE INDEX idx_payment_methods_payment_method_id ON payment_methods (payment_m + ALTER TABLE refund + DROP CONSTRAINT refund_pkey, + ALTER COLUMN refund_id DROP NOT NULL; ++ ++ALTER TABLE refund ++ ALTER COLUMN internal_reference_id DROP NOT NULL; + -- This is done to nullify the effects of dropping primary key for v1 + CREATE INDEX idx_refund_refund_id_merchant_id ON refund (refund_id, merchant_id); +\ No newline at end of file + +----- END CHUNK ----- \ No newline at end of file diff --git a/raw/f5/f5db00352b90e99e78b631fa8b9cde5800093a9d.txt b/raw/f5/f5db00352b90e99e78b631fa8b9cde5800093a9d.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8e48bec09b55cd777188620fb2896c35b4a6d8a --- /dev/null +++ b/raw/f5/f5db00352b90e99e78b631fa8b9cde5800093a9d.txt @@ -0,0 +1,55 @@ +ROUTE: juspay/hyperswitch@f5db00352b90e99e78b631fa8b9cde5800093a9d +REPO: https://github.com/juspay/hyperswitch +COMMIT: f5db00352b90e99e78b631fa8b9cde5800093a9d +AUTHOR: github-actions <41898282+github-actions[bot]@users.noreply.github.com> +DATE: 2025-08-25T00:32:21 + +=== COMMIT === +SUBJECT: chore(version): 2025.08.25.0 + +=== FILES === +Summary: 1 files changed, +28 -0 +- CHANGELOG.md (+28 -0) + +=== PATCH === +diff --git a/CHANGELOG.md b/CHANGELOG.md +index 02297e40..d23f1141 100644 +--- a/CHANGELOG.md ++++ b/CHANGELOG.md +@@ -4,6 +4,34 @@ All notable changes to HyperSwitch will be documented here. + + - - - + ++## 2025.08.25.0 ++ ++### Features ++ ++- **connector:** ++ - [BHN] Add BHN GiftCard Flow( Alpha) ([#8701](https://github.com/juspay/hyperswitch/pull/8701)) ([`cb34ec5`](https://github.com/juspay/hyperswitch/commit/cb34ec51e0f2b4ba071602f5fe974429de542b80)) ++ - [AFFIRM] BNPL flow added (Alpha) ([#8795](https://github.com/juspay/hyperswitch/pull/8795)) ([`ad247b7`](https://github.com/juspay/hyperswitch/commit/ad247b7663e46e9e53c0c7011f1a3acee1ebe36c)) ++- **core:** Add network_transaction_id in payments Response ([#9032](https://github.com/juspay/hyperswitch/pull/9032)) ([`7047c3f`](https://github.com/juspay/hyperswitch/commit/7047c3faa1e71c7ad13592cd41b77be3cdc1a8a2)) ++- **nuvei:** Googlepay , applepay and partial authorization integration for nuvei ([#8985](https://github.com/juspay/hyperswitch/pull/8985)) ([`049e6b5`](https://github.com/juspay/hyperswitch/commit/049e6b572d88d141fccf09e12854988daf146e67)) ++- **payment_methods:** Add payment-methods/filter endpoint to list countries and currencies for connector payment method in v2 ([#8978](https://github.com/juspay/hyperswitch/pull/8978)) ([`6016377`](https://github.com/juspay/hyperswitch/commit/6016377ad8e424c58bb91af5c145741ba84e059f)) ++- **router:** ++ - Verify service for applepay merchant registration v2 ([#8999](https://github.com/juspay/hyperswitch/pull/8999)) ([`0ba5d54`](https://github.com/juspay/hyperswitch/commit/0ba5d543496de040f637c5bf8d2529667d25e8a5)) ++ - Add support to use signature_network and is_issuer_regulated as filters ([#9033](https://github.com/juspay/hyperswitch/pull/9033)) ([`ad05dc4`](https://github.com/juspay/hyperswitch/commit/ad05dc4176114dad3420a78af238d3842160e464)) ++ ++### Bug Fixes ++ ++- **connectors:** [worldpayvantiv] map cnp_txn_id to connector_txn_id and enforce max length for customer_id and connector_request_reference_id ([#9031](https://github.com/juspay/hyperswitch/pull/9031)) ([`b1486f8`](https://github.com/juspay/hyperswitch/commit/b1486f8bd31dbe741ac01f36053bc4a2f3eaaa78)) ++- **redis:** Add support for fetching multiple keys for redis cluster ([#9019](https://github.com/juspay/hyperswitch/pull/9019)) ([`cc44831`](https://github.com/juspay/hyperswitch/commit/cc44831c51893805d76afc284107597a9dcd9963)) ++ ++### Refactors ++ ++- **core:** Refund sync process scheduled time ([#8930](https://github.com/juspay/hyperswitch/pull/8930)) ([`e9a8187`](https://github.com/juspay/hyperswitch/commit/e9a8187dfdc74a5b555140afd5b7ec05491f06ed)) ++- **user_roles:** Implement parent group info based role APIs ([#8896](https://github.com/juspay/hyperswitch/pull/8896)) ([`e3c46b7`](https://github.com/juspay/hyperswitch/commit/e3c46b7de71d619b84beb2dba36b6f62a570d45f)) ++ ++**Full Changelog:** [`2025.08.22.0...2025.08.25.0`](https://github.com/juspay/hyperswitch/compare/2025.08.22.0...2025.08.25.0) ++ ++- - - ++ + ## 2025.08.22.0 + + ### Features + +----- END CHUNK ----- \ No newline at end of file