Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config proxy server option #69

Merged
merged 18 commits into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,23 @@ jobs:
java-version: ${{ matrix.java }}
distribution: 'temurin'
cache: maven
- uses: nyurik/action-setup-nginx@v1
id: nginx
with:
conf-file-text: |
events {}
http {
server {
listen 80;
location / {
proxy_pass http://localhost:3000;
proxy_set_header Host \$host;
proxy_set_header X-Real-IP \$remote_addr;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto \$scheme;
}
}
}
- name: Run Mockoon CLI
uses: mockoon/cli-action@v2
with:
Expand All @@ -36,3 +53,4 @@ jobs:
run: mvn -B package --no-transfer-progress --file pom.xml
env:
BASE_PATH: http://localhost:3000
PROXY_URI: http://localhost:80
4 changes: 4 additions & 0 deletions .openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,11 @@ docs/PaymentMethodCardResponse.md
docs/PaymentMethodCash.md
docs/PaymentMethodCashRequest.md
docs/PaymentMethodCashResponse.md
docs/PaymentMethodGeneralRequest.md
docs/PaymentMethodResponse.md
docs/PaymentMethodSpeiRecurrent.md
docs/PaymentMethodSpeiRequest.md
docs/PaymentMethodTokenRequest.md
docs/PaymentMethodsApi.md
docs/Payout.md
docs/PayoutMethod.md
Expand Down Expand Up @@ -361,9 +363,11 @@ src/main/java/com/conekta/model/PaymentMethodCardResponse.java
src/main/java/com/conekta/model/PaymentMethodCash.java
src/main/java/com/conekta/model/PaymentMethodCashRequest.java
src/main/java/com/conekta/model/PaymentMethodCashResponse.java
src/main/java/com/conekta/model/PaymentMethodGeneralRequest.java
src/main/java/com/conekta/model/PaymentMethodResponse.java
src/main/java/com/conekta/model/PaymentMethodSpeiRecurrent.java
src/main/java/com/conekta/model/PaymentMethodSpeiRequest.java
src/main/java/com/conekta/model/PaymentMethodTokenRequest.java
src/main/java/com/conekta/model/Payout.java
src/main/java/com/conekta/model/PayoutMethod.java
src/main/java/com/conekta/model/PayoutOrder.java
Expand Down
50 changes: 19 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Add this dependency to your project's POM:
<dependency>
<groupId>io.conekta</groupId>
<artifactId>ct-conekta-java</artifactId>
<version>6.1.1</version>
<version>6.1.2</version>
<scope>compile</scope>
</dependency>
```
Expand All @@ -57,7 +57,7 @@ Add this dependency to your project's build file:
}

dependencies {
implementation "io.conekta:ct-conekta-java:6.1.1"
implementation "io.conekta:ct-conekta-java:6.1.2"
}
```

Expand All @@ -71,45 +71,31 @@ mvn clean package

Then manually install the following JARs:

- `target/ct-conekta-java-6.1.1.jar`
- `target/ct-conekta-java-6.1.2.jar`
- `target/lib/*.jar`

## Usage

To add a HTTP proxy for the API client, use `ClientConfig`:
```java

import org.glassfish.jersey.apache.connector.ApacheConnectorProvider;
import org.glassfish.jersey.client.ClientConfig;
import org.glassfish.jersey.client.ClientProperties;
import com.conekta.*;
import com.conekta.auth.*;
import com.conekta.model.*;
import com.conekta.CustomersApi;
import com.conekta.AntifraudApi;

public class CustomersApiExample {
...

public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
ApiClient defaultClient = Configuration.getDefaultApiClient();
ClientConfig clientConfig = defaultClient.getClientConfig();
clientConfig.connectorProvider(new ApacheConnectorProvider());
clientConfig.property(ClientProperties.PROXY_URI, "http://proxy_url_here");
clientConfig.property(ClientProperties.PROXY_USERNAME, "proxy_username");
clientConfig.property(ClientProperties.PROXY_PASSWORD, "proxy_password");
defaultClient.setClientConfig(clientConfig);

// Configure HTTP bearer authorization: bearerAuth
HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth");
bearerAuth.setBearerToken("API_KEY");

CustomersApi apiInstance = new CustomersApi(defaultClient);
Customer customer = new Customer(); // Customer | requested field for customer
customer.setName("Customer Name");
customer.setEmail("[email protected]");
customer.setPhone("55454545454");
String acceptLanguage = "es"; // String | Use for knowing which language to use
try {
CustomerResponse result = apiInstance.createCustomer(customer, acceptLanguage,null);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling CustomersApi#createCustomer");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
AntifraudApi apiInstance = new AntifraudApi(defaultClient);
```

