@@ -27,41 +27,41 @@ |
||
27 | 27 | |
28 | 28 | $donate = $request->donate*100; |
29 | 29 | $GetTokenParams = [ |
30 | - "checkout" => [ |
|
30 | + "checkout" => [ |
|
31 | 31 | "test" => $is_test, //true, |
32 | 32 | "transaction_type" => "payment", |
33 | 33 | "version" => 2.1, |
34 | 34 | "attempts" => 3, |
35 | 35 | "settings" => [ |
36 | - "success_url" => $url . "message=1", |
|
37 | - "decline_url" => $url . "message=2", |
|
38 | - "fail_url" => $url . "message=3", |
|
39 | - "notification_url" => "https://".$_SERVER['HTTP_HOST']."/doika/payment-record-db-".$id, |
|
40 | - "language"=> "ru" |
|
36 | + "success_url" => $url . "message=1", |
|
37 | + "decline_url" => $url . "message=2", |
|
38 | + "fail_url" => $url . "message=3", |
|
39 | + "notification_url" => "https://".$_SERVER['HTTP_HOST']."/doika/payment-record-db-".$id, |
|
40 | + "language"=> "ru" |
|
41 | 41 | ], |
42 | 42 | "order" =>[ |
43 | - "currency"=> "BYN", |
|
44 | - "amount"=> $donate, |
|
45 | - "description"=> "Order description" |
|
43 | + "currency"=> "BYN", |
|
44 | + "amount"=> $donate, |
|
45 | + "description"=> "Order description" |
|
46 | 46 | ], |
47 | 47 | "customer"=> [ |
48 | - "address"=> "Baker street 221b", |
|
49 | - "country"=> "GB", |
|
50 | - "city"=> "London", |
|
51 | - "email"=> "[email protected]" |
|
48 | + "address"=> "Baker street 221b", |
|
49 | + "country"=> "GB", |
|
50 | + "city"=> "London", |
|
51 | + "email"=> "[email protected]" |
|
52 | 52 | ], |
53 | - ] |
|
53 | + ] |
|
54 | 54 | ]; |
55 | 55 | |
56 | 56 | $client = new Client([ |
57 | - 'base_uri' => "https://checkout.bepaid.by" |
|
57 | + 'base_uri' => "https://checkout.bepaid.by" |
|
58 | 58 | ]); |
59 | 59 | |
60 | 60 | $response = $client->request('POST', '/ctp/api/checkouts', [ |
61 | - 'auth' => [$idMarket, $keyMarket], |
|
62 | - 'headers' => ['Accept' => 'application/json'], |
|
63 | - 'json' => $GetTokenParams, |
|
64 | - 'verify' => false |
|
61 | + 'auth' => [$idMarket, $keyMarket], |
|
62 | + 'headers' => ['Accept' => 'application/json'], |
|
63 | + 'json' => $GetTokenParams, |
|
64 | + 'verify' => false |
|
65 | 65 | ]); |
66 | 66 | return $response->getBody(); |
67 | 67 | } |
@@ -10,55 +10,55 @@ discard block |
||
10 | 10 | |
11 | 11 | class CampaignPageClient extends Model |
12 | 12 | { |
13 | - public static function getJSONArrCampaign($id) |
|
14 | - { |
|
13 | + public static function getJSONArrCampaign($id) |
|
14 | + { |
|
15 | 15 | $arrCampaign = self::getCampaignClientArray($id); |
16 | 16 | return json_encode($arrCampaign); |
17 | - } |
|
17 | + } |
|
18 | 18 | |
19 | - public static function getCampaignClientArray($id) |
|
20 | - { |
|
19 | + public static function getCampaignClientArray($id) |
|
20 | + { |
|
21 | 21 | $campaign = Campaign::find($id); |
22 | 22 | if(!$campaign){ |
23 | - return "Campaign not found!"; |
|
23 | + return "Campaign not found!"; |
|
24 | 24 | } |
25 | 25 | $lang = CampaignPageAdmin::getLangDefault(); |
26 | 26 | |
27 | 27 | $campaignConfigurations = $campaign->campaign_configurations()->first(); |
28 | 28 | $campaignInformations = $campaign->campaign_lang_informations() |
29 | - ->where('campaign_lang',$lang) |
|
30 | - ->first(); |
|
29 | + ->where('campaign_lang',$lang) |
|
30 | + ->first(); |
|
31 | 31 | |
32 | 32 | $arrCampaign = [ |
33 | - "height" => 200, //высота модуля |
|
34 | - "width" => 300, //ширина модуля |
|
35 | - "releaseUrl" => config('app.release_url'), |
|
36 | - "backgroundColor" => ConfigurationPageAdmin::getConfiguration('color_module_background',true), //Колер фона модуля |
|
37 | - "buttonColor" => ConfigurationPageAdmin::getConfiguration('color_module_buttons',true), //Колер кнопак з сумамі |
|
33 | + "height" => 200, //высота модуля |
|
34 | + "width" => 300, //ширина модуля |
|
35 | + "releaseUrl" => config('app.release_url'), |
|
36 | + "backgroundColor" => ConfigurationPageAdmin::getConfiguration('color_module_background',true), //Колер фона модуля |
|
37 | + "buttonColor" => ConfigurationPageAdmin::getConfiguration('color_module_buttons',true), //Колер кнопак з сумамі |
|
38 | 38 | |
39 | - "show_banner" => ConfigurationPageAdmin::getConfiguration('show_banner',true), //Паказваць банэр |
|
40 | - "color_banner_background" => ConfigurationPageAdmin::getConfiguration('color_banner_background',true), //Колер фону банэра |
|
41 | - "color_banner_help_background" => ConfigurationPageAdmin::getConfiguration('color_banner_help_background',true), //Колер кнопкі "Дапамагчы" |
|
42 | - "color_banner_help_text" => ConfigurationPageAdmin::getConfiguration('color_banner_help_text',true), //Колер тэкста "Дапамагчы" |
|
39 | + "show_banner" => ConfigurationPageAdmin::getConfiguration('show_banner',true), //Паказваць банэр |
|
40 | + "color_banner_background" => ConfigurationPageAdmin::getConfiguration('color_banner_background',true), //Колер фону банэра |
|
41 | + "color_banner_help_background" => ConfigurationPageAdmin::getConfiguration('color_banner_help_background',true), //Колер кнопкі "Дапамагчы" |
|
42 | + "color_banner_help_text" => ConfigurationPageAdmin::getConfiguration('color_banner_help_text',true), //Колер тэкста "Дапамагчы" |
|
43 | 43 | |
44 | - "titleTextColor" => "#31383e", //цвет шрифта заголовка |
|
45 | - "titleFontSize" => "22px", //размер шрифта заголовка |
|
44 | + "titleTextColor" => "#31383e", //цвет шрифта заголовка |
|
45 | + "titleFontSize" => "22px", //размер шрифта заголовка |
|
46 | 46 | |
47 | - "descriptionTextColor" => "#31383e", //цвет шрифта описания |
|
48 | - "descriptionFontSize" => "13px", //размер шрифта заголовка |
|
47 | + "descriptionTextColor" => "#31383e", //цвет шрифта описания |
|
48 | + "descriptionFontSize" => "13px", //размер шрифта заголовка |
|
49 | 49 | |
50 | - "buttonTextColor" => "#f7fafc", //цвет шрифта на кнопках |
|
51 | - "buttonFontSize" => "20px", //размер шрифта заголовка |
|
50 | + "buttonTextColor" => "#f7fafc", //цвет шрифта на кнопках |
|
51 | + "buttonFontSize" => "20px", //размер шрифта заголовка |
|
52 | 52 | |
53 | - "currency" => 'руб.', //валюта |
|
53 | + "currency" => 'руб.', //валюта |
|
54 | 54 | |
55 | - "currentFunds" => self::getCurrentFunds($id), //собрано на данный момент средств, число |
|
56 | - "expectedFunds" => $campaignConfigurations->required_amount, //необходимо собрать средств, число |
|
55 | + "currentFunds" => self::getCurrentFunds($id), //собрано на данный момент средств, число |
|
56 | + "expectedFunds" => $campaignConfigurations->required_amount, //необходимо собрать средств, число |
|
57 | 57 | |
58 | - "minDonateAmount" => 1, //минимальная сумма доната |
|
59 | - "maxDonateAmount" => 200, //максимальная сумма доната |
|
58 | + "minDonateAmount" => 1, //минимальная сумма доната |
|
59 | + "maxDonateAmount" => 200, //максимальная сумма доната |
|
60 | 60 | |
61 | - "innerText" => [ |
|
61 | + "innerText" => [ |
|
62 | 62 | "locale" => $lang, // язык текста |
63 | 63 | "titleImage" => $campaignConfigurations->photo, //путь до главного изображения, строка |
64 | 64 | "campaignTitle" => $campaignInformations->campaign_title_lang, //Заголовок компании, строка |
@@ -70,20 +70,20 @@ discard block |
||
70 | 70 | "paymentDescriptionText" => $campaignInformations->payment_description_lang, |
71 | 71 | "successfulPaymentMessage" => "Текст при удачном платеже", |
72 | 72 | "errorPaymentMessage" => "Текст при неудачном платеже" |
73 | - ], |
|
74 | - "showProgressBar" => $campaignConfigurations->campaign_progress_bar |
|
73 | + ], |
|
74 | + "showProgressBar" => $campaignConfigurations->campaign_progress_bar |
|
75 | 75 | ]; |
76 | 76 | |
77 | 77 | return $arrCampaign; |
78 | - } |
|
78 | + } |
|
79 | 79 | |
80 | - private static function getCurrentFunds($id) |
|
81 | - { |
|
80 | + private static function getCurrentFunds($id) |
|
81 | + { |
|
82 | 82 | $campaign = Campaign::find($id); |
83 | 83 | if(isset($campaign->payments)){ |
84 | - $payments = $campaign->payments->sum('amount'); |
|
85 | - return $payments; |
|
84 | + $payments = $campaign->payments->sum('amount'); |
|
85 | + return $payments; |
|
86 | 86 | } |
87 | 87 | return 0; |
88 | - } |
|
88 | + } |
|
89 | 89 | } |
@@ -8,17 +8,17 @@ |
||
8 | 8 | use App\Model\Payment; |
9 | 9 | |
10 | 10 | class PaymentImplementation extends Model { |
11 | - static public function createPayment($request, $id) { |
|
11 | + static public function createPayment($request, $id) { |
|
12 | 12 | |
13 | 13 | $message = file_get_contents('php://input'); |
14 | 14 | $message = json_decode($message); |
15 | 15 | |
16 | 16 | if($message->transaction->status == "successful") { |
17 | - $payment = new Payment; |
|
18 | - $payment->campaign_id = $id; |
|
19 | - $payment->amount = $message->transaction->amount * 0.01; |
|
20 | - $payment->token_payment = $message->transaction->credit_card->token; |
|
21 | - $payment->save(); |
|
17 | + $payment = new Payment; |
|
18 | + $payment->campaign_id = $id; |
|
19 | + $payment->amount = $message->transaction->amount * 0.01; |
|
20 | + $payment->token_payment = $message->transaction->credit_card->token; |
|
21 | + $payment->save(); |
|
22 | + } |
|
22 | 23 | } |
23 | - } |
|
24 | 24 | } |
25 | 25 | \ No newline at end of file |
@@ -6,5 +6,5 @@ |
||
6 | 6 | |
7 | 7 | class Doika_configuration extends Model |
8 | 8 | { |
9 | - protected $table = 'configurations'; |
|
9 | + protected $table = 'configurations'; |
|
10 | 10 | } |
@@ -7,36 +7,36 @@ discard block |
||
7 | 7 | use App\Model\PasswordChange; |
8 | 8 | |
9 | 9 | class ConfigurationPageAdmin extends Model { |
10 | - //получение одной конфигурации |
|
11 | - static public function getConfiguration($configurationName,$getString){ |
|
10 | + //получение одной конфигурации |
|
11 | + static public function getConfiguration($configurationName,$getString){ |
|
12 | 12 | $configuration = Doika_configuration::where('configuration_name',$configurationName) |
13 | - ->first(); |
|
13 | + ->first(); |
|
14 | 14 | if($configuration && $getString){ |
15 | - $configuration = $configuration->configuration_value; |
|
15 | + $configuration = $configuration->configuration_value; |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | return $configuration; |
19 | 19 | |
20 | - } |
|
21 | - //создание или обновление одной конфигурации |
|
22 | - static public function createOrUpdateConfiguration($configurationName,$value){ |
|
20 | + } |
|
21 | + //создание или обновление одной конфигурации |
|
22 | + static public function createOrUpdateConfiguration($configurationName,$value){ |
|
23 | 23 | if(!$value){ |
24 | - $value = ""; |
|
24 | + $value = ""; |
|
25 | 25 | } |
26 | 26 | $configuration = self::getConfiguration($configurationName,false); |
27 | 27 | if($configuration){ |
28 | - $configuration->configuration_value = $value; |
|
29 | - $configuration->save(); |
|
28 | + $configuration->configuration_value = $value; |
|
29 | + $configuration->save(); |
|
30 | 30 | }else{ |
31 | - $configuration = new Doika_configuration; |
|
32 | - $configuration->configuration_name = $configurationName; |
|
33 | - $configuration->configuration_value = $value; |
|
34 | - $configuration->configuration_active = 1; |
|
35 | - $configuration->save(); |
|
31 | + $configuration = new Doika_configuration; |
|
32 | + $configuration->configuration_name = $configurationName; |
|
33 | + $configuration->configuration_value = $value; |
|
34 | + $configuration->configuration_active = 1; |
|
35 | + $configuration->save(); |
|
36 | + } |
|
36 | 37 | } |
37 | - } |
|
38 | 38 | |
39 | - static public function getConfigurations(){ |
|
39 | + static public function getConfigurations(){ |
|
40 | 40 | //создаем массив конфигураций |
41 | 41 | $configurations = []; |
42 | 42 | // получаем ключ если он существует |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | |
49 | 49 | //Паказваць банэр? |
50 | 50 | if(self::getConfiguration('show_banner',true) == 1){ |
51 | - $configurations['show_banner'] = self::getConfiguration('show_banner',true); |
|
51 | + $configurations['show_banner'] = self::getConfiguration('show_banner',true); |
|
52 | 52 | } |
53 | 53 | //Колер фону банэра |
54 | 54 | $configurations['color_banner_background'] = self::getConfiguration('color_banner_background',true); |
@@ -62,24 +62,24 @@ discard block |
||
62 | 62 | $configurations['color_module_buttons'] = self::getConfiguration('color_module_buttons',true); |
63 | 63 | |
64 | 64 | if(self::getConfiguration('is_test',true) == 1){ |
65 | - $configurations['test_payments'] = self::getConfiguration('is_test',true); |
|
65 | + $configurations['test_payments'] = self::getConfiguration('is_test',true); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | // отдаем готовый массив с конфигурациями |
69 | 69 | return $configurations; |
70 | - } |
|
70 | + } |
|
71 | 71 | |
72 | - //обновляем конфигурации или записываем новые |
|
73 | - static public function createOrUpdateConfigurations($request){ |
|
72 | + //обновляем конфигурации или записываем новые |
|
73 | + static public function createOrUpdateConfigurations($request){ |
|
74 | 74 | |
75 | 75 | self::createOrUpdateConfiguration('token',$request->token); |
76 | 76 | self::createOrUpdateConfiguration('id_market',$request->id_market); |
77 | 77 | self::createOrUpdateConfiguration('key_market',$request->key_market); |
78 | 78 | |
79 | 79 | if($request->show_banner){ |
80 | - self::createOrUpdateConfiguration('show_banner',1); |
|
80 | + self::createOrUpdateConfiguration('show_banner',1); |
|
81 | 81 | }else{ |
82 | - self::createOrUpdateConfiguration('show_banner',0); |
|
82 | + self::createOrUpdateConfiguration('show_banner',0); |
|
83 | 83 | } |
84 | 84 | self::createOrUpdateConfiguration('color_banner_background',$request->color_banner_background); |
85 | 85 | self::createOrUpdateConfiguration('color_banner_help_background',$request->color_banner_help_background); |
@@ -88,10 +88,10 @@ discard block |
||
88 | 88 | self::createOrUpdateConfiguration('color_module_buttons',$request->color_module_buttons); |
89 | 89 | |
90 | 90 | if($request->test_payments){ |
91 | - self::createOrUpdateConfiguration('is_test',1); |
|
91 | + self::createOrUpdateConfiguration('is_test',1); |
|
92 | 92 | }else{ |
93 | - self::createOrUpdateConfiguration('is_test',0); |
|
93 | + self::createOrUpdateConfiguration('is_test',0); |
|
94 | 94 | } |
95 | 95 | PasswordChange::changeProfile($request); |
96 | - } |
|
96 | + } |
|
97 | 97 | } |
98 | 98 | \ No newline at end of file |
@@ -89,10 +89,10 @@ |
||
89 | 89 | $campaignArr['id'] = $campaign->id; |
90 | 90 | $campaignArr['name']=$campaign->campaign_title; |
91 | 91 | if($campaign->campaign_active == 1){ |
92 | - $campaignArr['check']='checked'; |
|
92 | + $campaignArr['check']='checked'; |
|
93 | 93 | } |
94 | 94 | |
95 | - $campaignArr['time_start']=$campaign->campaign_configurations()->first() |
|
95 | + $campaignArr['time_start']=$campaign->campaign_configurations()->first() |
|
96 | 96 | ->time_start; |
97 | 97 | $dateStart = strtotime($campaignArr['time_start']); |
98 | 98 |