This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. This class is identified as a Thread safe class. But the thread safety is being mis-used here. | |
setFile() and getFile() methods are synchronized. The getContent(), getContentWithoutUnicode() and saveContent() | |
methods are not synchronized. So the concurrent access by multiple threads could lead to invoke errors. | |
2. Exception handling has been totally ignored here. Here in this code we are using IO (Input / Output). Its important to have exception handling. | |
public synchronized String getContent() throws IOException { | |
try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8))) { | |
StringBuilder output = new StringBuilder(); | |
String line; | |
while ((line = reader.readLine()) != null) { | |
output.append(line).append(System.lineSeparator()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"api_environment": "staging", | |
"vendor_id": "33", | |
"vendor_order_id": "123456", | |
"vendor_sales_id": "987654321", | |
"internal_comment": "demo testing", | |
"customer_comment": "Kundenkommentar", | |
"invoice_comment": "Belegkommentar", | |
"check24_sub_id" : "123456789", | |
"payments": [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"api_environment": "production", | |
"vendor_id": "45", | |
"vendor_order_id": "11223344", | |
"internal_comment": "Any internal comment here", | |
"customer_comment": "Any customer comment here", | |
"payments": [ | |
{ | |
"via": "33", | |
"payer_name": "Erika Mustermann" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"wishdate":"2022-03-30", | |
"customer":{ | |
"salutation":"Frau", | |
"firstname":"Erika", | |
"lastname":"Mustermann", | |
"birthday":"1980-05-15", | |
"nationality":"GER", | |
"address":{ | |
"street":"Musterstr.", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"wishdate":"2022-01-25", | |
"customer":{ | |
"salutation":"Frau", | |
"firstname":"Erika", | |
"lastname":"Mustermann", | |
"birthday":"1980-05-15", | |
"nationality":"GER", | |
"address":{ | |
"street":"Musterstr.", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"wishdate":"2022-01-25", | |
"customer":{ | |
"salutation":"Frau", | |
"firstname":"Erika", | |
"lastname":"Mustermann", | |
"birthday":"1980-05-15", | |
"nationality":"GER", | |
"address":{ | |
"street":"Musterstr.", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$cryptedResponse = "ea3c818e637041a0:263fef2abfa0089804a627117bff04c94a70e89488017c36fdcfac4c56dc9452318d257bce8b76d483639de5170b485585580da3ff16124e924f1d83888f65fc7e124c93e7ac2437fdfba82f8694a0d6d96d3c0541877ab0afc19d40f39894e812cd2430bc9bb1a220ec6590a523c5b59c6aaf29ac4a890d1f16d0a34f57fc6924d312329e17244594ce079c1565bc1086dc3a46d81d8d4e4705b2845b3af83dd61443cedc7af0aae56ae47122b1fd022570a2c59d3948cbd0d1938a5b5670dd40c08dec739bbae3a8ea71f1e18b2485c8f7977029e43996e1a7b4c6d40a5b4aada372b3214c85efb54b79af35200d912afd69b601d8a4f0e66688a0bfa81959d1ef6f5876590e428be25d838296470fe334a6096fe90fc9b79eb5403b1eca1a"; | |
$iv_size = openssl_cipher_iv_length('AES-256-CBC'); | |
$data = explode(":", trim($cryptedResponse)); | |
$iv = $data[0]; | |
$cipertext = hex2bin($data[1]); | |
$encryptionKey = "key_here"; | |
$decrypted = openssl_decrypt($cipertext, 'AES-256-CBC', $encryptionKey, OPENSSL_RAW_DATA, $iv); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"type": "array", | |
"data": [ | |
{ | |
"id": 1, | |
"brand": "apple", | |
"stock": 500, | |
"avg_price": 999.5 | |
}, | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$curl = curl_init(); | |
curl_setopt_array($curl, array( | |
CURLOPT_URL => 'https://prod1.vf-usp.spectrum8.io/vodafone/mobile/contract-summary', | |
CURLOPT_RETURNTRANSFER => true, | |
CURLOPT_ENCODING => '', | |
CURLOPT_MAXREDIRS => 10, | |
CURLOPT_TIMEOUT => 0, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"id": "cs_test_a1oR7Z4E9l66QIIMLfB418FkTGXjI6QVSCmoPgMHgJtlEidZ63g4lrVCkt", | |
"object": "checkout.session", | |
"livemode": false, | |
"payment_intent": "pi_3KBLZqAuGdjHqmqs0hiCMUc5", | |
"status": "complete", | |
"after_expiration": null, | |
"allow_promotion_codes": null, | |
"amount_subtotal": 5995, | |
"amount_total": 5995, |
NewerOlder