Completed
Pull Request — master (#5)
by Michael
08:36
created

PurchaseRequest::setMobilePhone()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 0
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
namespace Omnipay\Redsys\Message;
4
5
use DateTime;
6
use Omnipay\Common\Message\AbstractRequest;
7
8
/**
9
 * Redsys Purchase Request
10
 */
11
class PurchaseRequest extends AbstractRequest
12
{
13
    /** @var string */
14
    protected $liveEndpoint = 'https://sis.redsys.es/sis/realizarPago';
15
    /** @var string */
16
    protected $testEndpoint = 'https://sis-t.redsys.es:25443/sis/realizarPago';
17
    /** @var array */
18
    protected static $consumerLanguages = array(
19
        'es' => '001', // Spanish
20
        'en' => '002', // English
21
        'ca' => '003', // Catalan - same as Valencian (010)
22
        'fr' => '004', // French
23
        'de' => '005', // German
24
        'nl' => '006', // Dutch
25
        'it' => '007', // Italian
26
        'sv' => '008', // Swedish
27
        'pt' => '009', // Portuguese
28
        'pl' => '011', // Polish
29
        'gl' => '012', // Galician
30
        'eu' => '013', // Basque
31
    );
32 2
33
    /** @var stirng 250x400 */
34 2
    const CHALLENGE_WINDOW_SIZE_250_400 = "01";
35
    /** @var stirng 390x400 */
36
    const CHALLENGE_WINDOW_SIZE_390_400 = "02";
37 4
    /** @var stirng 500x600 */
38
    const CHALLENGE_WINDOW_SIZE_500_600 = "03";
39 4
    /** @var stirng 600x400 */
40
    const CHALLENGE_WINDOW_SIZE_600_400 = "04";
41
    /** @var stirng Fullscreen window (default) */
42 8
    const CHALLENGE_WINDOW_SIZE_FULLSCREEN = "05";
43
44 8
    /** @var string No 3DS Requestor authentication occurred (i.e. cardholder logged in as guest) */
45
    const ACCOUNT_AUTHENTICATION_METHOD_NONE = "01";
46
    /** @var string Login to the cardholder account at the 3DS Requestor system using 3DS Requestor's own credentials */
47
    const ACCOUNT_AUTHENTICATION_METHOD_OWN_CREDENTIALS = "02";
48
    /** @var string Login to the cardholder account at the 3DS Requestor system using federated ID */
49
    const ACCOUNT_AUTHENTICATION_METHOD_FEDERATED_ID = "03";
50
    /** @var string Login to the cardholder account at the 3DS Requestor system using issuer credentials */
51
    const ACCOUNT_AUTHENTICATION_METHOD_ISSUER_CREDENTIALS = "04";
52 7
    /** @var string Login to the cardholder account at the 3DS Requestor system using third-party authentication */
53
    const ACCOUNT_AUTHENTICATION_METHOD_THIRD_PARTY_AUTHENTICATION = "05";
54 7
    /** @var string Login to the cardholder account at the 3DS Requestor system using FIDO Authenticator */
55 1
    const ACCOUNT_AUTHENTICATION_METHOD_FIDO = "06";
56 1
57 1
    /** @var string No account (guest check-out) */
58 1
    const CUSTOMER_ACCOUNT_CREATED_NONE = "01";
59 7
    /** @var string Created during this transaction */
60 7
    const CUSTOMER_ACCOUNT_CREATED_THIS_TRANSACTION = "02";
61 7
    /** @var string Less than 30 days */
62
    const CUSTOMER_ACCOUNT_CREATED_LAST_30_DAYS = "03";
63 7
    /** @var string Between 30 and 60 days */
64
    const CUSTOMER_ACCOUNT_CREATED_LAST_60_DAYS = "04";
65
    /** @var string More than 60 day */
66 15
    const CUSTOMER_ACCOUNT_CREATED_MORE_THAN_60_DAYS = "05";
67
68 15
    /** @var string Modified in this session */
69
    const CUSTOMER_ACCOUNT_MODIFIED_THIS_TRANSACTION = "01";
70
    /** @var string Less than 30 days */
71 23
    const CUSTOMER_ACCOUNT_MODIFIED_LAST_30_DAYS = "02";
72
    /** @var string Between 30 and 60 days */
73 23
    const CUSTOMER_ACCOUNT_MODIFIED_LAST_60_DAYS = "03";
74
    /** @var string More than 60 day */
75
    const CUSTOMER_ACCOUNT_MODIFIED_MORE_THAN_60_DAYS = "04";
76 7
77
    /** @var string Unchanged */
78 7
    const CUSTOMER_ACCOUNT_PASSWORD_MODIFIED_NONE = "01";
79
    /** @var string Modified in this session */
80
    const CUSTOMER_ACCOUNT_PASSWORD_MODIFIED_THIS_TRANSACTION = "02";
81 7
    /** @var string Less than 30 days */
82
    const CUSTOMER_ACCOUNT_PASSWORD_MODIFIED_LAST_30_DAYS = "03";
83 7
    /** @var string Between 30 and 60 days */
84
    const CUSTOMER_ACCOUNT_PASSWORD_MODIFIED_LAST_60_DAYS = "04";
85
    /** @var string More than 60 day */
86 11
    const CUSTOMER_ACCOUNT_PASSWORD_MODIFIED_MORE_THAN_60_DAYS = "05";
87
88 11
    /** @var string No account (guest check-out) */
89
    const PAYMENT_METHOD_CREATED_NONE = "01";
90
    /** @var string Created during this transaction */
91 23
    const PAYMENT_METHOD_CREATED_THIS_TRANSACTION = "02";
92
    /** @var string Less than 30 days */
93 23
    const PAYMENT_METHOD_CREATED_LAST_30_DAYS = "03";
94
    /** @var string Between 30 and 60 days */
95
    const PAYMENT_METHOD_CREATED_LAST_60_DAYS = "04";
96 11
    /** @var string More than 60 day */
97
    const PAYMENT_METHOD_CREATED_MORE_THAN_60_DAYS = "05";
98 11
99
    /** @var string For the first time */
100
    const SHIPPING_ADDRESS_USAGE_THIS_TRANSACTION = "01";
101 23
    /** @var string Less than 30 days */
102
    const SHIPPING_ADDRESS_USAGE_LAST_30_DAYS = "02";
103 23
    /** @var string Between 30 and 60 days */
104
    const SHIPPING_ADDRESS_USAGE_LAST_60_DAYS = "03";
105
    /** @var string More than 60 day */
106 11
    const SHIPPING_ADDRESS_USAGE_MORE_THAN_60_DAYS = "04";
107
108 11
    /** @var string Electronic delivery */
109
    const DELIVERY_TIMEFRAME_ELECTRONIC_DELIVERY = "01";
110
    /** @var string Same day shipping */
111 23
    const DELIVERY_TIMEFRAME_SAME_DAY = "02";
112
    /** @var string Next day shipping */
113 23
    const DELIVERY_TIMEFRAME_NEXT_DAY = "03";
114
    /** @var string Shipping in 2 or more days */
115
    const DELIVERY_TIMEFRAME_2_OR_MORE_DAYS = "04";
116
117
    /** @var string Ship to cardholder's billing address */
118
    const SHIPPING_TO_BILLING_ADDRESS = "01";
119
    /** @var string Ship to another verified address on file with merchant */
120
    const SHIPPING_TO_ANOTHER_VERIFIED_ADDRESS = "02";
121 15
    /** @var string Ship to address that is different than the cardholder's billing address */
122
    const SHIPPING_DIFFERENT_BILLING_ADDRESS = "03";
123 15
    /** @var string Pick-up at local store (Store address shall be populated in shipping address fields) */
124 15
    const SHIPPING_PICK_UP = "04";
125 15
    /** @var string Digital goods (includes online services, electronic gift cards and redemption codes) */
126 15
    const SHIPPING_DIGITAL = "05";
127 15
    /** @var string Travel and Event tickets, not shipped */
128 15
    const SHIPPING_TRAVEL = "06";
129 15
    /** @var string Other (for example, Gaming, digital services not shipped, emedia subscriptions, etc.) */
130
    const SHIPPING_OTHER = "07";
131 15
132 15
    public function getCardholder()
133
    {
134 15
        return $this->getParameter('cardholder');
135 15
    }
136
137 2
    public function setCardholder($value)
138
    {
139 2
        return $this->setParameter('cardholder', $value);
140
    }
141
142
    public function getConsumerLanguage()
143 2
    {
144 2
        return $this->getParameter('consumerLanguage');
145 2
    }
146 2
147 2
    /**
148 2
     * Set the language presented to the consumer
149 2
     *
150
     * @param string|int Either the ISO 639-1 code to be converted, or the gateway's own numeric language code
151 2
     */
152 2
    public function setConsumerLanguage($value)
153 2
    {
154 2
        if (is_int($value)) {
155 2
            if ($value < 0 || $value > 13) {
156 2
                $value = 1;
157 2
            }
158 2
            $value = str_pad($value, 3, '0', STR_PAD_LEFT);
159
        } elseif (!is_numeric($value)) {
160
            $value = isset(self::$consumerLanguages[$value]) ? self::$consumerLanguages[$value] : '001';
161 1
        }
162
163 1
        return $this->setParameter('consumerLanguage', $value);
164
    }
165 1
166
    public function getHmacKey()
167
    {
168 1
        return $this->getParameter('hmacKey');
169 1
    }
170 1
171 1
    public function setHmacKey($value)
172 1
    {
173 1
        return $this->setParameter('hmacKey', $value);
174 1
    }
175 1
176
    public function getMerchantData()
177 1
    {
178
        return $this->getParameter('merchantData');
179
    }
180 7
181
    public function setMerchantData($value)
182 7
    {
183
        return $this->setParameter('merchantData', $value);
184
    }
185 1
186
    public function getMerchantId()
187
    {
188
        return $this->getParameter('merchantId');
189
    }
190
191
    public function setMerchantId($value)
192
    {
193
        return $this->setParameter('merchantId', $value);
194
    }
195
196
    public function getMerchantName()
197
    {
198
        return $this->getParameter('merchantName');
199
    }
200
201
    public function setMerchantName($value)
202
    {
203
        return $this->setParameter('merchantName', $value);
204
    }
205
206
    public function getTerminalId()
207
    {
208
        return $this->getParameter('terminalId');
209
    }
210
211
    public function setTerminalId($value)
212
    {
213
        return $this->setParameter('terminalId', $value);
214
    }
215
216
217
    /**
218
     * Get the email field
219
     *
220
     * Corresponds to the Ds_Merchant_Emv3Ds.email field in Redsys documentation.
221
     *
222
     * @return string
223
     */
224
    public function getEmail()
225
    {
226
        return $this->getParameter('email');
227
    }
228
229
    /**
230
     * Set the email field
231
     *
232
     * Corresponds to the Ds_Merchant_Emv3Ds.email field in Redsys documentation.
233
     *
234
     * @param string $value
235
     * @return self
236
     */
237
    public function setEmail($value)
238
    {
239
        return $this->setParameter('email', $value);
240
    }
241
242
    /**
243
     * Get the homePhoneCountryPrefix field
244
     *
245
     * Corresponds to the Ds_Merchant_Emv3Ds.homePhone.cc field in Redsys documentation.
246
     *
247
     * @return string
248
     */
249
    public function getHomePhoneCountryPrefix()
250
    {
251
        return $this->getParameter('homePhoneCountryPrefix');
252
    }
253
254
    /**
255
     * Set the homePhoneCountryPrefix field
256
     *
257
     * Corresponds to the Ds_Merchant_Emv3Ds.homePhone.cc field in the Redsys documentation.
258
     *
259
     * @param string $value
260
     * @return self
261
     */
262
    public function setHomePhoneCountryPrefix($value)
263
    {
264
        return $this->setParameter('homePhoneCountryPrefix', $value);
265
    }
266
267
    /**
268
     * Get the homePhone field
269
     *
270
     * Corresponds to the Ds_Merchant_Emv3Ds.homePhone.subscriber field in Redsys documentation.
271
     *
272
     * @return string
273
     */
274
    public function getHomePhone()
275
    {
276
        return $this->getParameter('homePhone');
277
    }
278
279
    /**
280
     * Set the homePhone field
281
     *
282
     * Corresponds to the Ds_Merchant_Emv3Ds.homePhone.subscriber field in the Redsys documentation.
283
     *
284
     * @param string $value
285
     * @return self
286
     */
287
    public function setHomePhone($value)
288
    {
289
        return $this->setParameter('homePhone', $value);
290
    }
291
292
    /**
293
     * Get the mobilePhoneCountryPrefix field
294
     *
295
     * Corresponds to the Ds_Merchant_Emv3Ds.mobilePhone.cc field in Redsys documentation.
296
     *
297
     * @return string
298
     */
299
    public function getMobilePhoneCountryPrefix()
300
    {
301
        return $this->getParameter('mobilePhoneCountryPrefix');
302
    }
303
304
    /**
305
     * Set the mobilePhoneCountryPrefix field
306
     *
307
     * Corresponds to the Ds_Merchant_Emv3Ds.mobilePhone.cc field in the Redsys documentation.
308
     *
309
     * @param string $value
310
     * @return self
311
     */
312
    public function setMobilePhoneCountryPrefix($value)
313
    {
314
        return $this->setParameter('mobilePhoneCountryPrefix', $value);
315
    }
316
317
    /**
318
     * Get the mobilePhone field
319
     *
320
     * Corresponds to the Ds_Merchant_Emv3Ds.mobilePhone.subscriber field in Redsys documentation.
321
     *
322
     * @return string
323
     */
324
    public function getMobilePhone()
325
    {
326
        return $this->getParameter('mobilePhone');
327
    }
328
329
    /**
330
     * Set the mobilePhone field
331
     *
332
     * Corresponds to the Ds_Merchant_Emv3Ds.mobilePhone.subscriber field in the Redsys documentation.
333
     *
334
     * @param string $value
335
     * @return self
336
     */
337
    public function setMobilePhone($value)
338
    {
339
        return $this->setParameter('mobilePhone', $value);
340
    }
341
342
    /**
343
     * Get the workPhoneCountryPrefix field
344
     *
345
     * Corresponds to the Ds_Merchant_Emv3Ds.workPhone.cc field in Redsys documentation.
346
     *
347
     * @return string
348
     */
349
    public function getWorkPhoneCountryPrefix()
350
    {
351
        return $this->getParameter('workPhoneCountryPrefix');
352
    }
353
354
    /**
355
     * Set the workPhoneCountryPrefix field
356
     *
357
     * Corresponds to the Ds_Merchant_Emv3Ds.workPhone.cc field in the Redsys documentation.
358
     *
359
     * @param string $value
360
     * @return self
361
     */
362
    public function setWorkPhoneCountryPrefix($value)
363
    {
364
        return $this->setParameter('workPhoneCountryPrefix', $value);
365
    }
366
367
    /**
368
     * Get the workPhone field
369
     *
370
     * Corresponds to the Ds_Merchant_Emv3Ds.workPhone.subscriber field in Redsys documentation.
371
     *
372
     * @return string
373
     */
374
    public function getWorkPhone()
375
    {
376
        return $this->getParameter('workPhone');
377
    }
378
379
    /**
380
     * Set the workPhone field
381
     *
382
     * Corresponds to the Ds_Merchant_Emv3Ds.workPhone.subscriber field in the Redsys documentation.
383
     *
384
     * @param string $value
385
     * @return self
386
     */
387
    public function setWorkPhone($value)
388
    {
389
        return $this->setParameter('workPhone', $value);
390
    }
391
392
    /**
393
     * Get the shippingAddress1 field
394
     *
395
     * Corresponds to the Ds_Merchant_Emv3Ds.shipAddrLine1 field in the Redsys documentation.
396
     *
397
     * @return string
398
     */
399
    public function getShippingAddress1()
400
    {
401
        return $this->getParameter('shippingAddress1');
402
    }
403
404
    /**
405
     * Set the shippingAddress1 field
406
     *
407
     * Corresponds to the Ds_Merchant_Emv3Ds.shipAddrLine1 field in the Redsys documentation.
408
     *
409
     * @param string $value
410
     * @return self
411
     */
412
    public function setShippingAddress1($value)
413
    {
414
        return $this->setParameter('shippingAddress1', $value);
415
    }
416
417
    /**
418
     * Get the shippingAddress2 field
419
     *
420
     * Corresponds to the Ds_Merchant_Emv3Ds.shipAddrLine2 field in the Redsys documentation.
421
     *
422
     * @return string
423
     */
424
    public function getShippingAddress2()
425
    {
426
        return $this->getParameter('shippingAddress2');
427
    }
428
429
    /**
430
     * Set the shippingAddress2 field
431
     *
432
     * Corresponds to the Ds_Merchant_Emv3Ds.shipAddrLine2 field in the Redsys documentation.
433
     *
434
     * @param string $value
435
     * @return self
436
     */
437
    public function setShippingAddress2($value)
438
    {
439
        return $this->setParameter('shippingAddress2', $value);
440
    }
441
442
    /**
443
     * Get the shippingAddress3 field
444
     *
445
     * Corresponds to the Ds_Merchant_Emv3Ds.shipAddrLine3 field in the Redsys documentation.
446
     *
447
     * @return string
448
     */
449
    public function getShippingAddress3()
450
    {
451
        return $this->getParameter('shippingAddress3');
452
    }
453
454
    /**
455
     * Set the shippingAddress3 field
456
     *
457
     * Corresponds to the Ds_Merchant_Emv3Ds.shipAddrLine3 field in the Redsys documentation.
458
     *
459
     * @param string $value
460
     * @return self
461
     */
462
    public function setShippingAddress3($value)
463
    {
464
        return $this->setParameter('shippingAddress3', $value);
465
    }
466
467
    /**
468
     * Get the shippingCity field
469
     *
470
     * Corresponds to the Ds_Merchant_Emv3Ds.shipAddrCity field in the Redsys documentation.
471
     *
472
     * @return string
473
     */
474
    public function getShippingCity()
475
    {
476
        return $this->getParameter('shippingCity');
477
    }
478
479
    /**
480
     * Set the shippingCity field
481
     *
482
     * Corresponds to the Ds_Merchant_Emv3Ds.shipAddrCity field in the Redsys documentation.
483
     *
484
     * @param string $value The shipping state as an ISO3166-2 subdivision code, e.g. CA for California.
485
     * @return self
486
     */
487
    public function setShippingCity($value)
488
    {
489
        return $this->setParameter('shippingCity', $value);
490
    }
491
492
    /**
493
     * Get the shippingPostcode field
494
     *
495
     * Corresponds to the Ds_Merchant_Emv3Ds.shipAddrPostCode field in the Redsys documentation.
496
     *
497
     * @return string
498
     */
499
    public function getShippingPostcode()
500
    {
501
        return $this->getParameter('shippingPostcode');
502
    }
503
504
    /**
505
     * Set the shippingPostcode field
506
     *
507
     * Corresponds to the Ds_Merchant_Emv3Ds.shipAddrPostCode field in the Redsys documentation.
508
     *
509
     * @param string $value
510
     * @return self
511
     */
512
    public function setShippingPostcode($value)
513
    {
514
        return $this->setParameter('shippingPostcode', $value);
515
    }
516
517
    /**
518
     * Get the shippingState field
519
     *
520
     * Corresponds to the Ds_Merchant_Emv3Ds.shipAddrState field in the Redsys documentation.
521
     *
522
     * @return string The shipping state as an ISO3166-2 subdivision code, e.g. CA for California.
523
     */
524
    public function getShippingState()
525
    {
526
        return $this->getParameter('shippingState');
527
    }
528
529
    /**
530
     * Set the shippingState field
531
     *
532
     * Corresponds to the Ds_Merchant_Emv3Ds.shipAddrState field in the Redsys documentation.
533
     *
534
     * @param string $value
535
     * @return self
536
     */
537
    public function setShippingState($value)
538
    {
539
        return $this->setParameter('shippingState', $value);
540
    }
541
542
    /**
543
     * Get the shippingCountry field
544
     *
545
     * Corresponds to the Ds_Merchant_Emv3Ds.shipAddrCountry field in the Redsys documentation.
546
     *
547
     * @return int The shipping country as an ISO3166 numeric code, e.g. 840 for USA.
548
     */
549
    public function getShippingCountry()
550
    {
551
        return $this->getParameter('shippingCountry');
552
    }
553
554
    /**
555
     * Set the shippingCountry field
556
     *
557
     * Corresponds to the Ds_Merchant_Emv3Ds.shipAddrCountry field in the Redsys documentation.
558
     *
559
     * @param int $value The shipping country as an ISO3166 numeric code, e.g. 840 for USA.
560
     * @return self
561
     */
562
    public function setShippingCountry($value)
563
    {
564
        return $this->setParameter('shippingCountry', $value);
565
    }
566
567
    /**
568
     * Get the billingAddress1 field
569
     *
570
     * Corresponds to the Ds_Merchant_Emv3Ds.billAddrLine1 field in the Redsys documentation.
571
     *
572
     * @return string
573
     */
574
    public function getBillingAddress1()
575
    {
576
        return $this->getParameter('billingAddress1');
577
    }
578
579
    /**
580
     * Set the billingAddress1 field
581
     *
582
     * Corresponds to the Ds_Merchant_Emv3Ds.billAddrLine1 field in the Redsys documentation.
583
     *
584
     * @param string $value
585
     * @return self
586
     */
587
    public function setBillingAddress1($value)
588
    {
589
        return $this->setParameter('billingAddress1', $value);
590
    }
591
592
    /**
593
     * Get the billingAddress2 field
594
     *
595
     * Corresponds to the Ds_Merchant_Emv3Ds.billAddrLine2 field in the Redsys documentation.
596
     *
597
     * @return string
598
     */
599
    public function getBillingAddress2()
600
    {
601
        return $this->getParameter('billingAddress2');
602
    }
603
604
    /**
605
     * Set the billingAddress2 field
606
     *
607
     * Corresponds to the Ds_Merchant_Emv3Ds.billAddrLine2 field in the Redsys documentation.
608
     *
609
     * @param string $value
610
     * @return self
611
     */
612
    public function setBillingAddress2($value)
613
    {
614
        return $this->setParameter('billingAddress2', $value);
615
    }
616
617
    /**
618
     * Get the billingAddress3 field
619
     *
620
     * Corresponds to the Ds_Merchant_Emv3Ds.billAddrLine3 field in the Redsys documentation.
621
     *
622
     * @return string
623
     */
624
    public function getBillingAddress3()
625
    {
626
        return $this->getParameter('billingAddress3');
627
    }
628
629
    /**
630
     * Set the billingAddress3 field
631
     *
632
     * Corresponds to the Ds_Merchant_Emv3Ds.billAddrLine3 field in the Redsys documentation.
633
     *
634
     * @param string $value
635
     * @return self
636
     */
637
    public function setBillingAddress3($value)
638
    {
639
        return $this->setParameter('billingAddress3', $value);
640
    }
641
642
    /**
643
     * Get the billingCity field
644
     *
645
     * Corresponds to the Ds_Merchant_Emv3Ds.billAddrCity field in the Redsys documentation.
646
     *
647
     * @return string
648
     */
649
    public function getBillingCity()
650
    {
651
        return $this->getParameter('billingCity');
652
    }
653
654
    /**
655
     * Set the billingCity field
656
     *
657
     * Corresponds to the Ds_Merchant_Emv3Ds.billAddrCity field in the Redsys documentation.
658
     *
659
     * @param string $value The billing state as an ISO3166-2 subdivision code, e.g. CA for California.
660
     * @return self
661
     */
662
    public function setBillingCity($value)
663
    {
664
        return $this->setParameter('billingCity', $value);
665
    }
666
667
    /**
668
     * Get the billingPostcode field
669
     *
670
     * Corresponds to the Ds_Merchant_Emv3Ds.billAddrPostCode field in the Redsys documentation.
671
     *
672
     * @return string
673
     */
674
    public function getBillingPostcode()
675
    {
676
        return $this->getParameter('billingPostcode');
677
    }
678
679
    /**
680
     * Set the billingPostcode field
681
     *
682
     * Corresponds to the Ds_Merchant_Emv3Ds.billAddrPostCode field in the Redsys documentation.
683
     *
684
     * @param string $value
685
     * @return self
686
     */
687
    public function setBillingPostcode($value)
688
    {
689
        return $this->setParameter('billingPostcode', $value);
690
    }
691
692
    /**
693
     * Get the billingState field
694
     *
695
     * Corresponds to the Ds_Merchant_Emv3Ds.billAddrState field in the Redsys documentation.
696
     *
697
     * @return string The billing state as an ISO3166-2 subdivision code, e.g. CA for California.
698
     */
699
    public function getBillingState()
700
    {
701
        return $this->getParameter('billingState');
702
    }
703
704
    /**
705
     * Set the billingState field
706
     *
707
     * Corresponds to the Ds_Merchant_Emv3Ds.billAddrState field in the Redsys documentation.
708
     *
709
     * @param string $value
710
     * @return self
711
     */
712
    public function setBillingState($value)
713
    {
714
        return $this->setParameter('billingState', $value);
715
    }
716
717
    /**
718
     * Get the billingCountry field
719
     *
720
     * Corresponds to the Ds_Merchant_Emv3Ds.billAddrCountry field in the Redsys documentation.
721
     *
722
     * @return int The billing country as an ISO3166 numeric code, e.g. 840 for USA.
723
     */
724
    public function getBillingCountry()
725
    {
726
        return $this->getParameter('billingCountry');
727
    }
728
729
    /**
730
     * Set the billingCountry field
731
     *
732
     * Corresponds to the Ds_Merchant_Emv3Ds.billAddrCountry field in the Redsys documentation.
733
     *
734
     * @param int $value The billing country as an ISO3166 numeric code, e.g. 840 for USA.
735
     * @return self
736
     */
737
    public function setBillingCountry($value)
738
    {
739
        return $this->setParameter('billingCountry', $value);
740
    }
741
742
    /**
743
     * Get the addressMatch field
744
     *
745
     * Corresponds to the Ds_Merchant_Emv3Ds.addrMatch field in Redsys documentation.
746
     *
747
     * @return boolean
748
     */
749
    public function getAddressMatch()
750
    {
751
        return $this->getParameter('addressMatch');
752
    }
753
754
    /**
755
     * Set the addressMatch field
756
     *
757
     * Corresponds to the Ds_Merchant_Emv3Ds.addrMatch field in the Redsys documentation.
758
     *
759
     * @param boolean $value
760
     * @return self
761
     */
762
    public function setAddressMatch($value)
763
    {
764
        return $this->setParameter('addressMatch', $value);
765
    }
766
767
    /**
768
     * Get the challengeWindowSize field
769
     *
770
     * Corresponds to the Ds_Merchant_Emv3Ds.challengeWindowSize field in Redsys documentation.
771
     *
772
     * @return int One of the self::CHALLENGE_WINDOW_SIZE_* constants
773
     */
774
    public function getChallengeWindowSize()
775
    {
776
        return $this->getParameter('challengeWindowSize');
777
    }
778
779
    /**
780
     * Set the challengeWindowSize field
781
     *
782
     * Corresponds to the Ds_Merchant_Emv3Ds.challengeWindowSize field in the Redsys documentation.
783
     *
784
     * @param int $value One of the self::CHALLENGE_WINDOW_SIZE_* constants
785
     * @return self
786
     */
787
    public function setChallengeWindowSize($value)
788
    {
789
        return $this->setParameter('challengeWindowSize', $value);
790
    }
791
792
    /**
793
     * Get the customerAdditionalInformation field
794
     *
795
     * Corresponds to the Ds_Merchant_Emv3Ds.acctID field in Redsys documentation.
796
     *
797
     * @return string
798
     */
799
    public function getCustomerAdditionalInformation()
800
    {
801
        return $this->getParameter('customerAdditionalInformation');
802
    }
803
804
    /**
805
     * Set the customerAdditionalInformation field
806
     *
807
     * Corresponds to the Ds_Merchant_Emv3Ds.acctID field in the Redsys documentation.
808
     *
809
     * @param string $value
810
     * @return self
811
     */
812
    public function setCustomerAdditionalInformation($value)
813
    {
814
        return $this->setParameter('customerAdditionalInformation', $value);
815
    }
816
817
    /**
818
     * Get the 3DsRequestAuthenticationMethodData field
819
     *
820
     * Corresponds to the Ds_Merchant_Emv3Ds.threeDSRequestorAuthenticationInfo.threeDSReqAuthData field in Redsys
821
     * documentation.
822
     *
823
     * @return string
824
     */
825
    public function get3DsRequestAuthenticationMethodData()
826
    {
827
        return $this->getParameter('3DsRequestAuthenticationMethodData');
828
    }
829
830
    /**
831
     * Set the 3DsRequestAuthenticationMethodData field
832
     *
833
     * Corresponds to the Ds_Merchant_Emv3Ds.threeDSRequestorAuthenticationInfo.threeDSReqAuthData field in the Redsys
834
     * documentation.
835
     *
836
     * @param string $value
837
     * @return self
838
     */
839
    public function set3DsRequestAuthenticationMethodData($value)
840
    {
841
        return $this->setParameter('3DsRequestAuthenticationMethodData', $value);
842
    }
843
844
    /**
845
     * Get the 3DsRequestAuthenticationMethod field
846
     *
847
     * Corresponds to the Ds_Merchant_Emv3Ds.threeDSRequestorAuthenticationInfo.threeDSReqAuthMethod field in Redsys
848
     * documentation.
849
     *
850
     * @return int One of the self::ACCOUNT_AUTHENTICATION_METHOD_* constants.
851
     */
852
    public function get3DsRequestAuthenticationMethod()
853
    {
854
        return $this->getParameter('3DsRequestAuthenticationMethod');
855
    }
856
857
    /**
858
     * Set the 3DsRequestAuthenticationMethod field
859
     *
860
     * Corresponds to the Ds_Merchant_Emv3Ds.threeDSRequestorAuthenticationInfo.threeDSReqAuthMethod field in the Redsys
861
     * documentation.
862
     *
863
     * @param int $value One of the self::ACCOUNT_AUTHENTICATION_METHOD_* constants.
864
     * @return self
865
     */
866
    public function set3DsRequestAuthenticationMethod($value)
867
    {
868
        return $this->setParameter('3DsRequestAuthenticationMethod', $value);
869
    }
870
871
    /**
872
     * Get the 3DsRequestAuthenticationTime field
873
     *
874
     * Corresponds to the Ds_Merchant_Emv3Ds.threeDSRequestorAuthenticationInfo.threeDSReqAuthTimestamp field in Redsys
875
     * documentation.
876
     *
877
     * @return DateTime|int
878
     */
879
    public function get3DsRequestAuthenticationTime()
880
    {
881
        return $this->getParameter('3DsRequestAuthenticationTime');
882
    }
883
884
    /**
885
     * Set the 3DsRequestAuthenticationTime field
886
     *
887
     * Corresponds to the Ds_Merchant_Emv3Ds.threeDSRequestorAuthenticationInfo.threeDSReqAuthTimestamp field in the
888
     * Redsys documentation.
889
     *
890
     * @param DateTime|int $value
891
     * @return self
892
     */
893
    public function set3DsRequestAuthenticationTime($value)
894
    {
895
        return $this->setParameter('3DsRequestAuthenticationTime', $value);
896
    }
897
898
    /**
899
     * Get the customerAccountCreationIndicator field
900
     *
901
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.chAccAgeInd field in Redsys documentation.
902
     *
903
     * @return int CUSTOMER_ACCOUNT_CREATED_*
904
     */
905
    public function getCustomerAccountCreationIndicator()
906
    {
907
        return $this->getParameter('customerAccountCreationIndicator');
908
    }
909
910
    /**
911
     * Set the customerAccountCreationIndicator field
912
     *
913
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.chAccAgeInd field in the Redsys documentation.
914
     *
915
     * @param int $value CUSTOMER_ACCOUNT_CREATED_*
916
     * @return self
917
     */
918
    public function setCustomerAccountCreationIndicator($value)
919
    {
920
        return $this->setParameter('customerAccountCreationIndicator', $value);
921
    }
922
923
    /**
924
     * Get the customerAccountCreationDate field
925
     *
926
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.chAccDate field in Redsys documentation.
927
     *
928
     * @return DateTime|int
929
     */
930
    public function getCustomerAccountCreationDate()
931
    {
932
        return $this->getParameter('customerAccountCreationDate');
933
    }
934
935
    /**
936
     * Set the customerAccountCreationDate field
937
     *
938
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.chAccDate field in the Redsys documentation.
939
     *
940
     * @param DateTime|int $value
941
     * @return self
942
     */
943
    public function setCustomerAccountCreationDate($value)
944
    {
945
        return $this->setParameter('customerAccountCreationDate', $value);
946
    }
947
948
    /**
949
     * Get the customerAccountModificationIndicator field
950
     *
951
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.chAccChangeInd field in Redsys documentation.
952
     *
953
     * @return int CUSTOMER_ACCOUNT_MODIFIED_*
954
     */
955
    public function getCustomerAccountModificationIndicator()
956
    {
957
        return $this->getParameter('customerAccountModificationIndicator');
958
    }
959
960
    /**
961
     * Set the customerAccountModificationIndicator field
962
     *
963
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.chAccChangeInd field in the Redsys documentation.
964
     *
965
     * @param int $value CUSTOMER_ACCOUNT_MODIFIED_*
966
     * @return self
967
     */
968
    public function setCustomerAccountModificationIndicator($value)
969
    {
970
        return $this->setParameter('customerAccountModificationIndicator', $value);
971
    }
972
973
    /**
974
     * Get the customerAccountModificationDate field
975
     *
976
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.chAccChange field in Redsys documentation.
977
     *
978
     * @return DateTime|int
979
     */
980
    public function getCustomerAccountModificationDate()
981
    {
982
        return $this->getParameter('customerAccountModificationDate');
983
    }
984
985
    /**
986
     * Set the customerAccountModificationDate field
987
     *
988
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.chAccChange field in the Redsys documentation.
989
     *
990
     * @param DateTime|int $value
991
     * @return self
992
     */
993
    public function setCustomerAccountModificationDate($value)
994
    {
995
        return $this->setParameter('customerAccountModificationDate', $value);
996
    }
997
998
    /**
999
     * Get the customerPasswordAgeIndicator field
1000
     *
1001
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.chAccPwChangeInd field in Redsys documentation.
1002
     *
1003
     * @return int CUSTOMER_ACCOUNT_PASSWORD_MODIFIED_*
1004
     */
1005
    public function getCustomerPasswordModificationIndicator()
1006
    {
1007
        return $this->getParameter('customerPasswordAgeIndicator');
1008
    }
1009
1010
    /**
1011
     * Set the customerPasswordAgeIndicator field
1012
     *
1013
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.chAccPwChangeInd field in the Redsys documentation.
1014
     *
1015
     * @param int $value CUSTOMER_ACCOUNT_PASSWORD_MODIFIED_*
1016
     * @return self
1017
     */
1018
    public function setCustomerPasswordModificationIndicator($value)
1019
    {
1020
        return $this->setParameter('customerPasswordAgeIndicator', $value);
1021
    }
1022
1023
    /**
1024
     * Get the customerPasswordModificationDate field
1025
     *
1026
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.chAccPwChange field in Redsys documentation.
1027
     *
1028
     * @return DateTime|int
1029
     */
1030
    public function getCustomerPasswordModificationDate()
1031
    {
1032
        return $this->getParameter('customerPasswordModificationDate');
1033
    }
1034
1035
    /**
1036
     * Set the customerPasswordModificationDate field
1037
     *
1038
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.chAccPwChange field in the Redsys documentation.
1039
     *
1040
     * @param DateTime|int $value
1041
     * @return self
1042
     */
1043
    public function setCustomerPasswordModificationDate($value)
1044
    {
1045
        return $this->setParameter('customerPasswordModificationDate', $value);
1046
    }
1047
1048
    /**
1049
     * Get the customerPurchasesInLast6Months field
1050
     *
1051
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.nbPurchaseAccount field in Redsys documentation.
1052
     *
1053
     * @return int
1054
     */
1055
    public function getCustomerPurchasesInLast6Months()
1056
    {
1057
        return $this->getParameter('customerPurchasesInLast6Months');
1058
    }
1059
1060
    /**
1061
     * Set the customerPurchasesInLast6Months field
1062
     *
1063
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.nbPurchaseAccount field in the Redsys documentation.
1064
     *
1065
     * @param int $value
1066
     * @return self
1067
     */
1068
    public function setCustomerPurchasesInLast6Months($value)
1069
    {
1070
        return $this->setParameter('customerPurchasesInLast6Months', $value);
1071
    }
1072
1073
    /**
1074
     * Get the customerAccountCardProvisionsLast24Hours field
1075
     *
1076
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.provisionAttemptsDay field in Redsys documentation.
1077
     *
1078
     * @return int
1079
     */
1080
    public function getCustomerAccountCardProvisionsLast24Hours()
1081
    {
1082
        return $this->getParameter('customerAccountCardProvisionsLast24Hours');
1083
    }
1084
1085
    /**
1086
     * Set the customerAccountCardProvisionsLast24Hours field
1087
     *
1088
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.provisionAttemptsDay field in the Redsys documentation.
1089
     *
1090
     * @param int $value
1091
     * @return self
1092
     */
1093
    public function setCustomerAccountCardProvisionsLast24Hours($value)
1094
    {
1095
        return $this->setParameter('customerAccountCardProvisionsLast24Hours', $value);
1096
    }
1097
1098
    /**
1099
     * Get the customerAccountTransactionsLast24Hours field
1100
     *
1101
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.txnActivityDay field in Redsys documentation.
1102
     *
1103
     * @return int
1104
     */
1105
    public function getCustomerAccountTransactionsLast24Hours()
1106
    {
1107
        return $this->getParameter('customerAccountTransactionsLast24Hours');
1108
    }
1109
1110
    /**
1111
     * Set the customerAccountTransactionsLast24Hours field
1112
     *
1113
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.txnActivityDay field in the Redsys documentation.
1114
     *
1115
     * @param int $value
1116
     * @return self
1117
     */
1118
    public function setCustomerAccountTransactionsLast24Hours($value)
1119
    {
1120
        return $this->setParameter('customerAccountTransactionsLast24Hours', $value);
1121
    }
1122
1123
    /**
1124
     * Get the customerAccountTransactionsLastYear field
1125
     *
1126
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.txnActivityYear field in Redsys documentation.
1127
     *
1128
     * @return int
1129
     */
1130
    public function getCustomerAccountTransactionsLastYear()
1131
    {
1132
        return $this->getParameter('customerAccountTransactionsLastYear');
1133
    }
1134
1135
    /**
1136
     * Set the customerAccountTransactionsLastYear field
1137
     *
1138
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.txnActivityYear field in the Redsys documentation.
1139
     *
1140
     * @param int $value
1141
     * @return self
1142
     */
1143
    public function setCustomerAccountTransactionsLastYear($value)
1144
    {
1145
        return $this->setParameter('customerAccountTransactionsLastYear', $value);
1146
    }
1147
1148
    /**
1149
     * Get the customerPaymentMethodCreationIndicator field
1150
     *
1151
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.paymentAccInd field in Redsys documentation.
1152
     *
1153
     * @return int PAYMENT_METHOD_CREATED_*
1154
     */
1155
    public function getCustomerPaymentMethodCreationIndicator()
1156
    {
1157
        return $this->getParameter('customerPaymentMethodCreationIndicator');
1158
    }
1159
1160
    /**
1161
     * Set the customerPaymentMethodCreationIndicator field
1162
     *
1163
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.paymentAccInd field in the Redsys documentation.
1164
     *
1165
     * @param int PAYMENT_METHOD_CREATED_* $value
1166
     * @return self
1167
     */
1168
    public function setCustomerPaymentMethodCreationIndicator($value)
1169
    {
1170
        return $this->setParameter('customerPaymentMethodCreationIndicator', $value);
1171
    }
1172
1173
    /**
1174
     * Get the customerPaymentMethodCreationDate field
1175
     *
1176
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.paymentAccAge field in Redsys documentation.
1177
     *
1178
     * @return DateTime|int
1179
     */
1180
    public function getCustomerPaymentMethodCreationDate()
1181
    {
1182
        return $this->getParameter('customerPaymentMethodCreationDate');
1183
    }
1184
1185
    /**
1186
     * Set the customerPaymentMethodCreationDate field
1187
     *
1188
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.paymentAccAge field in the Redsys documentation.
1189
     *
1190
     * @param DateTime|int $value
1191
     * @return self
1192
     */
1193
    public function setCustomerPaymentMethodCreationDate($value)
1194
    {
1195
        return $this->setParameter('customerPaymentMethodCreationDate', $value);
1196
    }
1197
1198
    /**
1199
     * Get the shippingAddressFirstUsedIndicator field
1200
     *
1201
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.shipAddressUsageInd field in Redsys documentation.
1202
     *
1203
     * @return int SHIPPING_ADDRESS_USAGE_*
1204
     */
1205
    public function getShippingAddressFirstUsedIndicator()
1206
    {
1207
        return $this->getParameter('shippingAddressFirstUsedIndicator');
1208
    }
1209
1210
    /**
1211
     * Set the shippingAddressFirstUsedIndicator field
1212
     *
1213
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.shipAddressUsageInd field in the Redsys documentation.
1214
     *
1215
     * @param int $value SHIPPING_ADDRESS_USAGE_*
1216
     * @return self
1217
     */
1218
    public function setShippingAddressFirstUsedIndicator($value)
1219
    {
1220
        return $this->setParameter('shippingAddressFirstUsedIndicator', $value);
1221
    }
1222
1223
    /**
1224
     * Get the shippingAddressFirstUsedDate field
1225
     *
1226
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.shipAddressUsage field in Redsys documentation.
1227
     *
1228
     * @return DateTime|int
1229
     */
1230
    public function getShippingAddressFirstUsedDate()
1231
    {
1232
        return $this->getParameter('shippingAddressFirstUsedDate');
1233
    }
1234
1235
    /**
1236
     * Set the shippingAddressFirstUsedDate field
1237
     *
1238
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.shipAddressUsage field in the Redsys documentation.
1239
     *
1240
     * @param DateTime|int $value
1241
     * @return self
1242
     */
1243
    public function setShippingAddressFirstUsedDate($value)
1244
    {
1245
        return $this->setParameter('shippingAddressFirstUsedDate', $value);
1246
    }
1247
1248
    /**
1249
     * Get the shippingNameCustomerNameMatch field
1250
     *
1251
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.shipNameIndicator field in Redsys documentation.
1252
     *
1253
     * @return boolean
1254
     */
1255
    public function getShippingNameCustomerNameMatch()
1256
    {
1257
        return $this->getParameter('shippingNameCustomerNameMatch');
1258
    }
1259
1260
    /**
1261
     * Set the shippingNameCustomerNameMatch field
1262
     *
1263
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.shipNameIndicator field in the Redsys documentation.
1264
     *
1265
     * @param boolean $value
1266
     * @return self
1267
     */
1268
    public function setShippingNameCustomerNameMatch($value)
1269
    {
1270
        return $this->setParameter('shippingNameCustomerNameMatch', $value);
1271
    }
1272
1273
    /**
1274
     * Get the customerHasSuspiciousActivity field
1275
     *
1276
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.suspiciousAccActivity field in Redsys documentation.
1277
     *
1278
     * @return boolean
1279
     */
1280
    public function getCustomerHasSuspiciousActivity()
1281
    {
1282
        return $this->getParameter('customerHasSuspiciousActivity');
1283
    }
1284
1285
    /**
1286
     * Set the customerHasSuspiciousActivity field
1287
     *
1288
     * Corresponds to the Ds_Merchant_Emv3Ds.acctInfo.suspiciousAccActivity field in the Redsys documentation.
1289
     *
1290
     * @param boolean $value
1291
     * @return self
1292
     */
1293
    public function setCustomerHasSuspiciousActivity($value)
1294
    {
1295
        return $this->setParameter('customerHasSuspiciousActivity', $value);
1296
    }
1297
1298
    /**
1299
     * Get the deliveryEmail field
1300
     *
1301
     * Corresponds to the Ds_Merchant_Emv3Ds.MerchantRiskIndicator.deliveryEmailAddress field in Redsys documentation.
1302
     *
1303
     * @return string
1304
     */
1305
    public function getDeliveryEmail()
1306
    {
1307
        return $this->getParameter('deliveryEmail');
1308
    }
1309
1310
    /**
1311
     * Set the deliveryEmail field
1312
     *
1313
     * Corresponds to the Ds_Merchant_Emv3Ds.MerchantRiskIndicator.deliveryEmailAddress field in the Redsys
1314
     * documentation.
1315
     *
1316
     * @param string $value
1317
     * @return self
1318
     */
1319
    public function setDeliveryEmail($value)
1320
    {
1321
        return $this->setParameter('deliveryEmail', $value);
1322
    }
1323
1324
    /**
1325
     * Get the deliveryTimeframeIndicator field
1326
     *
1327
     * Corresponds to the Ds_Merchant_Emv3Ds.MerchantRiskIndicator.deliveryTimeframe field in Redsys documentation.
1328
     *
1329
     * @return int DELIVERY_TIMEFRAME_*
1330
     */
1331
    public function getDeliveryTimeframeIndicator()
1332
    {
1333
        return $this->getParameter('deliveryTimeframeIndicator');
1334
    }
1335
1336
    /**
1337
     * Set the deliveryTimeframeIndicator field
1338
     *
1339
     * Corresponds to the Ds_Merchant_Emv3Ds.MerchantRiskIndicator.deliveryTimeframe field in the Redsys documentation.
1340
     *
1341
     * @param int $value DELIVERY_TIMEFRAME_*
1342
     * @return self
1343
     */
1344
    public function setDeliveryTimeframeIndicator($value)
1345
    {
1346
        return $this->setParameter('deliveryTimeframeIndicator', $value);
1347
    }
1348
1349
    /**
1350
     * Get the giftCardAmount field
1351
     *
1352
     * Corresponds to the Ds_Merchant_Emv3Ds.MerchantRiskIndicator.giftCardAmount field in Redsys documentation.
1353
     *
1354
     * @return int
1355
     */
1356
    public function getGiftCardAmount()
1357
    {
1358
        return $this->getParameter('giftCardAmount');
1359
    }
1360
1361
    /**
1362
     * Set the giftCardAmount field
1363
     *
1364
     * Corresponds to the Ds_Merchant_Emv3Ds.MerchantRiskIndicator.giftCardAmount field in the Redsys documentation.
1365
     *
1366
     * @param int $value
1367
     * @return self
1368
     */
1369
    public function setGiftCardAmount($value)
1370
    {
1371
        return $this->setParameter('giftCardAmount', $value);
1372
    }
1373
1374
    /**
1375
     * Get the giftCardCount field
1376
     *
1377
     * Corresponds to the Ds_Merchant_Emv3Ds.MerchantRiskIndicator.giftCardCount field in Redsys documentation.
1378
     *
1379
     * @return int
1380
     */
1381
    public function getGiftCardCount()
1382
    {
1383
        return $this->getParameter('giftCardCount');
1384
    }
1385
1386
    /**
1387
     * Set the giftCardCount field
1388
     *
1389
     * Corresponds to the Ds_Merchant_Emv3Ds.MerchantRiskIndicator.giftCardCount field in the Redsys documentation.
1390
     *
1391
     * @param int $value
1392
     * @return self
1393
     */
1394
    public function setGiftCardCount($value)
1395
    {
1396
        return $this->setParameter('giftCardCount', $value);
1397
    }
1398
1399
    /**
1400
     * Get the giftCardCurrency field
1401
     *
1402
     * Corresponds to the Ds_Merchant_Emv3Ds.MerchantRiskIndicator.giftCardCurr field in Redsys documentation.
1403
     *
1404
     * @return string ISO-4217 currency code
1405
     */
1406
    public function getGiftCardCurrency()
1407
    {
1408
        return $this->getParameter('giftCardCurrency');
1409
    }
1410
1411
    /**
1412
     * Set the giftCardCurrency field
1413
     *
1414
     * Corresponds to the Ds_Merchant_Emv3Ds.MerchantRiskIndicator.giftCardCurr field in the Redsys documentation.
1415
     *
1416
     * @param string $value ISO-4217 currency code
1417
     * @return self
1418
     */
1419
    public function setGiftCardCurrency($value)
1420
    {
1421
        return $this->setParameter('giftCardCurrency', $value);
1422
    }
1423
1424
    /**
1425
     * Get the purchasingPreOrder field
1426
     *
1427
     * Corresponds to the Ds_Merchant_Emv3Ds.MerchantRiskIndicator.preOrderPurchaseInd field in Redsys documentation.
1428
     *
1429
     * @return boolean True if the customer is purchasing a preorder
1430
     */
1431
    public function getPurchasingPreOrder()
1432
    {
1433
        return $this->getParameter('purchasingPreOrder');
1434
    }
1435
1436
    /**
1437
     * Set the purchasingPreOrder field
1438
     *
1439
     * Corresponds to the Ds_Merchant_Emv3Ds.MerchantRiskIndicator.preOrderPurchaseInd field in the Redsys
1440
     * documentation.
1441
     *
1442
     * @param boolean $value True if the customer is purchasing a preorder
1443
     * @return self
1444
     */
1445
    public function setPurchasingPreOrder($value)
1446
    {
1447
        return $this->setParameter('purchasingPreOrder', $value);
1448
    }
1449
1450
    /**
1451
     * Get the preOrderDate field
1452
     *
1453
     * Corresponds to the Ds_Merchant_Emv3Ds.MerchantRiskIndicator.preOrderDate field in Redsys documentation.
1454
     *
1455
     * @return DateTime|int
1456
     */
1457
    public function getPreOrderDate()
1458
    {
1459
        return $this->getParameter('preOrderDate');
1460
    }
1461
1462
    /**
1463
     * Set the preOrderDate field
1464
     *
1465
     * Corresponds to the Ds_Merchant_Emv3Ds.MerchantRiskIndicator.preOrderDate field in the Redsys documentation.
1466
     *
1467
     * @param DateTime|int $value
1468
     * @return self
1469
     */
1470
    public function setPreOrderDate($value)
1471
    {
1472
        return $this->setParameter('preOrderDate', $value);
1473
    }
1474
1475
    /**
1476
     * Get the customerHasPurchasedProductBefore field
1477
     *
1478
     * Corresponds to the Ds_Merchant_Emv3Ds.MerchantRiskIndicator.reorderItemsInd field in Redsys documentation.
1479
     *
1480
     * @return boolean
1481
     */
1482
    public function getCustomerHasPurchasedProductBefore()
1483
    {
1484
        return $this->getParameter('customerHasPurchasedProductBefore');
1485
    }
1486
1487
    /**
1488
     * Set the customerHasPurchasedProductBefore field
1489
     *
1490
     * Corresponds to the Ds_Merchant_Emv3Ds.MerchantRiskIndicator.reorderItemsInd field in the Redsys documentation.
1491
     *
1492
     * @param boolean $value
1493
     * @return self
1494
     */
1495
    public function setCustomerHasPurchasedProductBefore($value)
1496
    {
1497
        return $this->setParameter('customerHasPurchasedProductBefore', $value);
1498
    }
1499
1500
    /**
1501
     * Get the shippingAddressIndicator field
1502
     *
1503
     * Corresponds to the Ds_Merchant_Emv3Ds.MerchantRiskIndicator.shipIndicator field in Redsys documentation.
1504
     *
1505
     * @return int SHIPPING_*
1506
     */
1507
    public function getShippingAddressIndicator()
1508
    {
1509
        return $this->getParameter('shippingAddressIndicator');
1510
    }
1511
1512
    /**
1513
     * Set the shippingAddressIndicator field
1514
     *
1515
     * Corresponds to the Ds_Merchant_Emv3Ds.MerchantRiskIndicator.shipIndicator field in the Redsys documentation.
1516
     *
1517
     * @param int $value SHIPPING_*
1518
     * @return self
1519
     */
1520
    public function setShippingAddressIndicator($value)
1521
    {
1522
        return $this->setParameter('shippingAddressIndicator', $value);
1523
    }
1524
1525
    /**
1526
     * Override the abstract method to add requirement that it must start with 4 numeric characters
1527
     *
1528
     * @param string|int $value The transaction ID (merchant order) to set for the transaction
1529
     */
1530
    public function setTransactionId($value)
1531
    {
1532
        $start = substr($value, 0, 4);
1533
        $numerics = 0;
1534
        foreach (str_split($start) as $char) {
1535
            if (is_numeric($char)) {
1536
                $numerics++;
1537
            } else {
1538
                break;
1539
            }
1540
        }
1541
        $value = str_pad(substr($start, 0, $numerics), 4, 0, STR_PAD_LEFT).substr($value, $numerics);
1542
1543
        parent::setTransactionId($value);
1544
    }
1545
1546
    public function getData()
1547
    {
1548
        $this->validate('merchantId', 'terminalId', 'amount', 'currency');
1549
1550
        return array(
1551
            // mandatory fields
1552
            'Ds_Merchant_MerchantCode'       => $this->getMerchantId(),
1553
            'Ds_Merchant_Terminal'           => $this->getTerminalId(),
1554
            'Ds_Merchant_TransactionType'    => '0',                          // Authorisation
1555
            'Ds_Merchant_Amount'             => $this->getAmountInteger(),
1556
            'Ds_Merchant_Currency'           => $this->getCurrencyNumeric(),  // uses ISO-4217 codes
1557
            'Ds_Merchant_Order'              => $this->getTransactionId(),
1558
            'Ds_Merchant_MerchantUrl'        => $this->getNotifyUrl(),
1559
            // optional fields
1560
            'Ds_Merchant_ProductDescription' => $this->getDescription(),
1561
            'Ds_Merchant_Cardholder'         => $this->getCardholder(),
1562
            'Ds_Merchant_UrlOK'              => $this->getReturnUrl(),
1563
            'Ds_Merchant_UrlKO'              => $this->getReturnUrl(),
1564
            'Ds_Merchant_MerchantName'       => $this->getMerchantName(),
1565
            'Ds_Merchant_ConsumerLanguage'   => $this->getConsumerLanguage(),
1566
            'Ds_Merchant_MerchantData'       => $this->getMerchantData(),
1567
            // 3DS EMV fields
1568
            'Ds_Merchant_Emv3Ds'             => [
1569
                'cardholderName'   => $this->getCardholder(),
1570
                'email'            => $this->getEmail(),
1571
                'homePhone' => [
1572
                    'cc'         => $this->getHomePhoneCountryPrefix(),
1573
                    'subscriber' => $this->getHomePhone(),
1574
                ],
1575
                'mobilePhone' => [
1576
                    'cc'         => $this->getMobilePhoneCountryPrefix(),
1577
                    'subscriber' => $this->getMobilePhone(),
1578
                ],
1579
                'workPhone' => [
1580
                    'cc'         => $this->getWorkPhoneCountryPrefix(),
1581
                    'subscriber' => $this->getWorkPhone(),
1582
                ],
1583
                'shipAddrLine1'                      => $this->getShippingAddress1(),
1584
                'shipAddrLine2'                      => $this->getShippingAddress2(),
1585
                'shipAddrLine3'                      => $this->getShippingAddress3(),
1586
                'shipAddrCity'                       => $this->getShippingCity(),
1587
                'shipAddrPostCode'                   => $this->getShippingPostcode(),
1588
                'shipAddrState'                      => $this->getShippingState(),
1589
                'shipAddrCountry'                    => $this->getShippingCountry(),
1590
                'addrMatch'                          => $this->getAddressMatch() ? "Y" : "N",
1591
                'billAddrLine1'                      => $this->getBillingAddress1(),
1592
                'billAddrLine2'                      => $this->getBillingAddress2(),
1593
                'billAddrLine3'                      => $this->getBillingAddress3(),
1594
                'billAddrCity'                       => $this->getBillingCity(),
1595
                'billAddrPostCode'                   => $this->getBillingPostcode(),
1596
                'billAddrState'                      => $this->getBillingState(),
1597
                'billAddrCountry'                    => $this->getBillingCountry(),
1598
                'challengeWindowSize'                => $this->getChallengeWindowSize(),
1599
                'acctID'                             => $this->getCustomerAdditionalInformation(),
1600
                'threeDSRequestorAuthenticationInfo' => [
1601
                    'threeDSReqAuthData'      => $this->get3DsRequestAuthenticationMethodData(),
1602
                    'threeDSReqAuthMethod'    => $this->get3DsRequestAuthenticationMethod(),
1603
                    'threeDSReqAuthTimestamp' => $this->formatDateTime(
1604
                      $this->get3DsRequestAuthenticationTime(), "YmdHi"
1605
                    ),
1606
                ],
1607
                'acctInfo'                           => [
1608
                    'chAccAgeInd'           => $this->getCustomerAccountCreationIndicator(),
1609
                    'chAccDate'             => $this->formatDateTime($this->getCustomerAccountCreationDate(), "Ymd"),
1610
                    'chAccChangeInd'        => $this->getCustomerAccountModificationIndicator(),
1611
                    'chAccChange'           => $this->formatDateTime(
1612
                      $this->getCustomerAccountModificationDate(), "Ymd"
1613
                    ),
1614
                    'chAccPwChangeInd'      => $this->getCustomerPasswordModificationIndicator(),
1615
                    'chAccPwChange'         => $this->formatDateTime(
1616
                      $this->getCustomerPasswordModificationDate(), "Ymd"
1617
                    ),
1618
                    'nbPurchaseAccount'     => $this->getCustomerPurchasesInLast6Months(),
1619
                    'provisionAttemptsDay'  => $this->getCustomerAccountCardProvisionsLast24Hours(),
1620
                    'txnActivityDay'        => $this->getCustomerAccountTransactionsLast24Hours(),
1621
                    'txnActivityYear'       => $this->getCustomerAccountTransactionsLastYear(),
1622
                    'paymentAccInd'         => $this->getCustomerPaymentMethodCreationIndicator(),
1623
                    'paymentAccAge'         => $this->formatDateTime(
1624
                      $this->getCustomerPaymentMethodCreationDate(), "Ymd"
1625
                    ),
1626
                    'shipAddressUsageInd'   => $this->getShippingAddressFirstUsedIndicator(),
1627
                    'shipAddressUsage'      => $this->formatDateTime($this->getShippingAddressFirstUsedDate(), "Ymd"),
1628
                    'shipNameIndicator'     => $this->getShippingNameCustomerNameMatch() ? "01" : "02",
1629
                    'suspiciousAccActivity' => $this->getCustomerHasSuspiciousActivity() ? "02" : "01",
1630
                ],
1631
                'merchantRiskIndicator'              => [
1632
                    'deliveryEmailAddress' => $this->getDeliveryEmail(),
1633
                    'deliveryTimeframe'    => $this->getDeliveryTimeframeIndicator(),
1634
                    'giftCardAmount'       => $this->getGiftCardAmount() === null
1635
                      ? null
1636
                      : (int) $this->getGiftCardAmount(),
1637
                    'giftCardCount'        => $this->getGiftCardCount(),
1638
                    'giftCardCurr'         => $this->getGiftCardCurrency(),
1639
                    'preOrderPurchaseInd'  => $this->getPurchasingPreOrder() ? "02" : "01",
1640
                    'preOrderDate'         => $this->formatDateTime($this->getPreOrderDate(), "Ymd"),
1641
                    'reorderItemsInd'      => $this->getCustomerHasPurchasedProductBefore() ? "02" : "01",
1642
                    'shipIndicator'        => $this->getShippingAddressIndicator(),
1643
                ],
1644
            ],
1645
        );
1646
    }
1647
1648
    public function sendData($data)
1649
    {
1650
        $security = new Security;
1651
1652
        $encoded_data = $security->encodeMerchantParameters($data);
1653
1654
        $response_data = array(
1655
            'Ds_SignatureVersion'   => Security::VERSION,
1656
            'Ds_MerchantParameters' => $encoded_data,
1657
            'Ds_Signature'          => $security->createSignature(
1658
                $encoded_data,
1659
                $data['Ds_Merchant_Order'],
1660
                $this->getHmacKey()
1661
            ),
1662
        );
1663
1664
        return $this->response = new PurchaseResponse($this, $response_data);
1665
    }
1666
1667
    public function getEndpoint()
1668
    {
1669
        return $this->getTestMode() ? $this->testEndpoint : $this->liveEndpoint;
1670
    }
1671
1672
    /**
1673
     * Convert a DateTime or timestamp to a formatted date.
1674
     *
1675
     * @param DateTime|int $date The date to format.
1676
     * @param string $format The format to use.
1677
     *
1678
     * @return string|null The formatted date, or null if date isn't a timestamp or DateTime object.
1679
     */
1680
    protected static function formatDateTime($date, $format)
1681
    {
1682
        if (is_int($date)) {
1683
            return date($format, $date);
1684
        } elseif ($date instanceof DateTime) {
1685
            return $date->format($format);
1686
        }
1687
    }
1688
}
1689