PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.16.9
GiveWP – Donation Plugin and Fundraising Platform v4.16.9
4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 2.30.0 All 255 releases
give / src / PaymentGateways / Gateways / Offline / OfflineGateway.php

OfflineGateway.php in GiveWP – Donation Plugin and Fundraising Platform 4.16.9, at src/PaymentGateways/Gateways/Offline/OfflineGateway.php

96 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Give\PaymentGateways\Gateways\Offline;
4
5 use Give\Donations\Models\Donation;
6 use Give\Framework\Exceptions\Primitives\RuntimeException;
7 use Give\Framework\PaymentGateways\Commands\PaymentPending;
8 use Give\Framework\PaymentGateways\PaymentGateway;
9 use Give\Framework\Support\Facades\Scripts\ScriptAsset;
10 use Give\Helpers\Language;
11 use Give\PaymentGateways\Gateways\Offline\Views\LegacyFormFieldMarkup;
12
13 /**
14 * The Offline payment gateway, intended to reflect donations that are made offline and will be later confirmed.
15 *
16 * @since 3.0.0
17 */
18 class OfflineGateway extends PaymentGateway
19 {
20 /**
21 * @since 3.0.0
22 */
23 public static function id(): string
24 {
25 return 'offline';
26 }
27
28 /**
29 * @since 3.0.0
30 */
31 public function getId(): string
32 {
33 return self::id();
34 }
35
36 /**
37 * @since 3.0.0
38 */
39 public function getName(): string
40 {
41 return __('Offline Donation', 'give');
42 }
43
44 /**
45 * @since 3.0.0
46 */
47 public function getPaymentMethodLabel(): string
48 {
49 return __('Offline Donation', 'give');
50 }
51
52 /**
53 * @since 3.0.0
54 */
55 public function formSettings(int $formId): array
56 {
57 return [
58 'markup' => (new LegacyFormFieldMarkup())($formId, false),
59 ];
60 }
61
62 /**
63 * @since 3.0.0
64 */
65 public function enqueueScript(int $formId)
66 {
67 $scriptAsset = ScriptAsset::get(GIVE_PLUGIN_DIR . 'build/offlineGateway.asset.php');
68
69 wp_enqueue_script(
70 $this::id(),
71 GIVE_PLUGIN_URL . 'build/offlineGateway.js',
72 $scriptAsset['dependencies'],
73 $scriptAsset['version'],
74 true
75 );
76
77 Language::setScriptTranslations($this::id());
78 }
79
80 /**
81 * @since 3.0.0
82 */
83 public function getLegacyFormFieldMarkup(int $formId): string
84 {
85 return (new LegacyFormFieldMarkup())($formId, true);
86 }
87
88 /**
89 * @since 3.0.0
90 */
91 public function createPayment(Donation $donation, $gatewayData): PaymentPending
92 {
93 return new PaymentPending();
94 }
95 }
96