Skip to content

Commit

Permalink
Fix for storing the ACH Last 4 from BGE, update to Save logic when ne…
Browse files Browse the repository at this point in the history
…w Payment Info is required
  • Loading branch information
lparrott committed Nov 11, 2022
1 parent dc45e0b commit e4b4487
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
4 changes: 3 additions & 1 deletion force-app/main/default/classes/ElevateBatchItem.cls
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public with sharing class ElevateBatchItem {
@AuraEnabled public String elevateBatchId {get; set;}
@AuraEnabled public String declineReason {get; set;}
@AuraEnabled public String cardLast4 {get; set;}
@AuraEnabled public String achLast4 {get; set;}
@AuraEnabled public String cardNetwork {get; set;}
@AuraEnabled public String cardExpirationMonth {get; set;}
@AuraEnabled public String cardExpirationYear {get; set;}
Expand All @@ -59,7 +60,8 @@ public with sharing class ElevateBatchItem {
this.elevateBatchId = createBatchItemResponse.elevateBatchId();
this.originalTransactionId = createBatchItemResponse.originalTransactionId();
this.declineReason = createBatchItemResponse.declineReason();
this.cardLast4 = createBatchItemResponse.last4();
this.cardLast4 = createBatchItemResponse.cardLast4();
this.achLast4 = createBatchItemResponse.achLast4();
this.status = createBatchItemResponse.status();
this.statusReason = createBatchItemResponse.statusReason();
this.cardNetwork = createBatchItemResponse.brand();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,14 @@ public class ElevateBatchItemCreateResponse {
return purchaseResponse?.authExpiresAt;
}

public String last4() {
public String cardLast4() {
return commitmentResponse != null ? commitmentResponse.cardData?.last4 : purchaseResponse.cardData?.last4;
}

public String achLast4() {
return commitmentResponse != null ? commitmentResponse.achData?.last4 : purchaseResponse.achData?.last4;
}

public String brand() {
return commitmentResponse != null ? commitmentResponse.cardData?.brand : purchaseResponse.cardData?.brand;
}
Expand Down
11 changes: 10 additions & 1 deletion force-app/main/default/lwc/geFormRenderer/geFormRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ import DATA_IMPORT_RECURRING_DONATION_CARD_EXPIRATION_YEAR
from '@salesforce/schema/DataImport__c.Recurring_Donation_Card_Expiration_Year__c';
import DATA_IMPORT_RECURRING_DONATION_CARD_LAST_4
from '@salesforce/schema/DataImport__c.Recurring_Donation_Card_Last_4__c';
import DATA_IMPORT_RECURRING_DONATION_ACH_LAST_4
from '@salesforce/schema/DataImport__c.Recurring_Donation_ACH_Last_4__c';
import DATA_IMPORT_RECURRING_TYPE
from '@salesforce/schema/DataImport__c.Recurring_Donation_Recurring_Type__c';

Expand Down Expand Up @@ -1065,6 +1067,11 @@ export default class GeFormRenderer extends LightningElement{
[apiNameFor(DATA_IMPORT_RECURRING_DONATION_CARD_LAST_4)]:
elevateBatchItem.cardLast4,
});
} else if (this.selectedPaymentMethod() === PAYMENT_METHOD_ACH) {
this.updateFormState({
[apiNameFor(DATA_IMPORT_RECURRING_DONATION_ACH_LAST_4)]:
elevateBatchItem.achLast4,
});
}
}
}
Expand Down Expand Up @@ -1438,8 +1445,10 @@ export default class GeFormRenderer extends LightningElement{
}

get isUpdateActionDisabled() {
let newPaymentInfoRequiredAndNotEntered = this.shouldShowElevateTransactionWarning &&
this._isElevateWidgetInDisabledState;
return this.getFieldValueFromFormState(STATUS_FIELD) === GIFT_STATUSES.IMPORTED ||
this.shouldShowElevateTransactionWarning ||
newPaymentInfoRequiredAndNotEntered ||
this.saveDisabled || (

(this.isWidgetEnabled || this.isGiftCommitment()) &&
Expand Down

0 comments on commit e4b4487

Please sign in to comment.