cashfree-pg 4.2.2 → 4.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/common.ts CHANGED
@@ -18,7 +18,7 @@ import type { RequestArgs } from "./base";
18
18
  import { CFEnvironment } from './configuration';
19
19
  import type { AxiosInstance, AxiosResponse } from 'axios';
20
20
  import { RequiredError } from "./base";
21
- import { Cashfree } from "./api";
21
+ import { Cashfree, CashfreeConfiguration } from "./api";
22
22
 
23
23
  /**
24
24
  *
@@ -68,6 +68,38 @@ export const setApiKeyToObject = async function (object: any, keyParamName: stri
68
68
  }
69
69
  }
70
70
 
71
+ /**
72
+ *
73
+ * @export
74
+ */
75
+ export const setApiKeyToObjectWithConfiguration = async function (object: any, keyParamName: string, cashfreeConfiguration: CashfreeConfiguration) {
76
+ if(keyParamName == "x-client-id") {
77
+ if(cashfreeConfiguration.XClientId != null && cashfreeConfiguration.XClientId != undefined) {
78
+ object[keyParamName] = cashfreeConfiguration.XClientId;
79
+ }
80
+ }
81
+ if(keyParamName == "x-client-secret") {
82
+ if(cashfreeConfiguration.XClientSecret != null && cashfreeConfiguration.XClientSecret != undefined) {
83
+ object[keyParamName] = cashfreeConfiguration.XClientSecret;
84
+ }
85
+ }
86
+ if(keyParamName == "x-partner-apikey") {
87
+ if(cashfreeConfiguration.XPartnerKey != null && cashfreeConfiguration.XPartnerKey != undefined) {
88
+ object[keyParamName] = cashfreeConfiguration.XPartnerKey;
89
+ }
90
+ }
91
+ if(keyParamName == "x-partner-merchantid") {
92
+ if(cashfreeConfiguration.XPartnerMerchantId != null && cashfreeConfiguration.XPartnerMerchantId != undefined) {
93
+ object[keyParamName] = cashfreeConfiguration.XPartnerMerchantId;
94
+ }
95
+ }
96
+ if(keyParamName == "x-client-signature") {
97
+ if(cashfreeConfiguration.XClientSignature != null && cashfreeConfiguration.XClientSignature != undefined) {
98
+ object[keyParamName] = cashfreeConfiguration.XClientSignature;
99
+ }
100
+ }
101
+ }
102
+
71
103
  /**
72
104
  *
73
105
  * @export