## Getting Started
Expand Down Expand Up @@ -375,9 +361,11 @@ Class | Method | HTTP request | Description
- [PaymentMethodCash](docs/PaymentMethodCash.md)
- [PaymentMethodCashRequest](docs/PaymentMethodCashRequest.md)
- [PaymentMethodCashResponse](docs/PaymentMethodCashResponse.md)
- [PaymentMethodGeneralRequest](docs/PaymentMethodGeneralRequest.md)
- [PaymentMethodResponse](docs/PaymentMethodResponse.md)
- [PaymentMethodSpeiRecurrent](docs/PaymentMethodSpeiRecurrent.md)
- [PaymentMethodSpeiRequest](docs/PaymentMethodSpeiRequest.md)
- [PaymentMethodTokenRequest](docs/PaymentMethodTokenRequest.md)
- [Payout](docs/Payout.md)
- [PayoutMethod](docs/PayoutMethod.md)
- [PayoutOrder](docs/PayoutOrder.md)
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.1.1
6.1.2
75 changes: 69 additions & 6 deletions api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13547,17 +13547,24 @@ components:
es sospechoso.
type: string
id:
description: Charge ID
example: 63efa757cf65380001aec040
type: string
livemode:
description: Whether the charge was made in live mode or not
example: false
type: boolean
object:
example: charge
type: string
order_id:
description: Order ID
example: ord_2tN73UdUSNrYRPD9r
type: string
paid_at:
description: Payment date
example: 1676390742
format: int64
nullable: true
type: integer
payment_method:
Expand Down Expand Up @@ -14918,6 +14925,7 @@ components:
description: The charges to be made
properties:
amount:
description: Amount to be charged in cents
example: 40000
type: integer
payment_method:
Expand Down Expand Up @@ -15478,7 +15486,7 @@ components:
- type
title: checkout_request
type: object
payment_method_card_request:
payment_method_token_request:
allOf:
- $ref: '#/components/schemas/customer_payment_method_request'
- properties:
Expand All @@ -15491,7 +15499,7 @@ components:
required:
- token_id
type: object
title: payment_method_card_request
title: payment_method_token_request
payment_method_cash_request:
allOf:
- $ref: '#/components/schemas/customer_payment_method_request'
Expand Down Expand Up @@ -15889,37 +15897,45 @@ components:
- description: use for card responses
properties:
account_type:
description: Account type of the card
example: Credit
type: string
auth_code:
example: "867372"
type: string
brand:
description: Brand of the card
example: visa
type: string
contract_id:
description: Id sent for recurrent charges.
example: S781317595
type: string
country:
description: Country of the card
example: MX
type: string
exp_month:
description: Expiration month of the card
example: "02"
type: string
exp_year:
example: "30"
description: Expiration year of the card
example: "2026"
type: string
fraud_indicators:
items: {}
type: array
issuer:
description: Issuer of the card
example: BANAMEX
type: string
last4:
description: Last 4 digits of the card
example: "4242"
type: string
name:
description: Name of the cardholder
example: Fulanito Perez
type: string
title: charge_data_payment_method_card_response
Expand Down Expand Up @@ -16169,6 +16185,44 @@ components:
- object
- type
type: object
payment_method_card_request:
allOf:
- $ref: '#/components/schemas/customer_payment_method_request'
- properties:
cvc:
description: Card security code
example: "198"
maxLength: 4
minLength: 3
type: string
exp_month:
description: Card expiration month
example: "12"
maxLength: 2
minLength: 2
type: string
exp_year:
description: Card expiration year
example: "2025"
maxLength: 4
minLength: 4
type: string
name:
description: Cardholder name
example: John Doe
type: string
number:
description: Card number
example: "4242424242424242"
type: string
required:
- cvc
- exp_month
- exp_year
- name
- number
type: object
title: payment_method_card_request
checkout_request:
description: |
[Checkout](https://developers.conekta.com/v2.1.0/reference/payment-link) details
Expand Down Expand Up @@ -16573,6 +16627,7 @@ components:
orderRefund_request:
properties:
amount:
description: Amount to be refunded in cents
example: 500
type: integer
expires_at:
Expand All @@ -16581,6 +16636,7 @@ components:
nullable: true
type: integer
reason:
description: Reason for the refund
example: suspected_fraud
type: string
required:
Expand Down Expand Up @@ -16655,7 +16711,7 @@ components:
description: Contains details of the payment methods that the customer has active
or has used in Conekta
oneOf:
- $ref: '#/components/schemas/payment_method_card_request'
- $ref: '#/components/schemas/payment_method_token_request'
- $ref: '#/components/schemas/payment_method_cash_request'
- $ref: '#/components/schemas/payment_method_spei_request'
create_customer_payment_methods_response:
Expand Down Expand Up @@ -17649,7 +17705,7 @@ components:
type: string
title: transfer_destination_response
type: object
charge_request_payment_method:
payment_method_general_request:
description: |
Payment method used in the charge. Go to the [payment methods](https://developers.conekta.com/reference/m%C3%A9todos-de-pago) section for more details
properties:
Expand All @@ -17664,6 +17720,7 @@ components:
format: int8
type: integer
type:
description: Type of payment method
example: card
type: string
token_id:
Expand All @@ -17679,7 +17736,13 @@ components:
type: string
required:
- type
title: payment_method_general_request
type: object
charge_request_payment_method:
oneOf:
- $ref: '#/components/schemas/payment_method_card_request'
- $ref: '#/components/schemas/payment_method_general_request'
title: charge_request_payment_method
customer_antifraud_info:
nullable: true
properties:
Expand All @@ -17694,7 +17757,7 @@ components:
type: object
customer_payment_methods_request:
oneOf:
- $ref: '#/components/schemas/payment_method_card_request'
- $ref: '#/components/schemas/payment_method_token_request'
- $ref: '#/components/schemas/payment_method_cash_request'
- $ref: '#/components/schemas/payment_method_spei_request'
title: customer_payment_methods_request
Expand Down
4 changes: 2 additions & 2 deletions config-java.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"developerOrganization": "Conekta, Inc.",
"developerOrganizationUrl": "https://www.conekta.io",
"artifactUrl": "https://developers.conekta.com/",
"artifactVersion": "6.1.1",
"artifactVersion": "6.1.2",
"modelPackage": "com.conekta.model",
"licenseName": "MIT License",
"invokerPackage": "com.conekta",
Expand Down Expand Up @@ -36,6 +36,6 @@
"disallowAdditionalPropertiesIfNotPresent": true,
"useOneOfDiscriminatorLookup": true,
"serializationLibrary": "jackson",
"httpUserAgent": "Conekta/v2 JavaBindings/6.1.1",
"httpUserAgent": "Conekta/v2 JavaBindings/6.1.2",
"openApiNullable" : false
}
7 changes: 7 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
services:
proxy_server:
restart: always
image: nginx
ports:
- 9080:80
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf
mockserver:
restart: always
image: mockoon/cli:2.4.0
Expand Down
2 changes: 1 addition & 1 deletion docs/ChargeRequest.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ The charges to be made

| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**amount** | **Integer** | | [optional] |
|**amount** | **Integer** | Amount to be charged in cents | [optional] |
|**paymentMethod** | [**ChargeRequestPaymentMethod**](ChargeRequestPaymentMethod.md) | | |
|**referenceId** | **String** | Custom reference to add to the charge | [optional] |

Expand Down
Loading
Loading