Skip to content

Commit 8dce1ae

Browse files
committed
Update example
1 parent 3fccf0b commit 8dce1ae

File tree

1 file changed

+56
-68
lines changed

1 file changed

+56
-68
lines changed

README.md

Lines changed: 56 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,13 @@ import openapi_client
6262
- `xApiKey` (API Key)
6363
- `xAppKey` (App Key)
6464

65-
<<<<<<< Updated upstream
6665
2. **Determine Your Origin:**
6766
The `origin` is your public IP address.
6867
Find it by searching **"what's my IP"** in Google or visiting [https://www.whatsmyip.org](https://www.whatsmyip.org).
6968
1. Contact AndDone support to ensure your origin IP is resitered for use with our secure APIs
7069
2. support@anddone.com
7170

72-
3. **Create a Configuration File:**
71+
3. **Optional: Create a Configuration File:**
7372
Rename `config.example.json` to `config.json` and fill it with your values:
7473

7574
```json
@@ -88,88 +87,77 @@ import openapi_client
8887
Here’s a minimal working example to call the **Secure Create Payment Intent API**:
8988

9089
```python
91-
import json
92-
import openapi_client
90+
9391
from openapi_client.api.secure_payment_intent_api import SecurePaymentIntentApi
94-
from openapi_client.model.payment_intent_request import PaymentIntentRequest
95-
from openapi_client.rest import ApiException
96-
=======
97-
Please follow the [installation procedure](#installation--usage) and then run the following:
9892

99-
```python
93+
x_api_key = 'YOUR_API_KEY'
94+
x_app_key = 'YOUR_APP_KEY'
95+
x_version = '2.3'
96+
origin = 'YOUR_ORIGIN'
97+
98+
99+
post_body = {
100+
"saveForFuture": True,
101+
"amount": 10000,
102+
"title": "YOUR UNIQUE TITLE",
103+
"shortDescription": "shortDescription",
104+
"paymentDescription": "paymentDescription",
105+
"invoiceNumber": "postman",
106+
"expiresIn": "300000",
107+
"intent": {
108+
"paymentTypes": [
109+
"CreditCard",
110+
"ACH"
111+
]
112+
},
113+
"enablePremiumFinance": True,
114+
"splits": None,
115+
"additionalDetailsPreference": "NoAdditionalDetails"
116+
}
117+
118+
api_instance = SecurePaymentIntentApi()
119+
response = api_instance.secure_paymentintents_post(
120+
x_api_key, x_app_key, x_version, origin, post_body
121+
)
122+
print(response)
100123

101-
import openapi_client
102-
from openapi_client.rest import ApiException
103-
from pprint import pprint
104-
>>>>>>> Stashed changes
124+
125+
```
105126

106-
# Load credentials from config.json
107-
with open("config.json") as f:
108-
config = json.load(f)
127+
## Alternate approach (Using optional config.json)
109128

110-
<<<<<<< Updated upstream
111-
# Configure API client
112-
configuration = openapi_client.Configuration(host="https://api.uat.anddone.com")
113-
configuration.debug = True # Optional: Enable debug logging
129+
Here is a more involved installation utilizing the openapi Configuration model.
114130

115-
# Call API
116-
with openapi_client.ApiClient(configuration) as api_client:
117-
118-
post_body = {
119-
"additionalDetailsPreference": "ManualEnter",
120-
"amount": 700,
121-
"title": "TitleName",
122-
"intent": {
123-
"paymentTypes": [
124-
"CreditCard",
125-
"ACH",
126-
"DebitCard"
127-
]
128-
}
129-
}
130-
131-
api = SecurePaymentIntentApi(api_client)
132-
=======
133-
# The client must configure the authentication and authorization parameters
134-
# in accordance with the API server security policy.
135-
# Examples for each auth method are provided below, use the example that
136-
# satisfies your auth use case.
137-
138-
# Configure API key authorization: x-api-key
139-
configuration.api_key['x-api-key'] = os.environ["API_KEY"]
140-
141-
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
142-
# configuration.api_key_prefix['x-api-key'] = 'Bearer'
143-
144-
# Configure API key authorization: x-app-key
145-
configuration.api_key['x-app-key'] = os.environ["API_KEY"]
146-
147-
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
148-
# configuration.api_key_prefix['x-app-key'] = 'Bearer'
131+
```python
132+
import json
133+
from openapi_client.rest import ApiException
134+
from openapi_client.api.secure_payment_intent_api import SecurePaymentIntentApi
135+
from pprint import pprint
149136

137+
# Defining the host is optional and defaults to https://api.uat.anddone.com
138+
# See configuration.py for a list of all supported configuration parameters.
139+
configuration = openapi_client.Configuration(
140+
host = "https://api.uat.anddone.com"
141+
)
150142

151143
# Enter a context with an instance of the API client
152144
with openapi_client.ApiClient(configuration) as api_client:
153145
# Create an instance of the API class
154146
api_instance = openapi_client.SecureEmbeddedPremiumFinanceApi(api_client)
155-
x_api_key = 'x_api_key_example' # str | an authorization header
156-
x_app_key = 'x_app_key_example' # str | an authorization header
157-
x_version = 'x_version_example' # str | x-version
158-
origin = 'origin_example' # str | origin
147+
# Load credentials from config.json
148+
with open('config.json') as f:
149+
config = json.load(f)
150+
159151
pf_policy_update_request_dto = openapi_client.PFPolicyUpdateRequestDTO() # PFPolicyUpdateRequestDTO | Signature Request details (optional)
160-
>>>>>>> Stashed changes
161152

162153
try:
163-
response = api.secure_paymentintents_post(
164-
x_api_key=config["xApiKey"],
165-
x_app_key=config["xAppKey"],
166-
x_version=config["xVersion"],
167-
origin=config["origin"],
168-
post_body
169-
)
170-
print(response)
154+
# This API is will update the policy number
155+
api_response = api_instance.secure_epf_merchants_quotes_policy_put(config['xApiKey'], config['xAppKey'], config['xVersion'], config['origin'], pf_policy_update_request_dto=pf_policy_update_request_dto)
156+
print("The response of SecureEmbeddedPremiumFinanceApi->secure_epf_merchants_quotes_policy_put:\n")
157+
pprint(api_response)
171158
except ApiException as e:
172-
print(f"API Exception: {e}")
159+
print("Exception when calling SecureEmbeddedPremiumFinanceApi->secure_epf_merchants_quotes_policy_put: %s\n" % e)
160+
173161
```
174162

175163
---

0 commit comments

Comments
 (0)