Skip to content
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
54 changes: 27 additions & 27 deletions code-samples-map.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@
"lang":"JavaScript",
"label":"SDK",
"source":{
"$ref":"./code_samples/node/v1.0.0/createPayment.js"
"$ref":"./code_samples/node/v1/createPayment.js"
}
},
{
"lang":"Python",
"label":"SDK",
"source":{
"$ref":"./code_samples/python/v1.0.0/create_payment.py"
"$ref":"./code_samples/python/v1/create_payment.py"
}
},
{
"lang":"PHP",
"label":"SDK",
"source":{
"$ref":"./code_samples/php/v2.0.0/create_payment.php"
"$ref":"./code_samples/php/v2/create_payment.php"
}
}
]
Expand All @@ -34,21 +34,21 @@
"lang":"JavaScript",
"label":"SDK",
"source":{
"$ref":"./code_samples/node/v1.0.0/getAvailablePaymentMethods.js"
"$ref":"./code_samples/node/v1/getAvailablePaymentMethods.js"
}
},
{
"lang":"Python",
"label":"SDK",
"source":{
"$ref":"./code_samples/python/v1.0.0/get_available_payment_methods.py"
"$ref":"./code_samples/python/v1/get_available_payment_methods.py"
}
},
{
"lang":"PHP",
"label":"SDK",
"source":{
"$ref":"./code_samples/php/v2.0.0/get_available_payment_methods.php"
"$ref":"./code_samples/php/v2/get_available_payment_methods.php"
}
}
]
Expand All @@ -61,21 +61,21 @@
"lang":"JavaScript",
"label":"SDK",
"source":{
"$ref":"./code_samples/node/v1.0.0/getPaymentStatus.js"
"$ref":"./code_samples/node/v1/getPaymentStatus.js"
}
},
{
"lang":"Python",
"label":"SDK",
"source":{
"$ref":"./code_samples/python/v1.0.0/get_payment_status.py"
"$ref":"./code_samples/python/v1/get_payment_status.py"
}
},
{
"lang":"PHP",
"label":"SDK",
"source":{
"$ref":"./code_samples/php/v2.0.0/get_payment_status.php"
"$ref":"./code_samples/php/v2/get_payment_status.php"
}
}
]
Expand All @@ -88,21 +88,21 @@
"lang":"JavaScript",
"label":"SDK",
"source":{
"$ref":"./code_samples/node/v1.0.0/updatePayment.js"
"$ref":"./code_samples/node/v1/updatePayment.js"
}
},
{
"lang":"Python",
"label":"SDK",
"source":{
"$ref":"./code_samples/python/v1.0.0/update_payment.py"
"$ref":"./code_samples/python/v1/update_payment.py"
}
},
{
"lang":"PHP",
"label":"SDK",
"source":{
"$ref":"./code_samples/php/v2.0.0/chargeback.php"
"$ref":"./code_samples/php/v2/chargeback.php"
}
}
]
Expand All @@ -113,21 +113,21 @@
"lang":"JavaScript",
"label":"SDK",
"source":{
"$ref":"./code_samples/node/v1.0.0/cancelPayment.js"
"$ref":"./code_samples/node/v1/cancelPayment.js"
}
},
{
"lang":"Python",
"label":"SDK",
"source":{
"$ref":"./code_samples/python/v1.0.0/cancel_payment.py"
"$ref":"./code_samples/python/v1/cancel_payment.py"
}
},
{
"lang":"PHP",
"label":"SDK",
"source":{
"$ref":"./code_samples/php/v2.0.0/cancel_payment.php"
"$ref":"./code_samples/php/v2/cancel_payment.php"
}
}
]
Expand All @@ -140,21 +140,21 @@
"lang":"JavaScript",
"label":"SDK",
"source":{
"$ref":"./code_samples/node/v1.0.0/createPaymentDirect.js"
"$ref":"./code_samples/node/v1/createPaymentDirect.js"
}
},
{
"lang":"Python",
"label":"SDK",
"source":{
"$ref":"./code_samples/python/v1.0.0/create_payment_direct.py"
"$ref":"./code_samples/python/v1/create_payment_direct.py"
}
},
{
"lang":"PHP",
"label":"SDK",
"source":{
"$ref":"./code_samples/php/v2.0.0/create_payment_direct.php"
"$ref":"./code_samples/php/v2/create_payment_direct.php"
}
}
]
Expand All @@ -167,21 +167,21 @@
"lang":"JavaScript",
"label":"SDK",
"source":{
"$ref":"./code_samples/node/v1.0.0/setColors.js"
"$ref":"./code_samples/node/v1/setColors.js"
}
},
{
"lang":"Python",
"label":"SDK",
"source":{
"$ref":"./code_samples/python/v1.0.0/set_colors.py"
"$ref":"./code_samples/python/v1/set_colors.py"
}
},
{
"lang":"PHP",
"label":"SDK",
"source":{
"$ref":"./code_samples/php/v2.0.0/set_colors.php"
"$ref":"./code_samples/php/v2/set_colors.php"
}
}
]
Expand All @@ -194,21 +194,21 @@
"lang":"JavaScript",
"label":"SDK",
"source":{
"$ref":"./code_samples/node/v1.0.0/setLogo.js"
"$ref":"./code_samples/node/v1/setLogo.js"
}
},
{
"lang":"Python",
"label":"SDK",
"source":{
"$ref":"./code_samples/python/v1.0.0/set_logo.py"
"$ref":"./code_samples/python/v1/set_logo.py"
}
},
{
"lang":"PHP",
"label":"SDK",
"source":{
"$ref":"./code_samples/php/v2.0.0/set_logo.php"
"$ref":"./code_samples/php/v2/set_logo.php"
}
}
]
Expand All @@ -221,21 +221,21 @@
"lang":"JavaScript",
"label":"SDK",
"source":{
"$ref":"./code_samples/node/v1.0.0/getAccessToken.js"
"$ref":"./code_samples/node/v1/getAccessToken.js"
}
},
{
"lang":"Python",
"label":"SDK",
"source":{
"$ref":"./code_samples/python/v1.0.0/get_access_token.py"
"$ref":"./code_samples/python/v1/get_access_token.py"
}
},
{
"lang":"PHP",
"label":"SDK",
"source":{
"$ref":"./code_samples/php/v2.0.0/get_access_token.php"
"$ref":"./code_samples/php/v2/get_access_token.php"
}
}
]
Expand Down
27 changes: 27 additions & 0 deletions code_samples/node/v1/loanPrecalculation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { TBPlusSDK, GatewayMode, PaymentMethod } from "@tatrabanka/tatrapayplus-node";

