1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace lordelph\SIP2\Request; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* FeePaidRequest can be used to notify the ACS that a fee has been collected from the patron. The ACS should record |
7
|
|
|
* this information in their database and respond with a Fee Paid Response message. |
8
|
|
|
* |
9
|
|
|
* The FeeType can be one of |
10
|
|
|
* 01 other/unknown |
11
|
|
|
* 02 administrative |
12
|
|
|
* 03 damage |
13
|
|
|
* 04 overdue |
14
|
|
|
* 05 processing |
15
|
|
|
* 06 rental |
16
|
|
|
* 07 replacement |
17
|
|
|
* 08 computer access charge |
18
|
|
|
* 09 hold fee |
19
|
|
|
* The PaymentType can be one of |
20
|
|
|
* 00 cash |
21
|
|
|
* 01 visa |
22
|
|
|
* 02 credit card |
23
|
|
|
* |
24
|
|
|
* CurrencyType is a 3-letter code following ISO Standard 4217:1995 |
25
|
|
|
* |
26
|
|
|
* @method setFeeType(string $feeType) |
27
|
|
|
* @method setPaymentType(string $paymentType) |
28
|
|
|
* @method setCurrencyType(string $currencyCode) |
29
|
|
|
* @method setPaymentAmount(string $amount) |
30
|
|
|
* @method setInstitutionId(string $institutionId) |
31
|
|
|
* @method setPatronIdentifier(string $patron) |
32
|
|
|
* @method setTerminalPassword(string $terminalPassword) |
33
|
|
|
* @method setPatronPassword(string $patronPassword) |
34
|
|
|
* @method setFeeIdentifier(string $feeId) |
35
|
|
|
* @method setTransactionIdentifier(string $transactionId) |
36
|
|
|
* |
37
|
|
|
* @licence https://opensource.org/licenses/MIT |
38
|
|
|
* @copyright John Wohlers <[email protected]> |
39
|
|
|
* @copyright Paul Dixon <[email protected]> |
40
|
|
|
*/ |
41
|
|
|
class FeePaidRequest extends SIP2Request |
42
|
|
|
{ |
43
|
|
|
protected $var = [ |
44
|
|
|
'FeeType' => ['type' => 'nn'], |
45
|
|
|
'PaymentType' => ['type' => 'nn'], |
46
|
|
|
'CurrencyType' => ['default' => 'USD'], |
47
|
|
|
'PaymentAmount' => [], |
48
|
|
|
'InstitutionId' => [], |
49
|
|
|
'PatronIdentifier' => [], |
50
|
|
|
'TerminalPassword' => ['default' => ''], |
51
|
|
|
'PatronPassword' => ['default' => ''], |
52
|
|
|
'FeeIdentifier' => ['default' => ''], |
53
|
|
|
'TransactionIdentifier' => ['default' => ''], |
54
|
|
|
]; |
55
|
|
|
|
56
|
1 |
|
public function getMessageString($withSeq = true, $withCrc = true): string |
57
|
|
|
{ |
58
|
1 |
|
$this->newMessage('37'); |
59
|
1 |
|
$this->addFixedOption($this->datestamp(), 18); |
60
|
1 |
|
$this->addFixedOption(sprintf('%02d', (string)$this->getVariable('FeeType')), 2); |
61
|
1 |
|
$this->addFixedOption(sprintf('%02d', (string)$this->getVariable('PaymentType')), 2); |
62
|
1 |
|
$this->addFixedOption($this->getVariable('CurrencyType'), 3); |
63
|
|
|
|
64
|
|
|
// due to currency format localization, it is up to the programmer |
65
|
|
|
// to properly format their payment amount |
66
|
1 |
|
$this->addVarOption('BV', $this->getVariable('PaymentAmount')); |
67
|
1 |
|
$this->addVarOption('AO', $this->getVariable('InstitutionId')); |
68
|
1 |
|
$this->addVarOption('AA', $this->getVariable('PatronIdentifier')); |
69
|
1 |
|
$this->addVarOption('AC', $this->getVariable('TerminalPassword')); |
70
|
1 |
|
$this->addVarOption('AD', $this->getVariable('PatronPassword'), true); |
71
|
1 |
|
$this->addVarOption('CG', $this->getVariable('FeeIdentifier'), true); |
72
|
1 |
|
$this->addVarOption('BK', $this->getVariable('TransactionIdentifier'), true); |
73
|
|
|
|
74
|
1 |
|
return $this->returnMessage($withSeq, $withCrc); |
75
|
|
|
} |
76
|
|
|
} |
77
|
|
|
|