diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 86e430b..4fc4987 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -7,6 +7,7 @@ on: # Review gh actions docs if you want to further define triggers, paths, etc # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on + jobs: build: name: Build Docusaurus diff --git a/code_samples/php/v1.0.0/cancel_payment.php b/code_samples/php/v1.0.0/cancel_payment.php new file mode 100644 index 0000000..227386d --- /dev/null +++ b/code_samples/php/v1.0.0/cancel_payment.php @@ -0,0 +1,11 @@ +cancelPaymentIntent($payment_id); +$response["response"]->getStatusCode(); // 200 or 201 = success \ No newline at end of file diff --git a/code_samples/php/v1.0.0/chargeback.php b/code_samples/php/v1.0.0/chargeback.php new file mode 100644 index 0000000..74ae6d8 --- /dev/null +++ b/code_samples/php/v1.0.0/chargeback.php @@ -0,0 +1,16 @@ + CardPayUpdateInstruction::OPERATION_TYPE_CHARGEBACK, + "amount" => 3.0, +]); + +$response = $tatrapayplus_api->updatePaymentIntent($payment_id, $chargeback_data); +$response["response"]->getStatusCode(); // 200 or 201 = success \ No newline at end of file diff --git a/code_samples/php/v1.0.0/confirm_cancel_pre_authorization.php b/code_samples/php/v1.0.0/confirm_cancel_pre_authorization.php new file mode 100644 index 0000000..5596d26 --- /dev/null +++ b/code_samples/php/v1.0.0/confirm_cancel_pre_authorization.php @@ -0,0 +1,21 @@ + CardPayUpdateInstruction::OPERATION_TYPE_CANCEL_PRE_AUTHORIZATION, +]); +$response = $tatrapayplus_api->updatePaymentIntent($payment_id, $pre_authorization_data); + +// or + +$pre_authorization_data = new CardPayUpdateInstruction([ + "operation_type" => CardPayUpdateInstruction::OPERATION_TYPE_CONFIRM_PRE_AUTHORIZATION, +]); +$response = $tatrapayplus_api->updatePaymentIntent($payment_id, $pre_authorization_data); \ No newline at end of file diff --git a/code_samples/php/v1.0.0/create_payment.php b/code_samples/php/v1.0.0/create_payment.php new file mode 100644 index 0000000..0b1c994 --- /dev/null +++ b/code_samples/php/v1.0.0/create_payment.php @@ -0,0 +1,62 @@ + "TestStreet", + "building_number" => "12", + "town_name" => "Town", + "post_code" => "97405", + "country" => "SK", +]); +$initiate_payment_request = new Tatrapayplus\TatrapayplusApiClient\Model\InitiatePaymentRequest([ + "base_payment" => new Tatrapayplus\TatrapayplusApiClient\Model\BasePayment([ + "instructed_amount" => new Tatrapayplus\TatrapayplusApiClient\Model\Amount([ + "amount_value" => 10.0, + "currency" => "EUR", + ]), + "end_to_end" => new Tatrapayplus\TatrapayplusApiClient\Model\E2e([ + "variable_symbol" => "ORDER123456", + ]), + ]), + "bank_transfer" => new Tatrapayplus\TatrapayplusApiClient\Model\BankTransfer(), + "user_data" => new Tatrapayplus\TatrapayplusApiClient\Model\UserData([ + "first_name" => "Janko", + "last_name" => "Hrasko", + "email" => "janko.hrasko@example.com", + ]), + "card_detail" => new Tatrapayplus\TatrapayplusApiClient\Model\CardDetail([ + "card_holder" => "Janko Hrasko", + "billing_address" => $address, + "shipping_address" => $address, + ]), + "pay_later" => new Tatrapayplus\TatrapayplusApiClient\Model\PayLater([ + "order" => new Tatrapayplus\TatrapayplusApiClient\Model\Order([ + "order_no" => "ORDER123456", + "order_items" => [ + new Tatrapayplus\TatrapayplusApiClient\Model\OrderItem([ + "quantity" => 1.0, + "total_item_price" => 10.0, + "item_detail" => new Tatrapayplus\TatrapayplusApiClient\Model\ItemDetail([ + "item_detail_en" => new Tatrapayplus\TatrapayplusApiClient\Model\ItemDetailLangUnit([ + "item_name" => "Product 1", + ]), + "item_detail_sk" => new Tatrapayplus\TatrapayplusApiClient\Model\ItemDetailLangUnit([ + "item_name" => "Produkt 1", + ]), + ]), + ]), + ], + ]), + ]), +]); + +$response = $tatrapayplus_api->initiatePayment( + "redirect uri", + $initiate_payment_request, +); +$response["object"]->getPaymentId(); // newly created payment ID \ No newline at end of file diff --git a/code_samples/php/v1.0.0/create_payment_direct.php b/code_samples/php/v1.0.0/create_payment_direct.php new file mode 100644 index 0000000..7715b0d --- /dev/null +++ b/code_samples/php/v1.0.0/create_payment_direct.php @@ -0,0 +1,39 @@ + new Tatrapayplus\TatrapayplusApiClient\Model\Amount([ + "amount_value" => 10, + "currency" => "EUR", + ]), + "is_pre_authorization" => true, + "end_to_end" => new Tatrapayplus\TatrapayplusApiClient\Model\E2e([ + "variable_symbol" => "123", + ]), + "tds_data" => new Tatrapayplus\TatrapayplusApiClient\Model\DirectTransactionTDSData([ + "card_holder" => "Janko Hraško", + "email" => "janko.hrasko@example.com", + ]), + "ipsp_data" => new Tatrapayplus\TatrapayplusApiClient\Model\DirectTransactionIPSPData([ + "sub_merchant_id" => "12345", + "name" => "Test 123", + "location" => "Test 123", + "country" => "SK", + ]), + "token" => new Tatrapayplus\TatrapayplusApiClient\Model\Token([ + "google_pay_token" => "ABC12345" + ]), +]); + +$response = $tatrapayplus_api->initiateDirectTransaction( + "redirect uri", + $initiate_transaction_request, +); + +$response["object"]->getPaymentId(); // newly created payment ID +$response["object"]->getRedirectFormHtml(); // HTML form \ No newline at end of file diff --git a/code_samples/php/v1.0.0/create_payment_pre_authorization.php b/code_samples/php/v1.0.0/create_payment_pre_authorization.php new file mode 100644 index 0000000..f9a8de5 --- /dev/null +++ b/code_samples/php/v1.0.0/create_payment_pre_authorization.php @@ -0,0 +1,30 @@ + new Tatrapayplus\TatrapayplusApiClient\Model\BasePayment([ + "instructed_amount" => new Tatrapayplus\TatrapayplusApiClient\Model\Amount([ + "amount_value" => 10.0, + "currency" => "EUR", + ]), + "end_to_end" => new Tatrapayplus\TatrapayplusApiClient\Model\E2e([ + "variable_symbol" => "ORDER123456", + ]), + ]), + "bank_transfer" => new Tatrapayplus\TatrapayplusApiClient\Model\BankTransfer(), + "card_detail" => new Tatrapayplus\TatrapayplusApiClient\Model\CardDetail([ + "card_holder" => "Janko Hrasko", + "is_pre_authorization" => true, + ]), +]); + +$response = $tatrapayplus_api->initiatePayment( + "redirect uri", + $initiate_payment_request, +); +$response["object"]->getPaymentId(); \ No newline at end of file diff --git a/code_samples/php/v1.0.0/get_available_payment_methods.php b/code_samples/php/v1.0.0/get_available_payment_methods.php new file mode 100644 index 0000000..442848e --- /dev/null +++ b/code_samples/php/v1.0.0/get_available_payment_methods.php @@ -0,0 +1,13 @@ +getAvailableMethods( + total_amount: 100, + currency: "EUR", + country: "SK" +); \ No newline at end of file diff --git a/code_samples/php/v1.0.0/get_payment_status.php b/code_samples/php/v1.0.0/get_payment_status.php new file mode 100644 index 0000000..6e90fdb --- /dev/null +++ b/code_samples/php/v1.0.0/get_payment_status.php @@ -0,0 +1,15 @@ +getPaymentIntentStatus($payment_id); + +$response_obj = $response['object']; +$status = $response_obj->getStatus(); +$payment_method = $response_obj->getSelectedPaymentMethod(); +$authorization_status = $response_obj->getAuthorizationStatus(); \ No newline at end of file diff --git a/code_samples/php/v1.0.0/set_colors.php b/code_samples/php/v1.0.0/set_colors.php new file mode 100644 index 0000000..a3ee4bd --- /dev/null +++ b/code_samples/php/v1.0.0/set_colors.php @@ -0,0 +1,26 @@ + AppearanceRequest::THEME_SYSTEM, + "tint_on_accent" => new ColorAttribute([ + "color_dark_mode" => "#fff", + "color_light_mode" => "#fff", + ]), + "tint_accent" => new ColorAttribute([ + "color_dark_mode" => "#fff", + "color_light_mode" => "#fff", + ]), + "surface_accent" => new ColorAttribute([ + "color_dark_mode" => "#fff", + "color_light_mode" => "#fff", + ]), +]); + +$response = $tatrapayplus_api->setAppearance($appearance_request); \ No newline at end of file diff --git a/code_samples/php/v1.0.0/set_logo.php b/code_samples/php/v1.0.0/set_logo.php new file mode 100644 index 0000000..a01a59b --- /dev/null +++ b/code_samples/php/v1.0.0/set_logo.php @@ -0,0 +1,13 @@ + "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII", +]); + +$response = $tatrapayplus_api->setLogo($logo_request); \ No newline at end of file diff --git a/docs/libraries/php/v1.0.0/appearances.mdx b/docs/libraries/php/v1.0.0/appearances.mdx new file mode 100644 index 0000000..5c0be24 --- /dev/null +++ b/docs/libraries/php/v1.0.0/appearances.mdx @@ -0,0 +1,34 @@ +import CodeBlock from '@theme/CodeBlock'; + +# Gateway appearances + +Payment gateway can have custom colors and logo. + +![Color guide](@site/docs/assets/color_guide_en.png) + +:::warning + +Gateway appearances can be change only in **PRODUCTION** mode. + +::: + +## Logo + +import setLogo from '!!raw-loader!@site/code_samples/php/v1.0.0/set_logo.php'; + +{setLogo} + +## Colors + +import setColors from '!!raw-loader!@site/code_samples/php/v1.0.0/set_colors.php'; + +{setColors} + + +:::tip + +Changes are reflected only in **new payments**. Refresh of page is not sufficient. + +::: + +