const sdk = new TBPlusSDK(
"API_KEY",
"API_SECRET",
{mode: GatewayMode.PRODUCTION},
);

const { data, error } = await sdk.precalculateLoan(
{
paymentMethod: PaymentMethod.PAY_LATER,
loanAmount: 250.45,
capacityInfo: {
monthlyIncome: 2000,
monthlyExpenses: 800,
numberOfChildren: 0,
},
},
"127.0.0.1",
);

// handle response
for (const item of data) {
// item.mainPreference
// item.loanInterestRate
// ...
}
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"card_holder" => "Janko Hraško",
"email" => "janko.hrasko@example.com",
]),
"ipsp_data" => new Tatrapayplus\TatrapayplusApiClient\Model\DirectTransactionIPSPData([
"ipsp_data" => new Tatrapayplus\TatrapayplusApiClient\Model\TransactionIPSPData([
"sub_merchant_id" => "12345",
"name" => "Test 123",
"location" => "Test 123",
Expand Down
31 changes: 31 additions & 0 deletions code_samples/php/v2/loan_precalculation.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php
use Tatrapayplus\TatrapayplusApiClient\Api\TatraPayPlusAPIApi;
use Tatrapayplus\TatrapayplusApiClient\Model\PaymentMethod;
use Tatrapayplus\TatrapayplusApiClient\Model\BasicCalculationRequest;
use Tatrapayplus\TatrapayplusApiClient\Model\CapacityInfo;

$tatrapayplus_api = new TatraPayPlusAPIApi(
"your-client-id",
"your-client-secret",
mode: TatraPayPlusAPIApi::PRODUCTION
);
$request = new BasicCalculationRequest([
"payment_method" => PaymentMethod::PAY_LATER,
"loan_amount" => 150.45,
"capacity_info" => new CapacityInfo([ // not required
"monthly_income" => 0,
"monthly_expenses" => 0,
"number_of_children" => 0
])
]);

$response = $tatrapayplus_api->loanPrecalculation($request);

$response["response"]->getStatusCode(); // 200 = success

$response_list = $response['object']; // contains a list of BasicCalculationResponseItem objects
foreach ($response_list as $item) {
$item->getLoanInterestRate();
$item->getLoanDuration();
// ....
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
country="SK",
),
),
ipsp_data=DirectTransactionIPSPData(
ipsp_data=TransactionIPSPData(
sub_merchant_id="5846864684",
name="Test Predajca",
location="Bratislava",
Expand Down
29 changes: 29 additions & 0 deletions code_samples/python/v1/loan_precalculation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from tatrapayplus.client import TBPlusSDK
from tatrapayplus.models import *

tatrapay_client = TBPlusSDK(
client_id="your-client-id",
client_secret="your-client-secret",
mode=Mode.PRODUCTION,
)

loan_data = BasicCalculationRequest(
loan_amount=250.45,
payment_method=BasicCalculationRequestPaymentMethod.PAY_LATER,
capacity_info=CapacityInfo( # not required
monthly_income=2000.0,
monthly_expenses=800.0,
number_of_children=1,
)
)

loan_offers = tatrapay_client.precalculate_loan(
request=loan_data,
ip_address="127.0.0.1",
)

for loan_offer in loan_offers:
# loan_offer = BasicCalculationResponseItem object
print(loan_offer.loan_duration)
print(loan_offer.loan_interest_rate)
# ...
Loading