Skip to content

Commit

Permalink
Bump SDK version to 0.6.0; Resolve name changes related to bump (#165)
Browse files Browse the repository at this point in the history
  • Loading branch information
LeonarthusMectus authored Oct 30, 2024
1 parent 843672d commit 546fc07
Show file tree
Hide file tree
Showing 24 changed files with 96 additions and 86 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="7.0.9" />
<PackageReference Include="PayPalServerSDK" Version="0.5.3" />
<PackageReference Include="PayPalServerSDK" Version="0.6.0" />
</ItemGroup>
</Project>
</Project>
14 changes: 7 additions & 7 deletions advanced-integration/v2/server/dotnet/Server.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using PaypalServerSDK.Standard;
using PaypalServerSDK.Standard.Authentication;
using PaypalServerSDK.Standard.Controllers;
using PaypalServerSDK.Standard.Http.Response;
using PaypalServerSDK.Standard.Models;
using PaypalServerSdk.Standard;
using PaypalServerSdk.Standard.Authentication;
using PaypalServerSdk.Standard.Controllers;
using PaypalServerSdk.Standard.Http.Response;
using PaypalServerSdk.Standard.Models;
using IConfiguration = Microsoft.Extensions.Configuration.IConfiguration;

namespace PayPalAdvancedIntegration;
Expand Down Expand Up @@ -79,8 +79,8 @@ public CheckoutController(IConfiguration configuration, ILogger<CheckoutControll
_logger = logger;

// Initialize the PayPal SDK client
PaypalServerSDKClient client = new PaypalServerSDKClient.Builder()
.Environment(PaypalServerSDK.Standard.Environment.Sandbox)
PaypalServerSdkClient client = new PaypalServerSdkClient.Builder()
.Environment(PaypalServerSdk.Standard.Environment.Sandbox)
.ClientCredentialsAuth(
new ClientCredentialsAuthModel.Builder(_paypalClientId, _paypalClientSecret).Build()
)
Expand Down
2 changes: 1 addition & 1 deletion advanced-integration/v2/server/java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
paypal-server-sdk
</artifactId>
<version>
0.5.1
0.6.0
</version>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import org.springframework.web.client.RestTemplate;

import com.paypal.sdk.Environment;
import com.paypal.sdk.PaypalServerSDKClient;
import com.paypal.sdk.PaypalServerSdkClient;
import com.paypal.sdk.authentication.ClientCredentialsAuthModel;
import com.paypal.sdk.controllers.OrdersController;
import com.paypal.sdk.exceptions.ApiException;
Expand Down Expand Up @@ -53,8 +53,8 @@ public RestTemplate restTemplate() {
}

@Bean
public PaypalServerSDKClient paypalClient() {
return new PaypalServerSDKClient.Builder()
public PaypalServerSdkClient paypalClient() {
return new PaypalServerSdkClient.Builder()
.loggingConfig(builder -> builder
.level(Level.DEBUG)
.requestConfig(logConfigBuilder -> logConfigBuilder.body(true))
Expand All @@ -75,9 +75,9 @@ public PaypalServerSDKClient paypalClient() {
public class CheckoutController {

private final ObjectMapper objectMapper;
private final PaypalServerSDKClient client;
private final PaypalServerSdkClient client;

public CheckoutController(ObjectMapper objectMapper, PaypalServerSDKClient client) {
public CheckoutController(ObjectMapper objectMapper, PaypalServerSdkClient client) {
this.objectMapper = objectMapper;
this.client = client;
}
Expand Down
2 changes: 1 addition & 1 deletion advanced-integration/v2/server/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"type": "module",
"dependencies": {
"@paypal/paypal-server-sdk": "^0.5.1",
"@paypal/paypal-server-sdk": "^0.6.0",
"body-parser": "^1.20.3",
"dotenv": "^16.3.1",
"express": "^4.18.2"
Expand Down
12 changes: 7 additions & 5 deletions advanced-integration/v2/server/node/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const ordersController = new OrdersController(client);
const createOrder = async (cart) => {
const collect = {
body: {
intent: CheckoutPaymentIntent.CAPTURE,
intent: CheckoutPaymentIntent.Capture,
purchaseUnits: [
{
amount: {
Expand All @@ -56,8 +56,9 @@ const createOrder = async (cart) => {
};

try {
const { body, ...httpResponse } =
await ordersController.ordersCreate(collect);
const { body, ...httpResponse } = await ordersController.ordersCreate(
collect
);
// Get more response info...
// const { statusCode, headers } = httpResponse;
return {
Expand All @@ -83,8 +84,9 @@ const captureOrder = async (orderID) => {
};

try {
const { body, ...httpResponse } =
await ordersController.ordersCapture(collect);
const { body, ...httpResponse } = await ordersController.ordersCapture(
collect
);
// Get more response info...
// const { statusCode, headers } = httpResponse;
return {
Expand Down
7 changes: 5 additions & 2 deletions advanced-integration/v2/server/php/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@
"require": {
"php": "^7.4 || ^8.0",
"ext-json": "*",
"paypal/paypal-server-sdk": "0.5.1"
"paypal/paypal-server-sdk": "0.6.0"
},
"require-dev": {
},
"scripts": {
"start": "php -S localhost:8080 -t src"
"start": [
"Composer\\Config::disableProcessTimeout",
"php -S localhost:8080 -t src"
]
},
"config": {
}
Expand Down
16 changes: 8 additions & 8 deletions advanced-integration/v2/server/php/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions advanced-integration/v2/server/php/src/index.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<?php
require __DIR__ . '/../vendor/autoload.php';

use PaypalServerSDKLib\Authentication\ClientCredentialsAuthCredentialsBuilder;
use PaypalServerSDKLib\Environment;
use PaypalServerSDKLib\PaypalServerSDKClientBuilder;
use PaypalServerSDKLib\Models\Builders\OrderRequestBuilder;
use PaypalServerSDKLib\Models\CheckoutPaymentIntent;
use PaypalServerSDKLib\Models\Builders\PurchaseUnitRequestBuilder;
use PaypalServerSDKLib\Models\Builders\AmountWithBreakdownBuilder;
use PaypalServerSdkLib\Authentication\ClientCredentialsAuthCredentialsBuilder;
use PaypalServerSdkLib\Environment;
use PaypalServerSdkLib\PaypalServerSdkClientBuilder;
use PaypalServerSdkLib\Models\Builders\OrderRequestBuilder;
use PaypalServerSdkLib\Models\CheckoutPaymentIntent;
use PaypalServerSdkLib\Models\Builders\PurchaseUnitRequestBuilder;
use PaypalServerSdkLib\Models\Builders\AmountWithBreakdownBuilder;

$PAYPAL_CLIENT_ID = getenv('PAYPAL_CLIENT_ID');
$PAYPAL_CLIENT_SECRET = getenv('PAYPAL_CLIENT_SECRET');

$client = PaypalServerSDKClientBuilder::init()
$client = PaypalServerSdkClientBuilder::init()
->clientCredentialsAuthCredentials(
ClientCredentialsAuthCredentialsBuilder::init(
$PAYPAL_CLIENT_ID,
Expand Down
2 changes: 1 addition & 1 deletion advanced-integration/v2/server/python/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Flask==3.0.3
paypal-server-sdk==0.5.2
paypal-server-sdk==0.6.0
4 changes: 2 additions & 2 deletions advanced-integration/v2/server/python/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from paypalserversdk.http.auth.o_auth_2 import ClientCredentialsAuthCredentials
from paypalserversdk.logging.configuration.api_logging_configuration import LoggingConfiguration, \
RequestLoggingConfiguration, ResponseLoggingConfiguration
from paypalserversdk.paypalserversdk_client import PaypalserversdkClient
from paypalserversdk.paypal_serversdk_client import PaypalServersdkClient
from paypalserversdk.controllers.orders_controller import OrdersController
from paypalserversdk.models.amount_with_breakdown import AmountWithBreakdown
from paypalserversdk.models.checkout_payment_intent import CheckoutPaymentIntent
Expand All @@ -15,7 +15,7 @@

app = Flask(__name__)

paypal_client: PaypalserversdkClient = PaypalserversdkClient(
paypal_client: PaypalServersdkClient = PaypalServersdkClient(
client_credentials_auth_credentials=ClientCredentialsAuthCredentials(
o_auth_client_id=os.getenv('PAYPAL_CLIENT_ID'),
o_auth_client_secret=os.getenv('PAYPAL_CLIENT_SECRET')
Expand Down
2 changes: 1 addition & 1 deletion advanced-integration/v2/server/ruby/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

source "https://rubygems.org"

gem "paypal-server-sdk", "~> 0.5.2"
gem "paypal-server-sdk", "~> 0.6.0"
gem "puma", "~> 6.4"
gem "rackup", "~> 2.1"
gem "sinatra", "~> 4.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="7.0.9" />
<PackageReference Include="PayPalServerSDK" Version="0.5.3" />
<PackageReference Include="PayPalServerSDK" Version="0.6.0" />
</ItemGroup>
</Project>
</Project>
14 changes: 7 additions & 7 deletions standard-integration/server/dotnet/Server.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using PaypalServerSDK.Standard;
using PaypalServerSDK.Standard.Authentication;
using PaypalServerSDK.Standard.Controllers;
using PaypalServerSDK.Standard.Http.Response;
using PaypalServerSDK.Standard.Models;
using PaypalServerSdk.Standard;
using PaypalServerSdk.Standard.Authentication;
using PaypalServerSdk.Standard.Controllers;
using PaypalServerSdk.Standard.Http.Response;
using PaypalServerSdk.Standard.Models;
using IConfiguration = Microsoft.Extensions.Configuration.IConfiguration;

namespace PayPalAdvancedIntegration;
Expand Down Expand Up @@ -79,8 +79,8 @@ public CheckoutController(IConfiguration configuration, ILogger<CheckoutControll
_logger = logger;

// Initialize the PayPal SDK client
PaypalServerSDKClient client = new PaypalServerSDKClient.Builder()
.Environment(PaypalServerSDK.Standard.Environment.Sandbox)
PaypalServerSdkClient client = new PaypalServerSdkClient.Builder()
.Environment(PaypalServerSdk.Standard.Environment.Sandbox)
.ClientCredentialsAuth(
new ClientCredentialsAuthModel.Builder(_paypalClientId, _paypalClientSecret).Build()
)
Expand Down
2 changes: 1 addition & 1 deletion standard-integration/server/java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
paypal-server-sdk
</artifactId>
<version>
0.5.1
0.6.0
</version>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import org.springframework.web.client.RestTemplate;

import com.paypal.sdk.Environment;
import com.paypal.sdk.PaypalServerSDKClient;
import com.paypal.sdk.PaypalServerSdkClient;
import com.paypal.sdk.authentication.ClientCredentialsAuthModel;
import com.paypal.sdk.controllers.OrdersController;
import com.paypal.sdk.exceptions.ApiException;
Expand Down Expand Up @@ -53,8 +53,8 @@ public RestTemplate restTemplate() {
}

@Bean
public PaypalServerSDKClient paypalClient() {
return new PaypalServerSDKClient.Builder()
public PaypalServerSdkClient paypalClient() {
return new PaypalServerSdkClient.Builder()
.loggingConfig(builder -> builder
.level(Level.DEBUG)
.requestConfig(logConfigBuilder -> logConfigBuilder.body(true))
Expand All @@ -75,9 +75,9 @@ public PaypalServerSDKClient paypalClient() {
public class CheckoutController {

private final ObjectMapper objectMapper;
private final PaypalServerSDKClient client;
private final PaypalServerSdkClient client;

public CheckoutController(ObjectMapper objectMapper, PaypalServerSDKClient client) {
public CheckoutController(ObjectMapper objectMapper, PaypalServerSdkClient client) {
this.objectMapper = objectMapper;
this.client = client;
}
Expand Down
2 changes: 1 addition & 1 deletion standard-integration/server/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"type": "module",
"dependencies": {
"@paypal/paypal-server-sdk": "^0.5.1",
"@paypal/paypal-server-sdk": "^0.6.0",
"body-parser": "^1.20.3",
"dotenv": "^16.3.1",
"express": "^4.18.2"
Expand Down
12 changes: 7 additions & 5 deletions standard-integration/server/node/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const ordersController = new OrdersController(client);
const createOrder = async (cart) => {
const collect = {
body: {
intent: CheckoutPaymentIntent.CAPTURE,
intent: CheckoutPaymentIntent.Capture,
purchaseUnits: [
{
amount: {
Expand All @@ -56,8 +56,9 @@ const createOrder = async (cart) => {
};

try {
const { body, ...httpResponse } =
await ordersController.ordersCreate(collect);
const { body, ...httpResponse } = await ordersController.ordersCreate(
collect
);
// Get more response info...
// const { statusCode, headers } = httpResponse;
return {
Expand All @@ -83,8 +84,9 @@ const captureOrder = async (orderID) => {
};

try {
const { body, ...httpResponse } =
await ordersController.ordersCapture(collect);
const { body, ...httpResponse } = await ordersController.ordersCapture(
collect
);
// Get more response info...
// const { statusCode, headers } = httpResponse;
return {
Expand Down
7 changes: 5 additions & 2 deletions standard-integration/server/php/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@
"require": {
"php": "^7.4 || ^8.0",
"ext-json": "*",
"paypal/paypal-server-sdk": "0.5.1"
"paypal/paypal-server-sdk": "0.6.0"
},
"require-dev": {
},
"scripts": {
"start": "php -S localhost:8080 -t src"
"start": [
"Composer\\Config::disableProcessTimeout",
"php -S localhost:8080 -t src"
]
},
"config": {
}
Expand Down
Loading

0 comments on commit 546fc07

Please sign in to comment.